Skip to content

Pragmas after a module declaration are ignored without warning.

Normally pragmas are placed above the module declaration like so:

{-# LANGUAGE OverloadedStrings #-}

module Main where

However if the above 2 lines are flipped around like this:

module Main where

{-# LANGUAGE OverloadedStrings #-}

Then the behaviour seen by a user is that equivalent to the pragma not being present, because it would appear GHC ignores the multi-line comment it looks like.

For a novice (I'm not one but it just tripped me up) this would be incredibly baffling (it was for me), it would be nice to see a warning for this at the least.

Trac metadata
Trac field Value
Version 7.10.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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