
But isn't the point of this code that you don't need that type signature? If I knew in advance that it was an Integer then I wouldn't need to passs "Integer" in the list. -Alex- On Thu, 29 Apr 2004, Chung-chieh Shan wrote:
On 2004-04-28T23:33:31-0400, S. Alexander Jacobson wrote:
I don't think this works. I just tried it with: main = print $ lookupRead 1 [(1,("Integer","100"))]
This fails for the same reason
print $ read "100"
fails. You need to give a type signature to avoid type-class instance ambiguity:
main = print $ (lookupRead 1 [(1,("Integer","100"))] :: Maybe Integer)
On GHCi 6.2.1, the above yields "Just 100" for me.
-- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig Be it declared and enacted by this present Parliament / That the People of England / are / a Commonwealth and free State / without any King or House of Lords. -- An Act declaring England to be a Commonwealth 1649-05-19 | 355 years | 2004-05-19 http://tinyurl.com/2dqnh
_________________________________________________________________ S. Alexander Jacobson mailto:me@alexjacobson.com tel:917-770-6565 http://alexjacobson.com