[Haskell-cafe] i am missing something really trivial with parsec

Ryan Ingram ryani.spam at gmail.com
Tue Sep 29 04:29:49 EDT 2009


I don't know, but:

number
-- definition
= do { num <- natural ; return $ num }
-- desugar
= natural >>= \num -> return $ num
-- apply ($)
= natural >>= \num -> return num
-- eta elimination (f == \x -> f x)
= natural >>= return
-- monad law
= natural

(modulo monomorphism restriction, since number doesn't take any arguments
and doesn't have a type signature)

  -- ryan

On Tue, Sep 29, 2009 at 12:54 AM, Anatoly Yakovenko
<aeyakovenko at gmail.com>wrote:

> number = do { num <- natural
>            ; return $ num
>            }
> main = do
>   txt <- hGetContents stdin
>   print $ parse number "stdin" txt
>
>
> why doesn't that work?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090929/e10c1471/attachment.html


More information about the Haskell-Cafe mailing list