Skip to content

bang patterns with infix ops

    $ ghci -fbang-patterns

-- Ok

    Prelude> let at a !b = False in at 1 2
    False

    Prelude> let (.!.) a !b = False in 1 .!. 2
    False

-- ~ patterns are ok

    Prelude> let a `at` ~b = False in at 1 2
    False

    Prelude> let a .!. ~b = False in 1 .!. 2
    False

    Prelude> let ~a .!. b = False in 1 .!. 2
    False

-- Parse error if we combine bang patterns with infix decls:

    Prelude> let a .!. !b = False in 1 .!. 2
    <interactive>:1:10: parse error on input `!'

    Prelude> let a `at` !b = False in at 1 2
    <interactive>:1:11: parse error on input `!'

    Prelude> let !a .!. b = False in 1 .!. 2
    <interactive>:1:5: Parse error in pattern

So looks like ops and infix declarations are missing a case for bang patterns.

-- Don

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
Edited by benl
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information