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

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Thu Jun 14 03:33:54 CEST 2012


Thank you all. I just want to wrap some complex types.
So I learn from all info above, I still have to use forall explicitly....

On Wed, Jun 13, 2012 at 9:19 PM, Yves Parès <yves.pares at gmail.com> wrote:
> 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
>>
>



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.



More information about the Haskell-Cafe mailing list