Skip to content

Sectioned hole oddities

#13050 (closed) 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:

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:

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
  |           ^
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