
I'd like to find a reference to reading with patterns such as read::[(Int,Int)] Thanks, Walt

It's not really clear to me what you're asking. The function read is a
method of the typeclass Read, and it has type Read a => String -> a.
There are a number of instances of the typeclass Read in the standard
prelude (http://www.haskell.org/onlinereport/standard-prelude.html)
Notably,
instance Read Int where ...
instance (Read a, Read b) => Read (a,b) where ...
instance (Read a) => Read [a] where ...
which, taken together, imply that the type [(Int,Int)] is in the
typeclass Read, and so there is a suitable implementation of read ::
String -> [(Int,Int)] If you want to see how that might be
implemented (though haskell implementations are allowed to do the same
thing in a different way), see the link to the prelude there.
hope this helps,
- Cale
On 4/21/05, Walt Potter
I'd like to find a reference to reading with patterns such as read::[(Int,Int)]
Thanks, Walt
participants (2)
-
Cale Gibbard
-
Walt Potter