Skip to content

Instantly share code, notes, and snippets.

@viercc
Created February 3, 2020 14:41
Show Gist options
  • Save viercc/eb6a4231636f91c89ee934d0ae425ba2 to your computer and use it in GitHub Desktop.
Save viercc/eb6a4231636f91c89ee934d0ae425ba2 to your computer and use it in GitHub Desktop.
-- Breaking first-class-instances
{-#
LANGUAGE
TemplateHaskell,
RankNTypes,
TypeFamilies,
KindSignatures,
FlexibleInstances,
ConstraintKinds
#-}
module Main where
import FCI
class Foo a where
foo :: a -> String
mkInst ''Foo
instance Foo String where
foo = ("top:" ++)
main :: IO ()
main = do
putStrLn $
Foo ("outer:" ++) ==> Foo ("inner:" ++) ==> foo (foo "")
putStrLn $
Foo ("outer:" ++) ==>
(let f = Foo ("inner:" ++) ==> foo . foo in f "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment