[GHC] #10708: Rejection of constant functions defined using conditional pattern matching
GHC
ghc-devs at haskell.org
Wed Jul 29 15:06:43 UTC 2015
#10708: Rejection of constant functions defined using conditional pattern matching
-------------------------------------+-------------------------------------
Reporter: | Owner:
HubertGaravel |
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.1
Keywords: | Operating System: Linux
Architecture: x86 | Type of failure: GHC rejects
| valid program
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: |
-------------------------------------+-------------------------------------
Hi,
The Haskell program below is rejected, although it is correct. GHC gives
the
following error message:
{{{
HASKELL/tricky.hs:12:1:
Multiple declarations of `Main.d3'
Declared at: HASKELL/tricky.hs:10:1
HASKELL/tricky.hs:11:1
HASKELL/tricky.hs:12:1
}}}
I agree that the definition of d3 is tricky and useless, but it seems
to be valid. This example was exctracted from Haskell code automatically
produced by an in-house code generator.
{{{#!hs
data Nat = D0 | Succ Nat
deriving (Show, Eq, Ord)
d1 :: Nat
d2 :: Nat
d3 :: Nat
d1 = (Succ D0)
d2 | D0 == D0 = D0
d3 | D0 /= D0 = D0
d3 | (Succ D0) == D0 = D0
d3 | (Succ D0) /= D0 = (Succ D0)
main = do
print d1
print d2
print d3
}}}
Best regards
Hubert
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10708>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list