qualified instance declarations

Alastair Reid reid@reid-consulting-uk.ltd.uk
01 Jul 2002 11:26:04 +0100


For those puzzled by the number of things called 'a' in Ralf's
program, I'm attaching an alpha-renamed version.  Removing the type
signature (or changing the type signature to Integer) for a results in
Ralf's type error in Hugs.  

It does indeed look as though Hugs applies defaulting to 'a' and comes
up with the type Integer.  Off the top of my head, I'd say this was
correct since the default default is (Integer,Double).

--
Alastair Reid

  module C where
  
  class B a where f :: a -> Int


  
  module X where
  
  import qualified C
  
  instance C.B Int where
    f = const X.a
  
  a :: Int
  a = 4