Skip to content

-ddump-splices pretty-prints LambdaCase nonsensically

{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where

$([d| f :: Bool -> ()
      f = \case True  -> ()
                False -> ()
    |])
$ /opt/ghc/8.4.3/bin/ghci Bug.hs
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/ryanglscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Bug.hs:(6,3)-(9,6): Splicing declarations
    [d| f_a1xr :: Bool -> ()
        f_a1xr
          = \case
              True -> ()
              False -> () |]
  ======>
    f_a48E :: Bool -> ()
    f_a48E
      = \case
          \ True -> GHC.Tuple.()
          \ False -> GHC.Tuple.()
Ok, one module loaded.

Notice the use of \ True and \ False. Those patterns should not be preceded with backslashes.

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
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