[Haskell-cafe] Looking for reliable heterogeneous vectors

Andras Slemmer 0slemi0 at gmail.com
Sun Dec 1 20:27:06 UTC 2013

Sure, you can do this easily with a GADT + DataKinds for convenient
indexing with lists. The construct you need is called a heterogeneous list,
or HList:

But it's a nice exercise to implement it on your own anyway. If you need
"truly" heterogeneous lists where you can't even get the types of the
elements from the index typelist then you'll need to existentially hide the
types. This will simply be the same as HList without the indexing list.

Good luck

On 1 December 2013 20:11, Sergey Bushnyak <sergey.bushnyak at sigrlami.eu>wrote:

> Hello, everyone. I'm looking for reliable library or idea how to implement
> heterogenous vector properly. It may seem odd, but I want elements not only
> be different types but also functions, something like that, pseudocode:
>     hvec [a b (c->d) [a] ...]  -- can be any type
>     let hvec = hvec [ "stuff" 5 getUrl [1, 4, 5]]
> So far I found *vector-heterogenous* package, but can't decide is it good
> to build on or create something on my own.
> Any thoughts and ideas are appreciated. Thanks.
> _______________________________________________
> 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/20131201/624c1023/attachment.html>

More information about the Haskell-Cafe mailing list