Implement associated type defaults
authorMax Bolingbroke <batterseapower@hotmail.com>
Tue, 6 Sep 2011 08:04:37 +0000 (09:04 +0100)
committerMax Bolingbroke <batterseapower@hotmail.com>
Fri, 9 Sep 2011 07:26:59 +0000 (08:26 +0100)
commitde8c8d68cabb5f24304fad2f03caa41fdf182b4f
tree88e191e91aebad8ce2a2ef2bb467be73e0c4d063
parent967633d4175a1d5ce525fa3194f53c219b5e2f91
Implement associated type defaults

Basically, now you can write:

  class Cls a where
    type Typ a
    type Typ a = Just a

And now if an instance does not specify an explicit associated type
instance, one will be generated afresh based on that default. So for
example this instance:

  instance Cls Int where

Will be equivalent to this one:

  instance Cls Int where
    type Typ Int = Just Int
18 files changed:
compiler/basicTypes/OccName.lhs
compiler/deSugar/DsMeta.hs
compiler/hsSyn/Convert.lhs
compiler/hsSyn/HsDecls.lhs
compiler/iface/BinIface.hs
compiler/iface/BuildTyCl.lhs
compiler/iface/IfaceSyn.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/parser/RdrHsSyn.lhs
compiler/rename/RnSource.lhs
compiler/typecheck/TcClassDcl.lhs
compiler/typecheck/TcEnv.lhs
compiler/typecheck/TcInstDcls.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcTyClsDecls.lhs
compiler/types/Class.lhs
compiler/utils/Util.lhs