blob: a2e30c1890a678b26eb31fc4b63da94fbc791df9 (
plain) (
blame)
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
|
{-# LANGUAGE PatternSynonyms, TypeOperators, TypeFamilies, MultiParamTypeClasses, GADTs #-}
-- | 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 where
type a <>< b :: *
data a ><< b
(>><) :: a -> b -> ()
infixr 1 ><>
infixl 2 <><
infixl 3 ><<
infixr 4 >><
-- | Type synonym with fixity
type (a >-< b) = a <-> b
infixl 6 >-<
|