Last active
August 29, 2015 14:07
-
-
Save gip/82aee58d0eb76a61e077 to your computer and use it in GitHub Desktop.
Haskell / Free Monad / How can I do something like this?
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
data A = A Text | |
data B = B Text A | |
data ActionC t next = InsertC t (t -> next) | |
instance Functor (ActionC t) where | |
fmap f (InsertC a b)= InsertC a (f . b) | |
insertC a = liftF (InsertC a id) | |
proC txt1 txt2 = do | |
a <- insertC $ A txt1 | |
b <- insertC $ B txt2 a | |
return b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you want 'String' in place of 'Text' in your definitions of A and B.
Not in scope: type constructor or class `Text'
Don't know if it does what you want, but it compiles when I make that change.