Skip to content

Instantly share code, notes, and snippets.

@fatho
Forked from zrho/gist:6660923
Last active December 23, 2015 16:19
Show Gist options
  • Save fatho/6661270 to your computer and use it in GitHub Desktop.
Save fatho/6661270 to your computer and use it in GitHub Desktop.
import Control.Monad.IO.Class
newtype SchadeT m a = SchadeT { runSchade :: m a }
type SchadeM = SchadeT IO
instance Monad m => Monad (SchadeT m) where
return x = SchadeT $ return x
m >>= f = SchadeT $ runSchade m >>= (runSchade . f)
schade :: MonadIO m => SchadeT m ()
schade = SchadeT . liftIO $ putStrLn "Oohhhh!"
eineRundeMitleid :: MonadIO m => SchadeT m ()
eineRundeMitleid = replicateM_ 10 schade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment