Skip to content

Instantly share code, notes, and snippets.

@deech
Created February 12, 2017 15:17
Show Gist options
  • Save deech/6fe465b67281876390dcebd2d6a60592 to your computer and use it in GitHub Desktop.
Save deech/6fe465b67281876390dcebd2d6a60592 to your computer and use it in GitHub Desktop.
Typeclasses in the REPL.
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /tmp/ghci7261/ghci-script
Prelude> class Foo a where { foo :: a -> Int }
Prelude> instance Foo () where { foo _ = 1 }
Prelude> f = foo ()
Prelude> class Foo a where { foo :: a -> IO () }
Prelude> f
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment