[Haskell-cafe] Problem with own written monad

Miguel Mitrofanov miguelimo38 at yandex.ru
Mon Jan 7 18:42:21 EST 2008


>> What kind of code would you write if it would be such monad?
>
> Useless stuff like:
>
> 	s2 = do
> 	  push 11
> 	  push 17
> 	  count >>= push
> 	  binop (+)
> 	  binop (*)
> 	  pop

Then you should use something like

data Stack a = Stack {run :: [Integer] -> (a,[Integer])}


More information about the Haskell-Cafe mailing list