aboutsummaryrefslogtreecommitdiff
path: root/html-test/src/Operators.hs
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2014-03-08 09:42:00 +0100
committerNiklas Haas <git@nand.wakku.to>2014-03-08 09:43:26 +0100
commit17970e6b6aa22962c498ce02ead8dbadad31a733 (patch)
tree0c9232390bce92d8b393214a2d2131a17bc3f07e /html-test/src/Operators.hs
parente5bd27b5edf533054513871dc475a54a8b1bee23 (diff)
Render fixity information
Affects functions, type synonyms, type families, class names, data type names, constructors, data families, associated TFs/DFs, type synonyms, pattern synonyms and everything else I could think of.
Diffstat (limited to 'html-test/src/Operators.hs')
-rw-r--r--html-test/src/Operators.hs56
1 files changed, 56 insertions, 0 deletions
diff --git a/html-test/src/Operators.hs b/html-test/src/Operators.hs
new file mode 100644
index 00000000..a2e30c18
--- /dev/null
+++ b/html-test/src/Operators.hs
@@ -0,0 +1,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 >-<