[Haskell-cafe] How to fix ambiguous type variable?

Marian Jancar marian.jancar at gmx.com
Thu Jun 13 07:50:01 UTC 2019


On 6/13/19 6:36 AM, Boris wrote:

 > someCheck :: (Show a, Read a, Eq a) => String -> a -> Bool
 > someCheck s v = (read . show . read $ s) == v

someCheck :: (Show a, Read a, Eq a) => String -> a -> Bool
someCheck s v = (r . show . r $ s) == v where r = read

I believe you do intend to use the same read in both cases anyway,
and letting a different read to slip in would be a bug.

Marian


More information about the Haskell-Cafe mailing list