Why haskell use a type of ReadS a to represent a function?
I am reading the source code of reads. reads is defined as reads :: Read a
=> ReadS a So it simply returns ReadS a while a has to be a instance of
Read.
And ReadS a is defined as type ReadS a = String -> [(a, String)], so the
thing returned from reads is only a function that take a string and return
an array of tuple.
Then I wonder why just define reads without ReadS a. Just like reads ::
Read a => (String -> [(a, String)])
No comments:
Post a Comment