Yesterday, Mark Dominus took a picture of me eating a monad:
It was a delicious Chicken
monad.
data Chicken a = Chicken (Egg a) data Egg a = Egg (Chicken a) instance Monad Chicken where ...(exercise for the reader)
Yesterday, Mark Dominus took a picture of me eating a monad:
It was a delicious Chicken
monad.
data Chicken a = Chicken (Egg a) data Egg a = Egg (Chicken a) instance Monad Chicken where ...(exercise for the reader)
This site uses Akismet to reduce spam. Learn how your comment data is processed.
One of them can be a newtype (says Edward Kmett over my shoulder). You just have to choose which one you want to come first.
s/Chicken/Chips/
s/Egg/Cheese/
http://xkcd.com/140/
Clearly, neither came first:
> newtype Chicken = Chicken Egg deriving Show
> newtype Egg = Egg Chicken deriving Show
> undefined :: Chicken
Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (Chicken (Egg (**STACK OVERFLOW**