Daniel Fischer wrote:

I don't know Joy, but probably there the stack is (roughly) a heterogenous list, which is hard to model in Haskell, think of

data Element = Bool Bool
                     | Char Char
                     | Int Int
                      . . .
                     | IntToBool (Int -> Bool)
                      . . .

type Stack = [Element]

and how to define functions for that, urgh.


Not saying it isn't tricky - but thats what the HList library (http://www.cwi.nl/~ralf/HList) implements, a heterogenous list.
It works slightly differently using classes, but does abstract the
workings enough to be useful, to construct an HList you can do:


hlist = "a" .*. (3:Int) .*. False .*. 'v' .*. HNil

And provides head/tail functions and other useful list and set
operators.

   Keean.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to