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

Ismael Figueroa Palet ifigueroap at gmail.com
Wed Jun 13 13:32:13 CEST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120613/52ac741a/attachment.htm>


More information about the Haskell-Cafe mailing list