[GHC] #14773: MultiWayIf makes it easy to write partial programs that are not catched by -Wall
GHC
ghc-devs at haskell.org
Wed Feb 7 07:47:28 UTC 2018
#14773: MultiWayIf makes it easy to write partial programs that are not catched by
-Wall
-------------------------------------+-------------------------------------
Reporter: SimonHengel | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The following partial function will pass {{{-Wall}}}
{{{#!haskell
-- program 1
{-# LANGUAGE MultiWayIf #-}
foo :: Bool -> Int
foo b = if | b -> 23
}}}
While the following two alternatives will not:
{{{#!haskell
-- program 2
foo :: Bool -> Int
foo b | b = 23
}}}
{{{#!haskell
-- program 3
foo :: Bool -> Int
foo b = case () of
() | b -> 23
}}}
Note that the GHC User's Guide states that "program 1" and "program 3" are
equivalent.
1. Is this a bug or by design?
2. I guess at the very least we would want to update the User's Guide
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14773>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list