[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 <ben@…>): In [changeset:"3c4537ea1c940966eddcb9cb418bf8e39b8f0f1c/ghc" 3c4537ea/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="3c4537ea1c940966eddcb9cb418bf8e39b8f0f1c" Fix pretty-printing of zero-argument lambda expressions Using Template Haskell, one can construct lambda expressions with no arguments. The pretty-printer isn't aware of this fact, however. This changes that. Test Plan: make test TEST=T13856 Reviewers: bgamari, austin, goldfire Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13856 Differential Revision: https://phabricator.haskell.org/D3664 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13856#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC