[GHC] #14590: Sectioned hole oddities

GHC ghc-devs at haskell.org
Sat Dec 16 22:03:44 UTC 2017


#14590: Sectioned hole oddities
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             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:  #13050
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 #13050 added support for infix holes. However, it seems that the same
 support was not added for //sectioned// holes, as the following two
 examples demonstrate:

 Left-sectioned holes technically work, although they are pretty-printed
 poorly:

 {{{#!hs
 f :: Int -> Int -> Int
 f x y = (x `_`) y
 }}}

 {{{
 GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:2:12: error:
     • Found hole: _ :: Int -> Int -> Int
     • In the expression: _
       In the expression:  \ x_ -> _ x x_ )
       In the expression: ( \ x_ -> _ x x_ )) y
     • Relevant bindings include
         y :: Int (bound at Bug.hs:2:5)
         x :: Int (bound at Bug.hs:2:3)
         f :: Int -> Int -> Int (bound at Bug.hs:2:1)
   |
 2 | f x y = (x `_`) y
   |            ^^^
 }}}

 Notice the messy `In the expression:  \ x_ -> _ x x_ )` part.

 Right-sectioned holes don't even parse at all:

 {{{#!hs
 f :: Int -> Int -> Int
 f x y = (`_` x) y
 }}}
 {{{
 GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:2:11: error: parse error on input ‘_’
   |
 2 | f x y = (`_` x) y
   |           ^
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14590>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list