I propose the following clean-up to the handling of implicit parameters. 
Currently they are special in all sorts of ways, notably by having their own 
name-cache.  See IfaceEnv.allocateIPName, and TysWiredIn.mkIPName.  This is 
pretty messy.

But consider: this gets very close

    class IP (name :: Symbol) ty | name -> ty where
        value :: ty

Instead of the constraint (?x::Int) we'd have (IP "x" Int).   I'm not actually 
suggesting changing the surface syntax, only the internal representation.

This would, at a stroke, get rid of much of the special handling of implicit 
parameters. There are still some special rules about generalisation that we 
might want to preserve, but by and large everything would be handled with much 
less code for implicit parameters.

Any comments?

Iavor, you're an expert on implicit parameters, and you implemented the Symbol 
stuff that the idea depends on.  Might you even like to implement the above 
plan?

Simon
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to