On 5 Apr 2000, Friedrich Dominicus wrote:

> So my question is: Exists such a function or do I have to write it on my own? And 
>the other is what would you
> think would be a good Haskell soluton for turing a string to an Integer.
> 

Yes of course!

it is called: read


Prelude> read "12334" + 4 
12338
Prelude> read "-123"::Int
-123

read is polymorphic, and can be used to build a value of any type that is
an instance of Read. 


Prelude> read "True"::Bool
True

Prelude> read "[1,2,3,4]"::[Int]
[1,2,3,4]

I hope this helps.

/Lars L



Reply via email to