From 17970e6b6aa22962c498ce02ead8dbadad31a733 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 8 Mar 2014 09:42:00 +0100 Subject: 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. --- html-test/ref/Bug8.html | 6 +- html-test/ref/Operators.html | 379 +++++++++++++++++++++++++++++++++++++++++++ html-test/src/Operators.hs | 56 +++++++ 3 files changed, 439 insertions(+), 2 deletions(-) create mode 100644 html-test/ref/Operators.html create mode 100644 html-test/src/Operators.hs (limited to 'html-test') diff --git a/html-test/ref/Bug8.html b/html-test/ref/Bug8.html index f3845cb2..7e5b5fee 100644 --- a/html-test/ref/Bug8.html +++ b/html-test/ref/Bug8.html @@ -84,7 +84,8 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; >

infix 9 -->
(-->) :: t -> t1 -> Typ

infix 9 --->
(--->) :: [a] -> Typ +Operators

Safe HaskellSafe-Inferred

Operators

Description

Test operators with or without fixity declarations

Synopsis

Documentation

(+-) :: a -> a -> a

Operator with no fixity

infixr 7 */
(*/) :: a -> a -> a

Operator with infixr 7

infixl 3 `foo`
foo :: a -> a -> a

Named function with infixl 3

data Foo

Data type with operator constructors

Constructors

infixl 3 `Bar`
Foo `Bar` Foo

Has infixl 3

infixr 5 :-
Foo :- Foo

Has infixr 5

infixr 3 :+
pattern (:+) t t :: [t]

Pattern synonym, infixr 3

infixl 6 <->
data a <-> b where

Type name, infixl 6 and GADT constructor

Constructors

infixr 6 :<->
(:<->) :: a -> b -> a <-> b
 

infix 3 ++
type family a ++ b

Type family with fixity

infix 9 **
data family a ** b

Data family with fixity

infixr 1 ><>
class a ><> b where

Class with fixity, including associated types

Associated Types

infixl 2 <><
type a <>< b :: *

infixl 3 ><<
data a ><< b

Methods

infixr 4 >><
(>><) :: a -> b -> ()

infixl 6 >-<
type (>-<) a b = a <-> b

Type synonym with fixity

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 >-< -- cgit v1.2.3