Skip to content

MultiWayIf makes it easy to write partial programs that are not catched by -Wall

The following partial function will pass -Wall

-- program 1
{-# LANGUAGE MultiWayIf #-}
foo :: Bool -> Int
foo b = if | b -> 23

While the following two alternatives will not:

-- program 2
foo :: Bool -> Int 
foo b | b = 23
-- 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
Trac metadata
Trac field Value
Version 8.2.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