Implict parameters and monomorphism

C.Reinke C.Reinke@ukc.ac.uk
Thu, 03 May 2001 13:19:49 +0100


> > Try this program:
> > -- Try commenting out this type signature.
> > fun:: (Num a) => a -> Int

> Defaulting applies only when all classes involved are Haskell 98.
> hbc, nhc98 and Hugs are not conforming.

Seems you're right (all classes for the ambiguous type variable need to
be from prelude or standard libraries).  Okay, so let's try the good
old boring show:

-- ii :: Double
ii = 1

main = case length (show ii) of
       { 1 -> putStrLn "type signature excluded"
       ; _ -> putStrLn "type signature included"
       }

Still, I liked Lennart's "magic" version;-)

Claus