
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:
http://hackage.haskell.org/package/HList-0.3.0.1/docs/Data-HList-HList.html
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
ex
On 1 December 2013 20:11, Sergey Bushnyak
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe