[Haskell-cafe] Heterogeneous Data Structures - Nested Pairs and functional references

Günther Schmidt gue.schmidt at web.de
Tue Feb 16 15:14:16 EST 2010


Hi,

I've been thinking a lot lately about heterogeneous and extensible data 
structures for which HList certainly offers a solution.

While HList is implemented through type-level programming I wonder if I 
can achieve similar results through value-level programming alone.

This is where I was thinking of functional references.

I wonder if or rather how one could do this:

Let's say there was some clever monad ...

someMonad = do
	h1 <- add "twenty"
	h2 <- add False
	h3 <- add 16
	.....	
	modify h2 True

and get a ("twenty",(True, 16)) back. And while *in* the monad some 
accessors available.

Now come to think of it I think I actually read about this somewhere so 
I doubt this is truly my idea.

Anybody got some thoughts on this?

Günther




More information about the Haskell-Cafe mailing list