[Haskell-cafe] What extension do I need to write "type Job = Map k a"?

Yves Parès yves.pares at gmail.com
Wed Jun 13 15:19:37 CEST 2012


Mmmmh... no, to do that you need ImpredicativeTypes (which is I believe
about to be deprecated).
You have to declare Job a data, not a type, and use
ExistentialQuantification.

2012/6/13 Ismael Figueroa Palet <ifigueroap at gmail.com>

> Do you want to hide the specific types of the job? Presumably to then
> define a type JobList = [Job] ?
> You can do that with the ExistentialQuantification extension.
>
> type Job = forall k a. Map k a
> type JobList = [Job]
>
> ??
> Note you can't unpack the types k a once you have hidden them. But the
> typechecker can use it to ensure some static property.
> Also you could use unsafeCoerce to do some casts, but *only if you are
> *sure* that things will go OK*.
>
>
> 2012/6/13 Magicloud Magiclouds <magicloud.magiclouds at gmail.com>
>
>> Hi,
>>  I've forgotten this.
>>  This is OK:
>> type Job k a = Map k a
>>  And this is OK:
>> {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
>> type Job = forall a. forall k. Map k a
>>
>>  Then how to write it like this?
>> type Job = Map k a
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> And for G+, please use magiclouds#gmail.com.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
>
> --
> Ismael
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120613/707035d3/attachment.htm>


More information about the Haskell-Cafe mailing list