[Haskell] Re: how to write a list builder? fixpoint?

oleg at pobox.com oleg at pobox.com
Wed Jun 2 20:07:24 EDT 2004

I'm sorry I couldn't resist another example -- which requires fewer
signatures. It also illustrates storing build in data structures.
In the example below (which works with the code posted earlier) build
is used to build itself. It really has quite a few faces...

data W = W (forall r a. (BuildList a r) => (a->r))

test2 = let t1 = build (W build)
            t2 = build (W build) (W build)
	    t3 = t1 ++ t2
	    f (W b) = b (1::Int) ++
	              b (1::Int) (2::Int) ++
		      b (1::Int) (2::Int) (3::Int)
	in map f t3

We should probably move to Cafe for further discussions, if any...

More information about the Haskell mailing list