Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downsides to ScopedTypeVariables

Tags:

types

haskell

ghc

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?

like image 448
J. Abrahamson Avatar asked Sep 17 '13 14:09

J. Abrahamson


1 Answers

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.

like image 70
Petr Avatar answered Sep 19 '22 15:09

Petr