1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE PatternSynonyms, TypeOperators, TypeFamilies, MultiParamTypeClasses, GADTs #-}
{-# LANGUAGE FunctionalDependencies #-}
-- | Test operators with or without fixity declarations
module Operators where
-- | Operator with no fixity
(+-) :: a -> a -> a
a +- _ = a
-- | Operator with infixr 7
(*/) :: a -> a -> a
_ */ b = b
infixr 7 */
-- | Named function with infixl 3
foo :: a -> a -> a
foo a _ = a
infixl 3 `foo`
-- | Data type with operator constructors
data Foo
= Foo `Bar` Foo -- ^ Has infixl 3
| Foo :- Foo -- ^ Has infixr 5
infixr 5 :-
infixl 3 `Bar`
-- | Pattern synonym, infixr 3
pattern (:+) a b <- [a,b]
infixr 3 :+
-- | Type name, infixl 6 and GADT constructor
data (a <-> b) where
(:<->) :: a -> b -> a <-> b
infixl 6 <->
infixr 6 :<->
-- | Type family with fixity
type family a ++ b
infix 3 ++
-- | Data family with fixity
data family a ** b
infix 9 **
-- | Class with fixity, including associated types
class a ><> b | a -> b where
-- Dec 2015: Added @a -> b@ functional dependency to clean up ambiguity
-- See GHC #11264
type a <>< b :: *
data a ><< b
(>><), (<<>) :: a -> b -> ()
-- | Multiple fixities
(**>), (**<), (>**), (<**) :: a -> a -> ()
infixr 1 ><>
infixl 2 <><
infixl 3 ><<
infixr 4 >><
infixl 5 <<>
infixr 8 **>, >**
infixl 8 **<, <**
-- | Type synonym with fixity
type (a >-< b) = a <-> b
infixl 6 >-<
|