[GHC] #13856: "Zero-argument" lambda expressions from pretty-print strangely

#13856: "Zero-argument" lambda expressions from pretty-print strangely -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 8.0.1 Haskell | 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: -------------------------------------+------------------------------------- An amusing corner case of the language is that you can constructor lambdas with zero arguments using Template Haskell: {{{#!hs {-# LANGUAGE TemplateHaskell #-} import Language.Haskell.TH f :: Int f = $(lamE [] [| 42 |]) }}} But if you try to compile that with `-ddump-splices` on, it'll look quite funny: {{{ $ /opt/ghc/8.2.1/bin/ghci Bug.hs -ddump-splices GHCi, version 8.2.0.20170616: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Main ( Bug.hs, interpreted ) Bug.hs:6:7-22: Splicing expression lamE [] [| 42 |] ======> \ -> 42 Ok, modules loaded: Main. }}} Oh dear, `\ -> 42` isn't a valid expression at all. The same thing happens with the Template Haskell pretty-printer: {{{ λ> import Language.Haskell.TH λ> :set -XTemplateHaskell λ> putStrLn $(lamE [] [| 42 |] >>= stringE . pprint) <interactive>:4:12-48: Splicing expression lamE [] [| 42 |] >>= stringE . pprint ======> "\ -> 42" \ -> 42 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13856 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13856: "Zero-argument" lambda expressions from pretty-print strangely -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3664 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D3664 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13856#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13856: "Zero-argument" lambda expressions from pretty-print strangely -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Template Haskell | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3664 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13856#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13856: "Zero-argument" lambda expressions from pretty-print strangely
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: closed
Priority: normal | Milestone: 8.4.1
Component: Template Haskell | Version: 8.0.1
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3664
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
participants (1)
-
GHC