[Haskell-beginners] Data.Text to Int?
Brandon Allbery
allbery.b at gmail.com
Fri Dec 14 16:05:43 CET 2012
On Fri, Dec 14, 2012 at 9:57 AM, Emmanuel Touzery <etouzery at gmail.com>wrote:
> I expected "read" to work directly on a Data.Text because Data.Text has
> an instance of the Read class, but it seems to fail:
>
An instance of Read means that read can *produce* a Text, not that it can
consume one. read always reads from a String, as you can see from its type:
Prelude Data.Text> :t read
read :: Read a => String -> a
(Note that it is the result type a in the context for Read.)
See the Data.Text.Read module (part of the text package you already have
installed) for how to do similar things with a Text as a source.
--
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121214/101fff95/attachment.htm>
More information about the Beginners
mailing list