User Tools

Site Tools


modules:prelude:basictypeclasses

Basic type classes

Eq

  • source: class Eq a
  • main functions
    • (==) :: a -> a -> Bool infix 4, true if equal otherwise false
    • (/=) :: a -> a -> Bool infix 4, false if equal otherwise true
  • Minimal complete definition: either == or /=.

Ord

  • main functions
    • compare :: a -> a -> Ordering
      • LT if first parameter is less then second parameter,
      • EQ if first parameter is equal second parameter, and
      • GT if first parameter is greater then second parameter
    • (<) :: a -> a -> Bool infix 4, true if first parameter is less than second parameter otherwise false
    • (<=) :: a -> a -> Bool infix 4, true if first parameter is equal or less than second parameter otherwise false
    • (>) :: a -> a -> Bool infix 4, true if first parameter is greater than second parameter otherwise false
    • (>=) :: a -> a -> Bool infix 4, true if first parameter is equal or greater than second parameter otherwise false
    • max :: a -> a -> a the greater or equal value of both parameters
    • min :: a -> a -> a the smaller or equal value of both parameters
  • Minimal complete definition: either compare or <=. Using compare can be more efficient for complex types.

Enum

  • main functions
    • succ :: a -> a
    • pred :: a -> a
    • toEnum :: Int -> a
    • fromEnum :: a -> Int
    • enumFrom :: a -> [a]
    • enumFromThen :: a -> a -> [a]
    • enumFromTo :: a -> a -> [a]
    • enumFromThenTo :: a -> a -> a -> [a]

Bounded

Num

Real

Integral

Fractional

RealFrac

Semigroup

Monoid

Functor

Applicative

Monad

MonadFail

Foldable

Traversable

Show

Read

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
modules/prelude/basictypeclasses.txt · Last modified: by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki