[commit: ghc] ghc-generics1: I generalized in @argTyFold@ from @spliTyConAppTy_maybe@ to @tcSplitAppTy_maybe at . First arguments of :.: no longer need to be type constructors -- they can now be other types involving type parameters, for example. (260350a)

José Pedro Magalhães jpm at cs.uu.nl
Fri Apr 20 18:02:43 CEST 2012


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

On branch  : ghc-generics1

http://hackage.haskell.org/trac/ghc/changeset/260350a7723ef5c76a5b082d5dbf996a98da6c0a

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

commit 260350a7723ef5c76a5b082d5dbf996a98da6c0a
Author: Nicolas Frisby <nicolas.frisby at gmail.com>
Date:   Tue Apr 10 19:30:00 2012 -0500

    I generalized in @argTyFold@ from @spliTyConAppTy_maybe@ to @tcSplitAppTy_maybe at . First arguments of :.: no longer need to be type constructors -- they can now be other types involving type parameters, for example.
    
    I also dropped the use of Par0 in Rep1 instances. Since type parameters other
    than the last can occur within the first argument of :.:, there's no point in
    distinguishing them from, say, Int. That is: distinguishing them doesn't let
    you define any more meaningful functions. The alternative choice to not allow
    other parameters in those first arguments is very unattractive because it would
    drastically reduce the size of the generic universe. Moreover, dropping Par0
    from Rep1 instances simplifies the definition of other functions. For example,
    the following deriving clause on E would infer a (nonsensical) "Functor T"
    constraint.
    
    > data E (f :: * -> *) a = E (T f) (f a)
    
    Avoiding that constraint, involves additional machinery in the definition of
    @TcGenGenerics.get_gen1_constrained_tys at . Since I doubt the usefulness of Par0
    in Rep1 instances anyway, I decided to just eliminate them instead.
    
    I also defined @canDoGenerics1@ separately from @cond_functorOK at . In
    particular, it checks that type constructors that will occur as first arguments
    to :.: are representable. If the applied type is not a type constructor, then
    no check is performed. This supplants the @cond_functorOk@ check from the
    previous definition of @argTyFold@ and also eliminates the need for
    TcDeriv.lhs-boot.
    
    Signed-off-by: Jose Pedro Magalhaes <jpm at cs.uu.nl>

 compiler/typecheck/TcDeriv.lhs       |   14 +--
 compiler/typecheck/TcDeriv.lhs-boot  |   11 --
 compiler/typecheck/TcGenGenerics.lhs |  219 +++++++++++++++++++++++++---------
 3 files changed, 169 insertions(+), 75 deletions(-)


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

    git show 260350a7723ef5c76a5b082d5dbf996a98da6c0a



More information about the Cvs-ghc mailing list