[commit: ghc] at-defaults: Implement associated type defaults (1995895)

Max Bolingbroke batterseapower at hotmail.com
Tue Sep 6 11:14:27 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : at-defaults

http://hackage.haskell.org/trac/ghc/changeset/19958956651bbedb1f7aea781b599c32efc2c3d0

>---------------------------------------------------------------

commit 19958956651bbedb1f7aea781b599c32efc2c3d0
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date:   Tue Sep 6 09:04:37 2011 +0100

    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

 compiler/basicTypes/OccName.lhs        |    8 ++-
 compiler/deSugar/DsMeta.hs             |    2 +-
 compiler/hsSyn/Convert.lhs             |    2 +-
 compiler/hsSyn/HsDecls.lhs             |    8 ++-
 compiler/iface/BinIface.hs             |    8 ++
 compiler/iface/BuildTyCl.lhs           |    7 +-
 compiler/iface/IfaceSyn.lhs            |   22 ++++--
 compiler/iface/MkIface.lhs             |    9 ++-
 compiler/iface/TcIface.lhs             |   14 ++++-
 compiler/parser/RdrHsSyn.lhs           |   11 ++--
 compiler/rename/RnSource.lhs           |   14 +++--
 compiler/typecheck/TcInstDcls.lhs      |  120 +++++++++++++++++++++++--------
 compiler/typecheck/TcInstDcls.lhs-boot |   14 ++++
 compiler/typecheck/TcRnDriver.lhs      |    6 ++-
 compiler/typecheck/TcTyClsDecls.lhs    |   68 ++++++++++++++++---
 compiler/types/Class.lhs               |   35 ++++++---
 16 files changed, 267 insertions(+), 81 deletions(-)


Diff suppressed because of size. To see it, use:

    git show 19958956651bbedb1f7aea781b599c32efc2c3d0



More information about the Cvs-ghc mailing list