
Jonathan Cast wrote:
I wouldn't call rank-2 types extremely rare . . .
Well now, my parser is annoyingly clunky to use, but it *works*. However, I just found something where it seems to be *impossible* to write the necessary code without rank-2 types... I tried to write this type: data Encoder2 = Encoder2 {stage1 :: [Word8] -> x, stage2 :: x -> [Word8] -> [Word8]} However, that doesn't work. All type variables on the right must appear on the left: data Encoder2 x = Encoder2 {stage1 :: [Word8] -> x, stage2 :: x -> [Word8] -> [Word8]} Now I have a problem. I want to put several of these puppies into a big list - and I do *not* want to force the type variable 'x' to be the same in all cases! (Although one can easily imagine situations where you might want this.) So as of now, my code uses rank-2 types - despite the fact that I don't actually know what a rank-2 type *is* yet! o_O This is rather troubling...