[Haskell-beginners] read

Russ Abbott russ.abbott at gmail.com
Wed Oct 27 11:18:30 EDT 2010


Worked like a charm.  Thanks.
*
-- Russ*


On Tue, Oct 26, 2010 at 11:53 PM, edgar klerks <edgar.klerks at gmail.com>wrote:

> Hi Russ,
>
> You probably have the monomorphism restriction turned off, so you don't get
> an error message. If you add a type, it will work fine. Like this:
>
> Prelude> read "123"
> *** Exception: Prelude.read: no parse
> Prelude> read "123" :: Int
> 123
> Prelude>
>
> Greets,
>
> Edgar
>
> On Wed, Oct 27, 2010 at 8:36 AM, Russ Abbott <russ.abbott at gmail.com>wrote:
>
>> Hi,
>>
>> I'm having a problem with the read function. I thought it took a string
>> and converted it into a value (if there is a conversion). But it doesn't
>> seem to work for me on GHCi
>>
>> Prelude> read "123"
>> *** Exception: Prelude.read: no parse
>> Prelude> read (show 123)
>> *** Exception: Prelude.read: no parse
>>
>>
>> There must be something trivial that I'm missing.
>>
>> Thanks.
>>
>> *-- Russ Abbott*
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20101027/fe2f2fca/attachment.html


More information about the Beginners mailing list