Created
January 13, 2012 21:18
-
-
Save seanhess/1608750 to your computer and use it in GitHub Desktop.
ListWriter.hs
This file contains hidden or 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
data ListWriter = ListWriter [String] | |
runListWriter :: ListWriter -> [String] | |
runListWriter (ListWriter xs) = xs | |
execListWriter :: ListWriter -> [String] | |
execListWriter = runListWriter | |
instance Monad ListWriter where | |
return a = ListWriter [] | |
ListWriter xs >>= f = ListWriter xs ++ ys | |
where ListWriter ys = f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment