Skip to content

GHC rejects code that Haskell 2010 report accepts

According to The Haskell 2010 Report, the following two modules should compile. But they don't, failing with parse errors:

{-# LANGUAGE Haskell2010 #-}

module Bug where

bool = - case b of False -> 0; True -> (-1)
{-# LANGUAGE Haskell2010 #-}

instance Num (IO a) where
  negate = id

main = - do putStrLn "hi!"

Note the unary - signs.

I'm not sure whether we should complicate the parser to fix these, but we should document the compliance-failure in the manual.

Trac metadata
Trac field Value
Version 7.10.2
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