summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_compile/proposal-229e.hs
blob: d7fc35d38e80b7813d9a881792ca9d21154e68a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# LANGUAGE BangPatterns #-}

module Proposal229e ((!), f) where

(!) :: Maybe a -> a -> (a, a)
f :: a -> a

-- the preceding '}' is not from a comment,
-- so (!) is tight infix (therefore an operator)
Nothing{}!x = (x, x)

-- the following '{' opens a multi-line comment,
-- so (!) is loose infix (therefore an operator)
Just a !{-comment-}x = (a, x)

-- the preceding '}' is closing a multi-line comment,
-- so (!) is prefix (therefore a bang pattern)
f{-comment-}!x = x