Comments
operator | description | signature |
---|---|---|
-- | start of comment for remainder of line | |
{- ... -} | comment |
Mathematical Operators
operator | description | signature |
---|---|---|
+ | add | class (Eq a, Show a) => Num a where (+) :: a -> a -> a ... -- Defined in GHC.Num |
- | subtract infix minus - prefix |
class (Eq a, Show a) => Num a where ... (-) :: a -> a -> a ... -- Defined in GHC.Num infixl 6 - |
* | multiply | class (Eq a, Show a) => Num a where ... (*) :: a -> a -> a ... -- Defined in GHC.Num infixl 7 * |
/ | divide | class (Num a) => Fractional a where (/) :: a -> a -> a ... -- Defined in GHC.Real infixl 7 / |
^ | raise to power | (^) :: (Num a, Integral b) => a -> b -> a -- Defined in GHC.Real infixr 8 ^ |
** | raise to power | class (Eq a, Show a) => Num a where ... (*) :: a -> a -> a ... -- Defined in GHC.Num |
&& | boolean and | (&&) :: Bool -> Bool -> Bool -- Defined in GHC.Classes infixr 3 && |
|| | boolean or | (||) :: Bool -> Bool -> Bool -- Defined in GHC.Classes infixr 2 || |
not | boolean not | not :: Bool -> Bool -- Defined in GHC.Classes |
Mathematical Comparison Operators
operator | description | signature |
---|---|---|
== | equal | class Eq a where (==) :: a -> a -> Bool ... -- Defined in GHC.Classes infix 4 == |
/= | not equal | class Eq a where ... (/=) :: a -> a -> Bool -- Defined in GHC.Classes infix 4 /= |
< | less than | class (Eq a) => Ord a where ... (<) :: a -> a -> Bool ... -- Defined in GHC.Classes infix 4 < |
<= | less than or equal | class (Eq a) => Ord a where ... (<=) :: a -> a -> Bool ... -- Defined in GHC.Classes infix 4 <= |
> | greater than | class (Eq a) => Ord a where ... (>) :: a -> a -> Bool ... -- Defined in GHC.Classes infix 4 > |
>= | greater than or equal | class (Eq a) => Ord a where ... (>=) :: a -> a -> Bool ... -- Defined in GHC.Classes infix 4 >= |
Function Operators
operator | description | signature |
---|---|---|
\ | lambda | |
. | function composition name qualifier |
(.) :: (b -> c) -> (a -> b) -> a -> c -- Defined in GHC.Base infixr 9 . |
| | guard and case specifier seperator in list comprehension alternative in data definition (enum type) |
List Operators
operator | description | signature |
---|---|---|
[ ... , ...] | list constructor | data [] a = [] | a : [a] -- Defined in GHC.Types instance (Eq a) => Eq [a] -- Defined in GHC.Base instance Monad [] -- Defined in GHC.Base instance Functor [] -- Defined in GHC.Base instance (Ord a) => Ord [a] -- Defined in GHC.Base instance (Read a) => Read [a] -- Defined in GHC.Read instance (Show a) => Show [a] -- Defined in GHC.Show |
++ | list concatenation | (++) :: [a] -> [a] -> [a] -- Defined in GHC.Base |
: | cons - append head operator | |
!! | indexing | (!!) :: [a] -> Int -> a -- Defined in GHC.List |
.. | range specifier for lists | |
\\ | list diference | |
<- | list comprehention single assignment in do |
Monad Operators
operator | description | signature |
---|---|---|
: | definition seperator | |
-> | function type | |
= | type or value-naming | |
:: | has type | |
=> | context inheritance from class | |
() | empty value in IO type | data () = () -- Defined in GHC.Unit instance Bounded () -- Defined in GHC.Enum instance Enum () -- Defined in GHC.Enum instance Eq () -- Defined in Data.Tuple instance Ord () -- Defined in Data.Tuple instance Read () -- Defined in GHC.Read instance Show () -- Defined in GHC.Show |
>> | monad join without value | class Monad m where ... (>>) :: m a -> m b -> m b ... -- Defined in GHC.Base infixl 1 >> |
>>= | monad join | class Monad m where (>>=) :: m a -> (a -> m b) -> m b ... -- Defined in GHC.Base infixl 1 >>= |
>@> | object composition | |
(..) | constructor for export |
Constructors
operator | description | signature |
---|---|---|
[ ... , ...] | list constructor | data [] a = [] | a : [a] -- Defined in GHC.Types instance (Eq a) => Eq [a] -- Defined in GHC.Base instance Monad [] -- Defined in GHC.Base instance Functor [] -- Defined in GHC.Base instance (Ord a) => Ord [a] -- Defined in GHC.Base instance (Read a) => Read [a] -- Defined in GHC.Read instance (Show a) => Show [a] -- Defined in GHC.Show |
( ... , ...) | tuple constructor | data () = () -- Defined in GHC.Unit instance Bounded () -- Defined in GHC.Enum instance Enum () -- Defined in GHC.Enum instance Eq () -- Defined in Data.Tuple instance Ord () -- Defined in Data.Tuple instance Read () -- Defined in GHC.Read instance Show () -- Defined in GHC.Show |
' ' | prefix to infix constructor | |
` ` | literal char constructor | |
" " | String constructor |
Pattern Operators
operator | description | signature |
---|---|---|
_ | wildcard | |
~ | irrefutable | |
! | strictness flag - force evaluation | |
@ | read as |