
At first I'd like to thank Claus, Ryan, Edsko, Luke and Derek for their quite helpful replies to my previous thread. In the course of following their advice I encountered the problem of moving a "forall" quantifier over a wrapper type constructor. If I have
newtype Wrapper a = Wrapper a
and I instantiate Wrapper with a polymorphic type, then it is possible to move the quantifier outside:
outside :: Wrapper (forall a. (t a)) -> (forall a. Wrapper (t a)) outside(Wrapper x) = Wrapper x
(surprisingly the code does not work with the implementation 'outside x = x'; I guess this is a ghc bug) However, the other way around does not work:
inside :: (forall a. Wrapper (t a))-> Wrapper (forall a. (t a)) inside x= x
results in the following error: Couldn't match expected type `forall a. t a' against inferred type `t a' Expected type: Wrapper (forall a1. t a1) Inferred type: Wrapper (t a) In the expression: x In the definition of `inside': inside x = x Any ideas on how to make this work? Klaus