Created
February 2, 2014 22:10
-
-
Save jonschoning/8775663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- http://stackoverflow.com/questions/7828072/how-does-haskell-printf-work | |
{-# LANGUAGE FlexibleInstances #-} | |
class FooType a where | |
bar :: IO () -> a | |
instance FooType (IO ()) where | |
bar = id | |
instance (Show x, FooType r) => FooType (x -> r) where | |
bar s x = bar (s >> print x) | |
foo :: FooType a => a | |
foo = bar (return ()) | |
main :: IO () | |
main = foo 3 "hello" True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment