default roles
José Pedro Magalhães
dreixel
Tue Oct 8 08:01:47 UTC 2013
Hi,
On Tue, Oct 8, 2013 at 3:21 AM, Richard Eisenberg <eir at cis.upenn.edu> wrote:
> We considered this for a while, but it led to a strange design -- to do it
> right, you would have to import all constructors for all datatypes
> *recursively* out to the leaves, starting at the datatypes mentioned in the
> class for which you wanted to use GND. This would mean potentially a whole
> lot of imports for symbols not actually used in the text of a program.
>
I'm not sure I understand why constructors are involved in this. Wouldn't
something like
the following potentially be useful?
data Role = Nominal | Representational | Phantom | Fun Role Role
type family HasRole (t :: k) :: Role
data MyData a b = MyData a
data MyGADT a b where MyGADT :: MyGADT a Int
type instance HasRole MyData = Fun Representational Phantom
type instance HasRole MyGADT = Fun Representational Nominal
type instance HasRole Traversable = Nominal
HasRole instances would be automatically given by GHC.
Cheers,
Pedro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20131008/f958f152/attachment-0001.html>
More information about the Glasgow-haskell-users
mailing list