[Haskell-beginners] Could not get parser ready

Tobias Brandt to_br at uni-bremen.de
Sun Nov 5 20:56:02 UTC 2017


  Hey,

can you show us your Parser definition? 

Cheers,
Tobias 

----- Nachricht von Marcus Manning <iconsize at gmail.com> ---------
     Datum: Sun, 5 Nov 2017 18:51:57 +0100
       Von: Marcus Manning <iconsize at gmail.com>
Antwort an: The Haskell-Beginners Mailing List - Discussion of  
primarily beginner-level topics related to Haskell  
<beginners at haskell.org>
   Betreff: [Haskell-beginners] Could not get parser ready
        An: beginners at haskell.org

> Hello,
>
> I follow the instructions of script [1] in order to set up a parser  
> functionality. But I' get into problems at page 202 with the code:
>
> p :: Parser (Char,Char)
> p = do
>              x ← item
>              item
>              y ← item
>              return (x,y)
>
> ghci and ghc throw errors:
> Prelude> let p:: Parser (Char,Char); p = do {x <- item; item; y <-  
> item; return (x,y)}
>
> <interactive>:10:65: error:
>     • Couldn't match type ‘[(Char, String)]’ with ‘Char’
>       Expected type: String -> [((Char, Char), String)]
>         Actual type: Parser ([(Char, String)], [(Char, String)])
>     • In a stmt of a 'do' block: return (x, y)
>       In the expression:
>         do x <- item
>            item
>            y <- item
>            return (x, y)
>       In an equation for ‘p’:
>           p = do x <- item
>                  item
>                  y <- item
>                  ....
> Did the semantics of do expr changed?
>
> [1]  
> https://userpages.uni-koblenz.de/~laemmel/paradigms1011/resources/pdf/haskell.pdf
>
> Cheers,
>
> iconfly.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

----- Ende der Nachricht von Marcus Manning <iconsize at gmail.com> -----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20171105/b16c8a82/attachment.html>


More information about the Beginners mailing list