Problem with lexically scoped type variables.
brianh at metamilk.com
Mon Oct 2 10:26:51 EDT 2006
Mirko Rahn wrote:
> In ghc-6.4.2 this works as expected, but ghc-6.5.20061001 says
> A pattern type signature cannot bind scoped type variables `s'
> unless the pattern has a rigid type context
Why are the rules for lexically scoped type variables so complicated?
Could we not just have a very simple rule like the following:
1) Any type variable not explicitly introduced by a forall is implicitly
scoped over the entire top level decl that contains the expression/pattern
that contains the type variable
By "entire top level decl" I mean the highest level decl that makes sense
foo :: MonadIO m => a -> m a
foo x = let
bar :: forall b. b -> m b -- 'm' bound by foo's
bar y = return y
zap :: a -> Int
zap _ = let
yup = sizeOf (undefined :: a)
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.
More information about the Glasgow-haskell-users