On Sat, Feb 8, 2014 at 2:10 PM, Lorenzo Tabacchini <lortabac@gmx.com> wrote:
If I do:

exprParser :: Parsec String u (Expr a)
exprParser = parens exprParser
    <|> (reserved "true" >> return (Bool True))
    <|> (reserved "false" >> return (Bool False))
    <|> (stringLiteral >>= return . Text)

The compiler says: "Couldn't match type `Bool' with `[Char]'"
Where am I wrong?
 

The type of exprParser doesn't do what you intend. Specifically, the `a` in `(Expr a)` is chosen by the *caller* and you have to deal with that choice somehow --- it does not mean you can pick a different `a` in different parts of your code.

There are several ways you might redesign your types, but I think I'll have to let someone else address those.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net