[Haskell-cafe] Re: Is it possible to read existential types?
Chung-chieh Shan
ccshan at post.harvard.edu
Thu Apr 29 02:19:53 EDT 2004
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20040429/de08c7ed/attachment.bin
More information about the Haskell-Cafe
mailing list