Magic classes for Overloaded Record Fields, overlaps, FunDeps

AntC anthony_clayden at clear.net.nz
Thu Apr 28 05:38:43 UTC 2016


>
> The labelled "birthday = ..." approach seems
> tantalisingly close to data constructors:
>    ( Name "Fred", Birthday $ Date 28 4 2016 )
>
> Which takes us (perhaps) to HLIst-style
> Type-Indexed Products.
> How could they fit with ORF?
> Perhaps introduce an implicit label spelled same as the Data Constructor?

Errk! That should be Type Constructor.
(I'm expecting these would be newtypes
with the Data Constructor punning on the Type.)

Thinking on ...

Having been unkind about the higher-kinded stuff,
[I withdraw and apologise.]
I wonder if we could use it?
Does this have any likelihood of working?

import Data.Kind
class IskLabel k (x :: k) a where fromkLabel :: Proxy# x -> a
instance IskLabel Symbol x (r -> a) where ...
         -- indexing by label
instance IskLabel (Type -> Type) t (r -> a) where ...
         -- indexing by Type Constructor

> Except starting lower case,
> otherwise the #name prefix will throw a wobbly.

??Is that actually true?
H98 field labels must be lower case,
so all the examples are.
But Symbol can be upper??


AntC



More information about the Glasgow-haskell-users mailing list