[Haskell-cafe] Re: Proper round-trip HughesPJ/Parsec for Doubles?

Evan Laforge qdunkan at gmail.com
Fri Feb 26 13:45:13 EST 2010


> real :: Parser String
> real = do
>  d <- decimal
>  f <- option "" $ do
>    p <- char '.'
>    n <- many1 digit
>    return $ p : n

Just to throw two bits in here, this is the only style that doesn't
require leaning on the space bar and squinting to line things up,
doesn't require any fancy editor support, and looks fine with
proportional fonts.  It also allows you to move lines around with 'dd'
and 'p' in vi :)


More information about the Haskell-Cafe mailing list