Skip to content

GHC parses undocumented syntax in OPTIONS_GHC

GHC accepts

{-# OPTIONS_GHC ["-XTemplateHaskell"] #-}

module Bug where

$(return [])

Note the odd syntax in the OPTIONS_GHC pragma: if the first non-whitespace character in the pragma is a [, then GHC tries to read a list of Haskell strings. Bizarre.

Either this feature is useful, in which case it should be documented; or it's not, in which case it should be removed.

The offending code is in GHC.Utils.Misc.toArgs (which is a strange place to find it).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information