> I understand that existentially bound types cannot escape. > > For example, say we have > data Foo = forall a. Foo Int a > > Then we cannot define a function > extract (Foo i a) = a > > However,this limitation makes it extremly difficult to program with local > quantifications.Is there any way to by pass this?
The idea is to use a type more like this: data Foo = forall a. Foo Int a (a -> (Int,Bool)) (a -> Int) (a -> Foo) where the functions are the operations you want to use on the data. So now a list of Foos can contain data of many different types, as long as it is paired with the appropriate accessor functions for those types. You can use it like this: case x of Foo n x f g h -> if snd (f x) then g x else 0 for example. --KW 8-) -- Keith Wansbrough <[EMAIL PROTECTED]> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory. _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell