
On Wed, Nov 11, 2009 at 4:24 PM, zaxis
data Branch tok st a = forall b. Branch (PermParser tok st (b -> a)) (GenParser tok st b)
I have hoogled the `forall` but i cannot find any appropriate answer!
That's an example of an existential type. What that line is saying is that for any type b (ie. for all b) that you could pick, the constructor called 'Branch' can take something of type 'PermParser tok st (b -> a)' and something of type 'GenParser tok st b' and make something of type 'Branch tok st a' out of it. The reason it's called an existential type is something like this: once you've constructed your thing of type 'Branch tok st a' you've lost the information about what the type b was. So all you know is that inside your thing is a pair of objects of type 'PermParser tok st (b -> a)' and 'GenParser tok st b' but you don't know what b is. All you know is that there exists some type 'b' that it was made of. To use these types with ghc you need to use the compilation flag -XExistentialQuantification. There's more to be found here: http://www.haskell.org/haskellwiki/Existential_type -- Dan