[Haskell-cafe] Joy Combinators (Occurs check: infinite type)

Keean Schupke k.schupke at imperial.ac.uk
Sun Mar 6 04:31:28 EST 2005

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


More information about the Haskell-Cafe mailing list