Skip to content

Wrong pragma parsing

If I write the following code with pragma LANGUAGE and extension concatenated, ghci complains about unrecognized pragma but loads module.

{-# LANGUAGEExistentialQuantification #-}
module TestHS where

data ShowBox = forall s.Show s => SB s
instance Show ShowBox where
  show (SB s) = show s

list :: [ShowBox]
list = [SB "sdf", SB 4, SB True, SB (Nothing::Maybe())]

If pragma is not recognized, the extension ExistentialQuantification should not be loaded and so file should not compile. Another strange thing is that when I :reload file in ghci it does not complain about pragma anymore. It is needed to close ghci and open it once again to see error about not recognized pragma.

Also I think that if pragma concatenated with following information is legal it will give ambiguity for cases like adding pragma SPECIAL with existing pragma SPECIALIZE.

Trac metadata
Trac field Value
Version 6.10.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information