On 26 August 2011 09:22, Simon Peyton-Jones <simo...@microsoft.com> wrote:
> The underlying issue is that before type checking GHC (obviously) doesn't 
> know the types of things, while afterwards it does.  The whole HsSyn tree is 
> parameterised over the types of identifiers:
>
>  Parsed:       HsExpr RdrNames
>  Renamed:      HsExpr Name
>  Typechecked:  HsExpr Id
>
> One alternative would be to parameterise the tree over the type of 
> type-decorations, so instead of 'PostTcType' you'd have 'ty' (a variable) 
> instead.  So we'd have
>
>  Renamed:     HsExpr Name ()
>  Typechecked: HsExpr Id   Type
>
> To me this seems like a bit of a sledgehammer to crack a nut; and I think 
> there are a couple of other similar things (like SyntaxExpr).  But it might 
> be possible.

Type functions?

data HsExpr name = ... | HasTypeArgument (TypeInfo name)

type family TypeInfo name :: *
type instance TypeInfo RdrName = ()
type instance TypeInfo Name = Type

This basically lets you get away with just a single type index to
HsExpr and friends.

Max

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to