
On Thu, Jun 13, 2019 at 04:46:25AM -0400, Viktor Dukhovni wrote:
On Jun 13, 2019, at 4:25 AM, Boris
wrote: Agree, a good point. And actually, your variant works without any extensions.
Well, in a sense it is working with an "extension", just one that happens to be on by default and is required in Haskell 98. Namely, what makes it work is the "MonomorphismRestriction". If you specify:
{-# LANGUAGE NoMonomorphismRestriction #-}
then the example stops working. I like the posted example as an exceptionally clear illustration of the MonomorphismRestriction.
And for the record, this version requires no extension nor unextension: {-# LANGUAGE NoMonomorphismRestriction #-} module Check where someCheck :: (Show a, Read a, Eq a) => String -> a -> Bool someCheck = someCheck' read where someCheck' r s v = (r . show . r $ s) == v