[Haskell-cafe] parser

Chris Eidhof chris at eidhof.nl
Fri Dec 7 16:17:54 EST 2007

On 6 dec 2007, at 18:06, Ryan Bloor wrote:
> Can anyone advise me on how to check whether a string contains ints,  
> chars, bools, etc....
> "2345 + 6767" shoudl give IntAdd (2345) (6767)
> "2345" should give IntT 2345
You need to write a parser. There are a lot of libraries that will  
help you write a parser. One library that is often used for writing  
parsers in Haskell is called Parsec [1]. There's good documentation on  
that site on how to use it. Parsec is already included in you  
distribution. Good luck!


[1]: http://legacy.cs.uu.nl/daan/parsec.html

More information about the Haskell-Cafe mailing list