ConstraintKinds and default associated empty constraints
Bas van Dijk
v.dijk.bas at gmail.com
Mon Jan 9 08:23:32 CET 2012
That would be nice. It would also be nice to be able to use _ in type
signatures as in:
const :: a -> _ -> a
const x _ = x
During type checking each _ could be replaced by a new unique type
variable. Visa versa should also be possible: during type inferencing each
unique type variable could be replaced by a _.
Bas
On Jan 9, 2012 6:22 AM, "wren ng thornton" <wren at freegeek.org> wrote:
> On 1/8/12 8:32 AM, Bas van Dijk wrote:
>
>> On 23 December 2011 17:44, Simon Peyton-Jones<simonpj@**microsoft.com<simonpj at microsoft.com>>
>> wrote:
>>
>>> My attempt at forming a new understanding was driven by your example.
>>>
>>> class Functor f where
>>> type C f :: * -> Constraint
>>> type C f = ()
>>>
>>> sorry -- that was simply type incorrect. () does not have kind * ->
>>> Constraint
>>>
>>
>> So am I correct that the `class Empty a; instance Empty a` trick is
>> currently the only way to get default associated empty constraints?
>>
>
> Couldn't the following work?
>
> class Functor f where
> type C f :: * -> Constraint
> type C f _ = ()
>
> It seems to me that adding const to the type level (either implicitly or
> explicitly) is cleaner and simpler than overloading () to be Constraint,
> *->Constraint, *->*->Constraint,...
>
> --
> Live well,
> ~wren
>
> ______________________________**_________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.**org <Glasgow-haskell-users at haskell.org>
> http://www.haskell.org/**mailman/listinfo/glasgow-**haskell-users<http://www.haskell.org/mailman/listinfo/glasgow-haskell-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120109/7ba6ea66/attachment.htm>
More information about the Glasgow-haskell-users
mailing list