Reputation: 74364
What are the downsides to ScopedTypeVariables
, if there are any? Why isn't it on by default? Does it lead to worse inference? Are there edge cases where it fails? Is it significantly harder to implement in GHC?
Upvotes: 10
Views: 366
Reputation: 63379
It's also because it changes the semantics of a program (combined with other extensions). Consider
{-# LANGUAGE RankNTypes #-}
foo :: forall a . (a -> a) -> (a -> a)
foo = bar
where
bar :: a -> a
bar = id
It compiles fine, but with ScopedTypeVariables
it even fails to compile.
Upvotes: 11
Reputation: 64740
It isn't on by default for the same reason every other extension isn't on by default - it isn't part of the Haskell standard.
As augustss said - this requires more logic in the type checker but I don't think anyone considers it burdensome.
Upvotes: 8