[Haskell-cafe] Re: Rank 2 polymorphism in pattern matching?

Aaron Denney wnoise at ofb.net
Sat Apr 8 15:07:45 EDT 2006


On 2006-04-08, C Rodrigues <red5_2 at hotmail.com> wrote:
> This counterintuitive typechecking result came up when I wrote a wrapper 
> around runST.  Is there some limitation of HM with respect to type checking 
> pattern matching?
>
> data X a b = X (a -> a)
> run :: forall a. (forall b. X a b) -> a -> a
> -- This definition doesn't pass the typechecker
> run (X f) = f
> -- But this definition works
> run x = (\(X f) -> f) x

Have you tried 
run (X f) x = f x
?


-- 
Aaron Denney
-><-



More information about the Haskell-Cafe mailing list