[Haskell-beginners] Question about List Type Constraint and Null
Magnus Therning
magnus at therning.org
Sat Jan 22 09:07:05 CET 2011
On 22/01/11 06:03, aditya siram wrote:
> Hi all,
> The following function gives me an "Ambiguous type variable `a' in the
> constraint: `Read a' arising from a use of `res'" error:
> test :: Read a => String -> Maybe [(a,String)]
> test s = if null res then
> Nothing
> else
> Just $ fst $ head res
> where
> res = reads s
This code doesn't give me that error, in fact it gives me no error at all.
/M
--
Magnus Therning OpenPGP: 0xAB4DFBA4
email: magnus at therning.org jabber: magnus at therning.org
twitter: magthe http://therning.org/magnus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110122/c4b24d43/attachment.pgp>
More information about the Beginners
mailing list