Opened 2 years ago

Closed 2 years ago

#10855 closed bug (fixed)

GHC rejects code that Haskell 2010 report accepts

Reported by: goldfire Owned by:
Priority: normal Milestone: 7.10.3
Component: Compiler (Parser) Version: 7.10.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Documentation bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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.

Change History (4)

comment:1 Changed 2 years ago by thomie

Component: CompilerCompiler (Parser)
Type of failure: None/UnknownDocumentation bug

comment:2 Changed 2 years ago by Richard Eisenberg <eir@…>

In 27f9186d/ghc:

Clarify parsing infelicity.

This fixes #10855.

comment:3 Changed 2 years ago by goldfire

Milestone: 7.10.3
Status: newmerge

May as well merge this one.

comment:4 Changed 2 years ago by bgamari

Resolution: fixed
Status: mergeclosed

Merged to ghc-7.10.

Note: See TracTickets for help on using tickets.