On 6/21/07, Jules Bean <[EMAIL PROTECTED]> wrote:
I would write

primary = PrimaryIdentifier `fmap` identifer
       <|> PrimaryLiteral    `fmap` stringLiteral

(I prefer fmap to liftM but they are the same for monads). To my mind
this fits the general pattern of 'constructor comes before contents'.
with is, of course, just fmap with the parameters reversed.

Nice. I only discovered the joys of Data.Monad, fmap included
relatively recently, well after I'd spent quite some time writing
parsec parsers.

I note that it was Parsec that converted me to Haskell from Mercury[*]
- I wrote a library of parser combinators for Mercury, but the lambda
notation in Mercury is not nearly so clean as Haskell's, so lacking
special syntax for monadic code, the results looked horrible. Much
faster - Mercury is a strict language, so it's easier to compile into
respectable machine code - but horrible to read.

cheers,
T.
[*] Well, that, and the fact that my thesis was about Mercury, which
meant that once I was finished, I never wanted to look at Mercury
again. ;-)
--
Dr Thomas Conway
[EMAIL PROTECTED]

Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to