[Haskell-beginners] Parser

Mike Houghton mike_k_houghton at yahoo.co.uk
Sat May 16 20:58:22 UTC 2015


Hi,

I’me writing a simple parser and can test it in GHCI 

parseTest moveParser "(1,2)->(3,3)”

and I get what I expect i.e.
Move {from = Location 1 2, to = Location 3 3}

I now have a text file (test.txt) with lots of (1,2)->(3,3) (3,6)->(3,9) etc etc and 
I really can’t see how I get the contents of the text file  into the parser!!

I have
main = do
	handle <- openFile "test.txt" ReadMode
	contents <- hGetContents handle
        !! what goes here!!! - how do I invoke moveParser with contents ??

Thanks 

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150516/da830564/attachment.html>


More information about the Beginners mailing list