reads [Standard lab question]

37 views
Skip to first unread message

David Sands

unread,
Dec 10, 2015, 9:24:28 AM12/10/15
to chalmer...@googlegroups.com
A question about the standard lab came in:

In Part I, a hint says that we should use reads :: [(Double,String)] for
parsing floating point values, but we have no idea how to use that with
an unmodified version of Parsing.hs, because you have to pass the whole
unparsed string to reads, which is not accessible for a Parser. 

If you look at the API for Parsing 


then you find

readsP :: Read a => Parser a
A parser for anything in the Read class satisfying
parse readsP s == listToMaybe (reads s)

Reply all
Reply to author
Forward
0 new messages