[GHC] #9867: PatternSynonyms + ScopedTypeVariables triggers an internal error
GHC
ghc-devs at haskell.org
Fri Dec 5 20:04:31 UTC 2014
#9867: PatternSynonyms + ScopedTypeVariables triggers an internal error
-------------------------------------+-------------------------------------
Reporter: antalsz | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.3
Keywords: | Operating System:
Architecture: Unknown/Multiple | Unknown/Multiple
Difficulty: Unknown | Type of failure:
Blocked By: | None/Unknown
Related Tickets: | Test Case:
| Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
When trying to give a type signature with a free type variable to a
pattern in a pattern synonym, GHC dies with an internal error. Given the
file
{{{#!hs
{-# LANGUAGE PatternSynonyms, ScopedTypeVariables #-}
pattern Nil = [] :: [a]
}}}
the resulting error is
{{{
Example.hs:2:22: GHC internal error: ‘a’ is not in scope during type
checking, but it passed the renamer …
tcl_env of environment: []
In an expression type signature: [a]
In the expression: [] :: [a]
In an equation for ‘$WNil’: $WNil = [] :: [a]
Compilation failed.
}}}
The fix is to add `RankNTypes` and an explicit `forall`:
{{{#!hs
{-# LANGUAGE PatternSynonyms, ScopedTypeVariables, RankNTypes #-}
pattern Nil = [] :: forall a. [a]
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9867>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list