Skip to content

Instantly share code, notes, and snippets.

@abuiles
Created December 17, 2009 02:39
Show Gist options
  • Save abuiles/258480 to your computer and use it in GitHub Desktop.
Save abuiles/258480 to your computer and use it in GitHub Desktop.
data Burrito a = Tortilla a | TortillaSola
class Monad (m a) where
return :: m a
m a >>= f :: m a -> (a -> m b) -> m b
..
ahora
instance Monad (Tortilla a) where
return = (ponerCarneEnTortillaYEnvolver)::Burrito Carne
Tortilla a >>=f = f a #Que n seas carne o lo que tenga el burrito
TortillaSola >>f = TortillaSola
si.
ponerJalapeño :: a -> Burrito b
ponerJalapeño a = Tortilla (mezclar a jalapeño)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment