Copyright | (c) NoviSci Inc 2020 |
---|---|
License | BSD3 |
Maintainer | bsaul@novisci.com |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- data Integer
- class Generic a
- class Show a where
- class Functor (f :: Type -> Type) where
- fmap :: (a -> b) -> f a -> f b
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- otherwise :: Bool
- data Bool
- bool :: a -> a -> Bool -> a
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- data Either a b
- class Eq a where
- data Int
- data Maybe a
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- catMaybes :: [Maybe a] -> [a]
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- fromMaybe :: a -> Maybe a -> a
- fromJust :: HasCallStack => Maybe a -> a
- isNothing :: Maybe a -> Bool
- isJust :: Maybe a -> Bool
- maybe :: b -> (a -> b) -> Maybe a -> b
- ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- (.) :: (b -> c) -> (a -> b) -> a -> c
- const :: a -> b -> a
- id :: a -> a
- fmap :: Functor f => (a -> b) -> f a -> f b
- (++) :: [a] -> [a] -> [a]
- map :: (a -> b) -> [a] -> [b]
- length :: Foldable t => t a -> Int
- null :: Foldable t => t a -> Bool
- all :: Foldable t => (a -> Bool) -> t a -> Bool
- any :: Foldable t => (a -> Bool) -> t a -> Bool
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- class Eq a => Ord a where
- data Day
- fromGregorian :: Year -> MonthOfYear -> DayOfMonth -> Day
- type Year = Integer
- type MonthOfYear = Int
- diffDays :: Day -> Day -> Integer
- data Text
- pack :: String -> Text
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- uncurry :: (a -> b -> c) -> (a, b) -> c
- curry :: ((a, b) -> c) -> a -> b -> c
- lastMay :: [a] -> Maybe a
- headMay :: [a] -> Maybe a
- (<!) :: (a -> b) -> a -> b
- (!>) :: a -> (a -> b) -> b
- (<.) :: (b -> c) -> (a -> b) -> a -> c
- (.>) :: (a -> b) -> (b -> c) -> a -> c
- (<|) :: (a -> b) -> a -> b
- (|>) :: a -> (a -> b) -> b
- class Functor f => Filterable (f :: Type -> Type) where
Re-exports
Arbitrary precision integers. In contrast with fixed-size integral types
such as Int
, the Integer
type represents the entire infinite range of
integers.
For more information about this type's representation, see the comments in its implementation.
Instances
Enum Integer | Since: base-2.1 |
Eq Integer | |
Integral Integer | Since: base-2.0.1 |
Defined in GHC.Real | |
Num Integer | Since: base-2.1 |
Ord Integer | |
Read Integer | Since: base-2.1 |
Real Integer | Since: base-2.0.1 |
Defined in GHC.Real toRational :: Integer -> Rational # | |
Show Integer | Since: base-2.1 |
Arbitrary Integer | |
CoArbitrary Integer | |
Defined in Test.QuickCheck.Arbitrary coarbitrary :: Integer -> Gen b -> Gen b # | |
Hashable Integer | |
Defined in Data.Hashable.Class | |
UniformRange Integer | |
Defined in System.Random.Internal | |
ToJSON Integer | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Integer | |
Defined in Data.Aeson.Types.ToJSON | |
FromJSON Integer | This instance includes a bounds check to prevent maliciously
large inputs to fill up the memory of the target system. You can
newtype |
FromJSONKey Integer | |
Lift Integer | |
IntervalSizeable Integer Integer | |
IntervalSizeable Day Integer | |
Representable types of kind *
.
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic
instance must satisfy the following laws:
from
.to
≡id
to
.from
≡id
Instances
Conversion of values to readable String
s.
Derived instances of Show
have the following properties, which
are compatible with derived instances of Read
:
- The result of
show
is a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. - If the constructor is defined to be an infix operator, then
showsPrec
will produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
x
is less thand
(associativity is ignored). Thus, ifd
is0
then the result is never surrounded in parentheses; ifd
is11
it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
show
will produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Show
is equivalent to
instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) $ showString "Leaf " . showsPrec (app_prec+1) m where app_prec = 10 showsPrec d (u :^: v) = showParen (d > up_prec) $ showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v where up_prec = 5
Note that right-associativity of :^:
is ignored. For example,
produces the stringshow
(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"
.
:: Int | the operator precedence of the enclosing
context (a number from |
-> a | the value to be converted to a |
-> ShowS |
Convert a value to a readable String
.
showsPrec
should satisfy the law
showsPrec d x r ++ s == showsPrec d x (r ++ s)
Derived instances of Read
and Show
satisfy the following:
That is, readsPrec
parses the string produced by
showsPrec
, and delivers the value that showsPrec
started with.
Instances
class Functor (f :: Type -> Type) where #
A type f
is a Functor if it provides a function fmap
which, given any types a
and b
lets you apply any function from (a -> b)
to turn an f a
into an f b
, preserving the
structure of f
. Furthermore f
needs to adhere to the following:
Note, that the second law follows from the free theorem of the type fmap
and
the first law, so you need only check that the former condition holds.
fmap :: (a -> b) -> f a -> f b #
Using ApplicativeDo
: '
' can be understood as
the fmap
f asdo
expression
do a <- as pure (f a)
with an inferred Functor
constraint.
Instances
Functor [] | Since: base-2.1 |
Functor Maybe | Since: base-2.1 |
Functor IO | Since: base-2.1 |
Functor Par1 | Since: base-4.9.0.0 |
Functor Q | |
Functor Gen | |
Functor Complex | Since: base-4.9.0.0 |
Functor Min | Since: base-4.9.0.0 |
Functor Max | Since: base-4.9.0.0 |
Functor First | Since: base-4.9.0.0 |
Functor Last | Since: base-4.9.0.0 |
Functor Option | Since: base-4.9.0.0 |
Functor ZipList | Since: base-2.1 |
Functor Identity | Since: base-4.8.0.0 |
Functor Handler | Since: base-4.6.0.0 |
Functor First | Since: base-4.8.0.0 |
Functor Last | Since: base-4.8.0.0 |
Functor Dual | Since: base-4.8.0.0 |
Functor Sum | Since: base-4.8.0.0 |
Functor Product | Since: base-4.8.0.0 |
Functor Down | Since: base-4.11.0.0 |
Functor ReadPrec | Since: base-2.1 |
Functor ReadP | Since: base-2.1 |
Functor NonEmpty | Since: base-4.9.0.0 |
Functor IntMap | |
Functor Tree | |
Functor Seq | |
Functor FingerTree | |
Defined in Data.Sequence.Internal fmap :: (a -> b) -> FingerTree a -> FingerTree b # (<$) :: a -> FingerTree b -> FingerTree a # | |
Functor Digit | |
Functor Node | |
Functor Elem | |
Functor ViewL | |
Functor ViewR | |
Functor DNonEmpty | |
Functor DList | |
Functor Interval | |
Functor Doc | |
Functor AnnotDetails | |
Defined in Text.PrettyPrint.Annotated.HughesPJ fmap :: (a -> b) -> AnnotDetails a -> AnnotDetails b # (<$) :: a -> AnnotDetails b -> AnnotDetails a # | |
Functor Span | |
Functor SmallArray | |
Defined in Data.Primitive.SmallArray fmap :: (a -> b) -> SmallArray a -> SmallArray b # (<$) :: a -> SmallArray b -> SmallArray a # | |
Functor Array | |
Functor FromJSONKeyFunction | Only law abiding up to interpretation |
Defined in Data.Aeson.Types.FromJSON fmap :: (a -> b) -> FromJSONKeyFunction a -> FromJSONKeyFunction b # (<$) :: a -> FromJSONKeyFunction b -> FromJSONKeyFunction a # | |
Functor IResult | |
Functor Result | |
Functor Parser | |
Functor Maybe | |
Functor Vector | |
Functor Id | |
Functor Box | |
Functor P | Since: base-4.8.0.0 |
Defined in Text.ParserCombinators.ReadP | |
Functor BoolPair | |
Defined in Witherable | |
Functor FeatureData Source # | |
Defined in Hasklepias.Types.Feature fmap :: (a -> b) -> FeatureData a -> FeatureData b # (<$) :: a -> FeatureData b -> FeatureData a # | |
Functor (Either a) | Since: base-3.0 |
Functor (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor ((,) a) | Since: base-2.1 |
Functor (Arg a) | Since: base-4.9.0.0 |
Monad m => Functor (WrappedMonad m) | Since: base-2.1 |
Defined in Control.Applicative fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b # (<$) :: a -> WrappedMonad m b -> WrappedMonad m a # | |
Arrow a => Functor (ArrowMonad a) | Since: base-4.6.0.0 |
Defined in Control.Arrow fmap :: (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b # (<$) :: a0 -> ArrowMonad a b -> ArrowMonad a a0 # | |
Functor (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Functor (Map k) | |
Functor (HashMap k) | |
Functor (Tagged2 s) | |
Defined in Data.Aeson.Types.Generic | |
Functor (Pair e) | |
Functor (These a) | |
Functor (Either a) | |
Functor (These a) | |
Functor (IResult i) | |
Functor (Parser i) | |
Functor f => Functor (WrappedFoldable f) | |
Defined in Witherable fmap :: (a -> b) -> WrappedFoldable f a -> WrappedFoldable f b # (<$) :: a -> WrappedFoldable f b -> WrappedFoldable f a # | |
Functor f => Functor (Rec1 f) | Since: base-4.9.0.0 |
Functor (URec Char :: Type -> Type) | Since: base-4.9.0.0 |
Functor (URec Double :: Type -> Type) | Since: base-4.9.0.0 |
Functor (URec Float :: Type -> Type) | Since: base-4.9.0.0 |
Functor (URec Int :: Type -> Type) | Since: base-4.9.0.0 |
Functor (URec Word :: Type -> Type) | Since: base-4.9.0.0 |
Functor (URec (Ptr ()) :: Type -> Type) | Since: base-4.9.0.0 |
Functor ((,,) a b) | Since: base-4.14.0.0 |
Arrow a => Functor (WrappedArrow a b) | Since: base-2.1 |
Defined in Control.Applicative fmap :: (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # (<$) :: a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |
Functor m => Functor (Kleisli m a) | Since: base-4.14.0.0 |
Functor (Const m :: Type -> Type) | Since: base-2.1 |
Functor f => Functor (Ap f) | Since: base-4.12.0.0 |
Functor f => Functor (Alt f) | Since: base-4.8.0.0 |
(Applicative f, Monad f) => Functor (WhenMissing f x) | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal fmap :: (a -> b) -> WhenMissing f x a -> WhenMissing f x b # (<$) :: a -> WhenMissing f x b -> WhenMissing f x a # | |
Functor m => Functor (ErrorT e m) | |
Functor (Tagged s) | |
(Functor f, Functor g) => Functor (These1 f g) | |
Monad m => Functor (Bundle m v) | |
Functor ((->) r :: Type -> Type) | Since: base-2.1 |
Functor (K1 i c :: Type -> Type) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :+: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :*: g) | Since: base-4.9.0.0 |
Functor ((,,,) a b c) | Since: base-4.14.0.0 |
(Functor f, Functor g) => Functor (Product f g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (Sum f g) | Since: base-4.9.0.0 |
Functor f => Functor (WhenMatched f x y) | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal fmap :: (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b # (<$) :: a -> WhenMatched f x y b -> WhenMatched f x y a # | |
(Applicative f, Monad f) => Functor (WhenMissing f k x) | Since: containers-0.5.9 |
Defined in Data.Map.Internal fmap :: (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b # (<$) :: a -> WhenMissing f k x b -> WhenMissing f k x a # | |
Functor f => Functor (M1 i c f) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :.: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (Compose f g) | Since: base-4.9.0.0 |
Bifunctor p => Functor (Flip p a) | |
Functor f => Functor (WhenMatched f k x y) | Since: containers-0.5.9 |
Defined in Data.Map.Internal fmap :: (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b # (<$) :: a -> WhenMatched f k x y b -> WhenMatched f k x y a # | |
(Functor f, Bifunctor p) => Functor (Tannen f p a) | |
(Bifunctor p, Functor g) => Functor (Biff p f g a) | |
(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 #
Same as >>=
, but with the arguments interchanged.
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #
An infix synonym for fmap
.
The name of this operator is an allusion to $
.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $
is function application, <$>
is function
application lifted over a Functor
.
Examples
Convert from a
to a Maybe
Int
using Maybe
String
show
:
>>>
show <$> Nothing
Nothing>>>
show <$> Just 3
Just "3"
Convert from an
to an
Either
Int
Int
Either
Int
String
using show
:
>>>
show <$> Left 17
Left 17>>>
show <$> Right 17
Right "17"
Double each element of a list:
>>>
(*2) <$> [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
even <$> (2,2)
(2,True)
Instances
Case analysis for the Bool
type.
evaluates to bool
x y px
when p
is False
, and evaluates to y
when p
is True
.
This is equivalent to if p then y else x
; that is, one can
think of it as an if-then-else construct with its arguments
reordered.
Examples
Basic usage:
>>>
bool "foo" "bar" True
"bar">>>
bool "foo" "bar" False
"foo"
Confirm that
and bool
x y pif p then y else x
are
equivalent:
>>>
let p = True; x = "bar"; y = "foo"
>>>
bool x y p == if p then y else x
True>>>
let p = False
>>>
bool x y p == if p then y else x
True
Since: base-4.7.0.0
The Either
type represents values with two possibilities: a value of
type
is either Either
a b
or Left
a
.Right
b
The Either
type is sometimes used to represent a value which is
either correct or an error; by convention, the Left
constructor is
used to hold an error value and the Right
constructor is used to
hold a correct value (mnemonic: "right" also means "correct").
Examples
The type
is the type of values which can be either
a Either
String
Int
String
or an Int
. The Left
constructor can be used only on
String
s, and the Right
constructor can be used only on Int
s:
>>>
let s = Left "foo" :: Either String Int
>>>
s
Left "foo">>>
let n = Right 3 :: Either String Int
>>>
n
Right 3>>>
:type s
s :: Either String Int>>>
:type n
n :: Either String Int
The fmap
from our Functor
instance will ignore Left
values, but
will apply the supplied function to values contained in a Right
:
>>>
let s = Left "foo" :: Either String Int
>>>
let n = Right 3 :: Either String Int
>>>
fmap (*2) s
Left "foo">>>
fmap (*2) n
Right 6
The Monad
instance for Either
allows us to chain together multiple
actions which may fail, and fail overall if any of the individual
steps failed. First we'll write a function that can either parse an
Int
from a Char
, or fail.
>>>
import Data.Char ( digitToInt, isDigit )
>>>
:{
let parseEither :: Char -> Either String Int parseEither c | isDigit c = Right (digitToInt c) | otherwise = Left "parse error">>>
:}
The following should work, since both '1'
and '2'
can be
parsed as Int
s.
>>>
:{
let parseMultiple :: Either String Int parseMultiple = do x <- parseEither '1' y <- parseEither '2' return (x + y)>>>
:}
>>>
parseMultiple
Right 3
But the following should fail overall, since the first operation where
we attempt to parse 'm'
as an Int
will fail:
>>>
:{
let parseMultiple :: Either String Int parseMultiple = do x <- parseEither 'm' y <- parseEither '2' return (x + y)>>>
:}
>>>
parseMultiple
Left "parse error"
Instances
The Eq
class defines equality (==
) and inequality (/=
).
All the basic datatypes exported by the Prelude are instances of Eq
,
and Eq
may be derived for any datatype whose constituents are also
instances of Eq
.
The Haskell Report defines no laws for Eq
. However, ==
is customarily
expected to implement an equivalence relationship where two values comparing
equal are indistinguishable by "public" functions, with a "public" function
being one not allowing to see implementation details. For example, for a
type representing non-normalised natural numbers modulo 100, a "public"
function doesn't make the difference between 1 and 201. It is expected to
have the following properties:
Instances
A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]
.
The exact range for a given implementation can be determined by using
minBound
and maxBound
from the Bounded
class.
Instances
The Maybe
type encapsulates an optional value. A value of type
either contains a value of type Maybe
aa
(represented as
),
or it is empty (represented as Just
aNothing
). Using Maybe
is a good way to
deal with errors or exceptional cases without resorting to drastic
measures such as error
.
The Maybe
type is also a monad. It is a simple kind of error
monad, where all errors are represented by Nothing
. A richer
error monad can be built using the Either
type.
Instances
Monad Maybe | Since: base-2.1 |
Functor Maybe | Since: base-2.1 |
MonadFail Maybe | Since: base-4.9.0.0 |
Defined in Control.Monad.Fail | |
Applicative Maybe | Since: base-2.1 |
Foldable Maybe | Since: base-2.1 |
Defined in Data.Foldable fold :: Monoid m => Maybe m -> m # foldMap :: Monoid m => (a -> m) -> Maybe a -> m # foldMap' :: Monoid m => (a -> m) -> Maybe a -> m # foldr :: (a -> b -> b) -> b -> Maybe a -> b # foldr' :: (a -> b -> b) -> b -> Maybe a -> b # foldl :: (b -> a -> b) -> b -> Maybe a -> b # foldl' :: (b -> a -> b) -> b -> Maybe a -> b # foldr1 :: (a -> a -> a) -> Maybe a -> a # foldl1 :: (a -> a -> a) -> Maybe a -> a # elem :: Eq a => a -> Maybe a -> Bool # maximum :: Ord a => Maybe a -> a # minimum :: Ord a => Maybe a -> a # | |
Traversable Maybe | Since: base-2.1 |
Arbitrary1 Maybe | |
Defined in Test.QuickCheck.Arbitrary liftArbitrary :: Gen a -> Gen (Maybe a) # liftShrink :: (a -> [a]) -> Maybe a -> [Maybe a] # | |
Eq1 Maybe | Since: base-4.9.0.0 |
Ord1 Maybe | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Read1 Maybe | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show1 Maybe | Since: base-4.9.0.0 |
Alternative Maybe | Since: base-2.1 |
MonadPlus Maybe | Since: base-2.1 |
Hashable1 Maybe | |
Defined in Data.Hashable.Class | |
Filterable Maybe | |
ToJSON1 Maybe | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> Maybe a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Maybe a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Maybe a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Maybe a] -> Encoding # | |
FromJSON1 Maybe | |
Witherable Maybe | |
Defined in Witherable | |
FilterableWithIndex () Maybe | |
WitherableWithIndex () Maybe | |
(Selector s, GToJSON' enc arity (K1 i (Maybe a) :: Type -> Type), KeyValuePair enc pairs, Monoid pairs) => RecordToPairs enc pairs arity (S1 s (K1 i (Maybe a) :: Type -> Type)) | |
Defined in Data.Aeson.Types.ToJSON | |
Lift a => Lift (Maybe a :: Type) | |
(Selector s, FromJSON a) => RecordFromJSON' arity (S1 s (K1 i (Maybe a) :: Type -> Type)) | |
Defined in Data.Aeson.Types.FromJSON | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Ord a => Ord (Maybe a) | Since: base-2.1 |
Read a => Read (Maybe a) | Since: base-2.1 |
Show a => Show (Maybe a) | Since: base-2.1 |
Generic (Maybe a) | Since: base-4.6.0.0 |
Semigroup a => Semigroup (Maybe a) | Since: base-4.9.0.0 |
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
Arbitrary a => Arbitrary (Maybe a) | |
CoArbitrary a => CoArbitrary (Maybe a) | |
Defined in Test.QuickCheck.Arbitrary coarbitrary :: Maybe a -> Gen b -> Gen b # | |
Hashable a => Hashable (Maybe a) | |
Defined in Data.Hashable.Class | |
ToJSON a => ToJSON (Maybe a) | |
Defined in Data.Aeson.Types.ToJSON | |
FromJSON a => FromJSON (Maybe a) | |
SingKind a => SingKind (Maybe a) | Since: base-4.9.0.0 |
Defined in GHC.Generics type DemoteRep (Maybe a) | |
Generic1 Maybe | Since: base-4.6.0.0 |
SingI ('Nothing :: Maybe a) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
SingI a2 => SingI ('Just a2 :: Maybe a1) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Rep (Maybe a) | |
Defined in GHC.Generics | |
type DemoteRep (Maybe a) | |
Defined in GHC.Generics | |
data Sing (b :: Maybe a) | |
type Rep1 Maybe | |
mapMaybe :: (a -> Maybe b) -> [a] -> [b] #
The mapMaybe
function is a version of map
which can throw
out elements. In particular, the functional argument returns
something of type
. If this is Maybe
bNothing
, no element
is added on to the result list. If it is
, then Just
bb
is
included in the result list.
Examples
Using
is a shortcut for mapMaybe
f x
in most cases:catMaybes
$ map
f x
>>>
import Text.Read ( readMaybe )
>>>
let readMaybeInt = readMaybe :: String -> Maybe Int
>>>
mapMaybe readMaybeInt ["1", "Foo", "3"]
[1,3]>>>
catMaybes $ map readMaybeInt ["1", "Foo", "3"]
[1,3]
If we map the Just
constructor, the entire list should be returned:
>>>
mapMaybe Just [1,2,3]
[1,2,3]
catMaybes :: [Maybe a] -> [a] #
The catMaybes
function takes a list of Maybe
s and returns
a list of all the Just
values.
Examples
Basic usage:
>>>
catMaybes [Just 1, Nothing, Just 3]
[1,3]
When constructing a list of Maybe
values, catMaybes
can be used
to return all of the "success" results (if the list is the result
of a map
, then mapMaybe
would be more appropriate):
>>>
import Text.Read ( readMaybe )
>>>
[readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
[Just 1,Nothing,Just 3]>>>
catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
[1,3]
listToMaybe :: [a] -> Maybe a #
The listToMaybe
function returns Nothing
on an empty list
or
where Just
aa
is the first element of the list.
Examples
Basic usage:
>>>
listToMaybe []
Nothing
>>>
listToMaybe [9]
Just 9
>>>
listToMaybe [1,2,3]
Just 1
Composing maybeToList
with listToMaybe
should be the identity
on singleton/empty lists:
>>>
maybeToList $ listToMaybe [5]
[5]>>>
maybeToList $ listToMaybe []
[]
But not on lists with more than one element:
>>>
maybeToList $ listToMaybe [1,2,3]
[1]
maybeToList :: Maybe a -> [a] #
The maybeToList
function returns an empty list when given
Nothing
or a singleton list when given Just
.
Examples
Basic usage:
>>>
maybeToList (Just 7)
[7]
>>>
maybeToList Nothing
[]
One can use maybeToList
to avoid pattern matching when combined
with a function that (safely) works on lists:
>>>
import Text.Read ( readMaybe )
>>>
sum $ maybeToList (readMaybe "3")
3>>>
sum $ maybeToList (readMaybe "")
0
fromMaybe :: a -> Maybe a -> a #
The fromMaybe
function takes a default value and and Maybe
value. If the Maybe
is Nothing
, it returns the default values;
otherwise, it returns the value contained in the Maybe
.
Examples
Basic usage:
>>>
fromMaybe "" (Just "Hello, World!")
"Hello, World!"
>>>
fromMaybe "" Nothing
""
Read an integer from a string using readMaybe
. If we fail to
parse an integer, we want to return 0
by default:
>>>
import Text.Read ( readMaybe )
>>>
fromMaybe 0 (readMaybe "5")
5>>>
fromMaybe 0 (readMaybe "")
0
fromJust :: HasCallStack => Maybe a -> a #
maybe :: b -> (a -> b) -> Maybe a -> b #
The maybe
function takes a default value, a function, and a Maybe
value. If the Maybe
value is Nothing
, the function returns the
default value. Otherwise, it applies the function to the value inside
the Just
and returns the result.
Examples
Basic usage:
>>>
maybe False odd (Just 3)
True
>>>
maybe False odd Nothing
False
Read an integer from a string using readMaybe
. If we succeed,
return twice the integer; that is, apply (*2)
to it. If instead
we fail to parse an integer, return 0
by default:
>>>
import Text.Read ( readMaybe )
>>>
maybe 0 (*2) (readMaybe "5")
10>>>
maybe 0 (*2) (readMaybe "")
0
Apply show
to a Maybe Int
. If we have Just n
, we want to show
the underlying Int
n
. But if we have Nothing
, we return the
empty string instead of (for example) "Nothing":
>>>
maybe "" show (Just 5)
"5">>>
maybe "" show Nothing
""
($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b infixr 0 #
Application operator. This operator is redundant, since ordinary
application (f x)
means the same as (f
. However, $
x)$
has
low, right-associative binding precedence, so it sometimes allows
parentheses to be omitted; for example:
f $ g $ h x = f (g (h x))
It is also useful in higher-order situations, such as
,
or map
($
0) xs
.zipWith
($
) fs xs
Note that (
is levity-polymorphic in its result type, so that
$
)foo
where $
Truefoo :: Bool -> Int#
is well-typed.
const x
is a unary function which evaluates to x
for all inputs.
>>>
const 42 "hello"
42
>>>
map (const 42) [0..3]
[42,42,42,42]
fmap :: Functor f => (a -> b) -> f a -> f b #
Using ApplicativeDo
: '
' can be understood as
the fmap
f asdo
expression
do a <- as pure (f a)
with an inferred Functor
constraint.
(++) :: [a] -> [a] -> [a] infixr 5 #
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
map :: (a -> b) -> [a] -> [b] #
\(\mathcal{O}(n)\). map
f xs
is the list obtained by applying f
to
each element of xs
, i.e.,
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]
>>>
map (+1) [1, 2, 3]
length :: Foldable t => t a -> Int #
Returns the size/length of a finite structure as an Int
. The
default implementation is optimized for structures that are similar to
cons-lists, because there is no general way to do better.
Since: base-4.8.0.0
null :: Foldable t => t a -> Bool #
Test whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.
Since: base-4.8.0.0
all :: Foldable t => (a -> Bool) -> t a -> Bool #
Determines whether all elements of the structure satisfy the predicate.
any :: Foldable t => (a -> Bool) -> t a -> Bool #
Determines whether any element of the structure satisfies the predicate.
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] #
\(\mathcal{O}(\min(m,n))\). zipWith
generalises zip
by zipping with the
function given as the first argument, instead of a tupling function. For
example,
is applied to two lists to produce the list of
corresponding sums:zipWith
(+)
>>>
zipWith (+) [1, 2, 3] [4, 5, 6]
[5,7,9]
zipWith
is right-lazy:
zipWith f [] _|_ = []
zipWith
is capable of list fusion, but it is restricted to its
first list argument and its resulting list.
The Ord
class is used for totally ordered datatypes.
Instances of Ord
can be derived for any user-defined datatype whose
constituent types are in Ord
. The declared order of the constructors in
the data declaration determines the ordering in derived Ord
instances. The
Ordering
datatype allows a single comparison to determine the precise
ordering of two objects.
The Haskell Report defines no laws for Ord
. However, <=
is customarily
expected to implement a non-strict partial order and have the following
properties:
- Transitivity
- if
x <= y && y <= z
=True
, thenx <= z
=True
- Reflexivity
x <= x
=True
- Antisymmetry
- if
x <= y && y <= x
=True
, thenx == y
=True
Note that the following operator interactions are expected to hold:
x >= y
=y <= x
x < y
=x <= y && x /= y
x > y
=y < x
x < y
=compare x y == LT
x > y
=compare x y == GT
x == y
=compare x y == EQ
min x y == if x <= y then x else y
=True
max x y == if x >= y then x else y
=True
Note that (7.) and (8.) do not require min
and max
to return either of
their arguments. The result is merely required to equal one of the
arguments in terms of (==)
.
Minimal complete definition: either compare
or <=
.
Using compare
can be more efficient for complex types.
(<) :: a -> a -> Bool infix 4 #
(<=) :: a -> a -> Bool infix 4 #
(>) :: a -> a -> Bool infix 4 #
Instances
Ord Bool | |
Ord Char | |
Ord Double | Note that due to the presence of
Also note that, due to the same,
|
Ord Float | Note that due to the presence of
Also note that, due to the same,
|
Ord Int | |
Ord Int8 | Since: base-2.1 |
Ord Int16 | Since: base-2.1 |
Ord Int32 | Since: base-2.1 |
Ord Int64 | Since: base-2.1 |
Ord Integer | |
Ord Natural | Since: base-4.8.0.0 |
Ord Ordering | |
Defined in GHC.Classes | |
Ord Word | |
Ord Word8 | Since: base-2.1 |
Ord Word16 | Since: base-2.1 |
Ord Word32 | Since: base-2.1 |
Ord Word64 | Since: base-2.1 |
Ord Exp | |
Ord Match | |
Ord Clause | |
Ord Pat | |
Ord Type | |
Ord Dec | |
Ord Name | |
Ord FunDep | |
Ord InjectivityAnn | |
Defined in Language.Haskell.TH.Syntax compare :: InjectivityAnn -> InjectivityAnn -> Ordering # (<) :: InjectivityAnn -> InjectivityAnn -> Bool # (<=) :: InjectivityAnn -> InjectivityAnn -> Bool # (>) :: InjectivityAnn -> InjectivityAnn -> Bool # (>=) :: InjectivityAnn -> InjectivityAnn -> Bool # max :: InjectivityAnn -> InjectivityAnn -> InjectivityAnn # min :: InjectivityAnn -> InjectivityAnn -> InjectivityAnn # | |
Ord Overlap | |
Ord () | |
Ord TyCon | |
Ord Version | Since: base-2.1 |
Ord Void | Since: base-4.8.0.0 |
Ord AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception compare :: AsyncException -> AsyncException -> Ordering # (<) :: AsyncException -> AsyncException -> Bool # (<=) :: AsyncException -> AsyncException -> Bool # (>) :: AsyncException -> AsyncException -> Bool # (>=) :: AsyncException -> AsyncException -> Bool # max :: AsyncException -> AsyncException -> AsyncException # min :: AsyncException -> AsyncException -> AsyncException # | |
Ord ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception compare :: ArrayException -> ArrayException -> Ordering # (<) :: ArrayException -> ArrayException -> Bool # (<=) :: ArrayException -> ArrayException -> Bool # (>) :: ArrayException -> ArrayException -> Bool # (>=) :: ArrayException -> ArrayException -> Bool # max :: ArrayException -> ArrayException -> ArrayException # min :: ArrayException -> ArrayException -> ArrayException # | |
Ord ExitCode | |
Defined in GHC.IO.Exception | |
Ord ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type compare :: ArithException -> ArithException -> Ordering # (<) :: ArithException -> ArithException -> Bool # (<=) :: ArithException -> ArithException -> Bool # (>) :: ArithException -> ArithException -> Bool # (>=) :: ArithException -> ArithException -> Bool # max :: ArithException -> ArithException -> ArithException # min :: ArithException -> ArithException -> ArithException # | |
Ord All | Since: base-2.1 |
Ord Any | Since: base-2.1 |
Ord Fixity | Since: base-4.6.0.0 |
Ord Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics compare :: Associativity -> Associativity -> Ordering # (<) :: Associativity -> Associativity -> Bool # (<=) :: Associativity -> Associativity -> Bool # (>) :: Associativity -> Associativity -> Bool # (>=) :: Associativity -> Associativity -> Bool # max :: Associativity -> Associativity -> Associativity # min :: Associativity -> Associativity -> Associativity # | |
Ord SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: SourceUnpackedness -> SourceUnpackedness -> Ordering # (<) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (<=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # max :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # min :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # | |
Ord SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: SourceStrictness -> SourceStrictness -> Ordering # (<) :: SourceStrictness -> SourceStrictness -> Bool # (<=) :: SourceStrictness -> SourceStrictness -> Bool # (>) :: SourceStrictness -> SourceStrictness -> Bool # (>=) :: SourceStrictness -> SourceStrictness -> Bool # max :: SourceStrictness -> SourceStrictness -> SourceStrictness # min :: SourceStrictness -> SourceStrictness -> SourceStrictness # | |
Ord DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: DecidedStrictness -> DecidedStrictness -> Ordering # (<) :: DecidedStrictness -> DecidedStrictness -> Bool # (<=) :: DecidedStrictness -> DecidedStrictness -> Bool # (>) :: DecidedStrictness -> DecidedStrictness -> Bool # (>=) :: DecidedStrictness -> DecidedStrictness -> Bool # max :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # min :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # | |
Ord SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits compare :: SomeSymbol -> SomeSymbol -> Ordering # (<) :: SomeSymbol -> SomeSymbol -> Bool # (<=) :: SomeSymbol -> SomeSymbol -> Bool # (>) :: SomeSymbol -> SomeSymbol -> Bool # (>=) :: SomeSymbol -> SomeSymbol -> Bool # max :: SomeSymbol -> SomeSymbol -> SomeSymbol # min :: SomeSymbol -> SomeSymbol -> SomeSymbol # | |
Ord CChar | |
Ord CSChar | |
Ord CUChar | |
Ord CShort | |
Ord CUShort | |
Ord CInt | |
Ord CUInt | |
Ord CLong | |
Ord CULong | |
Ord CLLong | |
Ord CULLong | |
Ord CBool | |
Ord CFloat | |
Ord CDouble | |
Ord CPtrdiff | |
Defined in Foreign.C.Types | |
Ord CSize | |
Ord CWchar | |
Ord CSigAtomic | |
Defined in Foreign.C.Types compare :: CSigAtomic -> CSigAtomic -> Ordering # (<) :: CSigAtomic -> CSigAtomic -> Bool # (<=) :: CSigAtomic -> CSigAtomic -> Bool # (>) :: CSigAtomic -> CSigAtomic -> Bool # (>=) :: CSigAtomic -> CSigAtomic -> Bool # max :: CSigAtomic -> CSigAtomic -> CSigAtomic # min :: CSigAtomic -> CSigAtomic -> CSigAtomic # | |
Ord CClock | |
Ord CTime | |
Ord CUSeconds | |
Defined in Foreign.C.Types | |
Ord CSUSeconds | |
Defined in Foreign.C.Types compare :: CSUSeconds -> CSUSeconds -> Ordering # (<) :: CSUSeconds -> CSUSeconds -> Bool # (<=) :: CSUSeconds -> CSUSeconds -> Bool # (>) :: CSUSeconds -> CSUSeconds -> Bool # (>=) :: CSUSeconds -> CSUSeconds -> Bool # max :: CSUSeconds -> CSUSeconds -> CSUSeconds # min :: CSUSeconds -> CSUSeconds -> CSUSeconds # | |
Ord CIntPtr | |
Ord CUIntPtr | |
Defined in Foreign.C.Types | |
Ord CIntMax | |
Ord CUIntMax | |
Defined in Foreign.C.Types | |
Ord ShortByteString | |
Defined in Data.ByteString.Short.Internal compare :: ShortByteString -> ShortByteString -> Ordering # (<) :: ShortByteString -> ShortByteString -> Bool # (<=) :: ShortByteString -> ShortByteString -> Bool # (>) :: ShortByteString -> ShortByteString -> Bool # (>=) :: ShortByteString -> ShortByteString -> Bool # max :: ShortByteString -> ShortByteString -> ShortByteString # min :: ShortByteString -> ShortByteString -> ShortByteString # | |
Ord ByteString | |
Defined in Data.ByteString.Lazy.Internal compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString # | |
Ord ByteString | |
Defined in Data.ByteString.Internal compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString # | |
Ord IntSet | |
Ord UnpackedUUID | |
Defined in Data.UUID.Types.Internal | |
Ord UUID | |
Ord BigNat | |
Ord Day | |
Ord Empty | |
Ord IntervalRelation | |
Defined in IntervalAlgebra compare :: IntervalRelation -> IntervalRelation -> Ordering # (<) :: IntervalRelation -> IntervalRelation -> Bool # (<=) :: IntervalRelation -> IntervalRelation -> Bool # (>) :: IntervalRelation -> IntervalRelation -> Bool # (>=) :: IntervalRelation -> IntervalRelation -> Bool # max :: IntervalRelation -> IntervalRelation -> IntervalRelation # min :: IntervalRelation -> IntervalRelation -> IntervalRelation # | |
Ord ByteArray | Non-lexicographic ordering. This compares the lengths of the byte arrays first and uses a lexicographic ordering if the lengths are equal. Subject to change between major versions. Since: primitive-0.6.3.0 |
Defined in Data.Primitive.ByteArray | |
Ord Scientific | Scientific numbers can be safely compared for ordering. No magnitude |
Defined in Data.Scientific compare :: Scientific -> Scientific -> Ordering # (<) :: Scientific -> Scientific -> Bool # (<=) :: Scientific -> Scientific -> Bool # (>) :: Scientific -> Scientific -> Bool # (>=) :: Scientific -> Scientific -> Bool # max :: Scientific -> Scientific -> Scientific # min :: Scientific -> Scientific -> Scientific # | |
Ord UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
Ord JSONPathElement | |
Defined in Data.Aeson.Types.Internal compare :: JSONPathElement -> JSONPathElement -> Ordering # (<) :: JSONPathElement -> JSONPathElement -> Bool # (<=) :: JSONPathElement -> JSONPathElement -> Bool # (>) :: JSONPathElement -> JSONPathElement -> Bool # (>=) :: JSONPathElement -> JSONPathElement -> Bool # max :: JSONPathElement -> JSONPathElement -> JSONPathElement # min :: JSONPathElement -> JSONPathElement -> JSONPathElement # | |
Ord Value | The ordering is total, consistent with Since: aeson-1.5.2.0 |
Ord DotNetTime | |
Defined in Data.Aeson.Types.Internal compare :: DotNetTime -> DotNetTime -> Ordering # (<) :: DotNetTime -> DotNetTime -> Bool # (<=) :: DotNetTime -> DotNetTime -> Bool # (>) :: DotNetTime -> DotNetTime -> Bool # (>=) :: DotNetTime -> DotNetTime -> Bool # max :: DotNetTime -> DotNetTime -> DotNetTime # min :: DotNetTime -> DotNetTime -> DotNetTime # | |
Ord ModName | |
Ord PkgName | |
Ord Module | |
Ord OccName | |
Ord NameFlavour | |
Defined in Language.Haskell.TH.Syntax compare :: NameFlavour -> NameFlavour -> Ordering # (<) :: NameFlavour -> NameFlavour -> Bool # (<=) :: NameFlavour -> NameFlavour -> Bool # (>) :: NameFlavour -> NameFlavour -> Bool # (>=) :: NameFlavour -> NameFlavour -> Bool # max :: NameFlavour -> NameFlavour -> NameFlavour # min :: NameFlavour -> NameFlavour -> NameFlavour # | |
Ord NameSpace | |
Defined in Language.Haskell.TH.Syntax | |
Ord Loc | |
Ord Info | |
Ord ModuleInfo | |
Defined in Language.Haskell.TH.Syntax compare :: ModuleInfo -> ModuleInfo -> Ordering # (<) :: ModuleInfo -> ModuleInfo -> Bool # (<=) :: ModuleInfo -> ModuleInfo -> Bool # (>) :: ModuleInfo -> ModuleInfo -> Bool # (>=) :: ModuleInfo -> ModuleInfo -> Bool # max :: ModuleInfo -> ModuleInfo -> ModuleInfo # min :: ModuleInfo -> ModuleInfo -> ModuleInfo # | |
Ord Fixity | |
Ord FixityDirection | |
Defined in Language.Haskell.TH.Syntax compare :: FixityDirection -> FixityDirection -> Ordering # (<) :: FixityDirection -> FixityDirection -> Bool # (<=) :: FixityDirection -> FixityDirection -> Bool # (>) :: FixityDirection -> FixityDirection -> Bool # (>=) :: FixityDirection -> FixityDirection -> Bool # max :: FixityDirection -> FixityDirection -> FixityDirection # min :: FixityDirection -> FixityDirection -> FixityDirection # | |
Ord Lit | |
Ord Bytes | |
Ord Body | |
Ord Guard | |
Ord Stmt | |
Ord Range | |
Ord DerivClause | |
Defined in Language.Haskell.TH.Syntax compare :: DerivClause -> DerivClause -> Ordering # (<) :: DerivClause -> DerivClause -> Bool # (<=) :: DerivClause -> DerivClause -> Bool # (>) :: DerivClause -> DerivClause -> Bool # (>=) :: DerivClause -> DerivClause -> Bool # max :: DerivClause -> DerivClause -> DerivClause # min :: DerivClause -> DerivClause -> DerivClause # | |
Ord DerivStrategy | |
Defined in Language.Haskell.TH.Syntax compare :: DerivStrategy -> DerivStrategy -> Ordering # (<) :: DerivStrategy -> DerivStrategy -> Bool # (<=) :: DerivStrategy -> DerivStrategy -> Bool # (>) :: DerivStrategy -> DerivStrategy -> Bool # (>=) :: DerivStrategy -> DerivStrategy -> Bool # max :: DerivStrategy -> DerivStrategy -> DerivStrategy # min :: DerivStrategy -> DerivStrategy -> DerivStrategy # | |
Ord TypeFamilyHead | |
Defined in Language.Haskell.TH.Syntax compare :: TypeFamilyHead -> TypeFamilyHead -> Ordering # (<) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (<=) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (>) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (>=) :: TypeFamilyHead -> TypeFamilyHead -> Bool # max :: TypeFamilyHead -> TypeFamilyHead -> TypeFamilyHead # min :: TypeFamilyHead -> TypeFamilyHead -> TypeFamilyHead # | |
Ord TySynEqn | |
Defined in Language.Haskell.TH.Syntax | |
Ord Foreign | |
Ord Callconv | |
Defined in Language.Haskell.TH.Syntax | |
Ord Safety | |
Ord Pragma | |
Ord Inline | |
Ord RuleMatch | |
Defined in Language.Haskell.TH.Syntax | |
Ord Phases | |
Ord RuleBndr | |
Defined in Language.Haskell.TH.Syntax | |
Ord AnnTarget | |
Defined in Language.Haskell.TH.Syntax | |
Ord SourceUnpackedness | |
Defined in Language.Haskell.TH.Syntax compare :: SourceUnpackedness -> SourceUnpackedness -> Ordering # (<) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (<=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # max :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # min :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # | |
Ord SourceStrictness | |
Defined in Language.Haskell.TH.Syntax compare :: SourceStrictness -> SourceStrictness -> Ordering # (<) :: SourceStrictness -> SourceStrictness -> Bool # (<=) :: SourceStrictness -> SourceStrictness -> Bool # (>) :: SourceStrictness -> SourceStrictness -> Bool # (>=) :: SourceStrictness -> SourceStrictness -> Bool # max :: SourceStrictness -> SourceStrictness -> SourceStrictness # min :: SourceStrictness -> SourceStrictness -> SourceStrictness # | |
Ord DecidedStrictness | |
Defined in Language.Haskell.TH.Syntax compare :: DecidedStrictness -> DecidedStrictness -> Ordering # (<) :: DecidedStrictness -> DecidedStrictness -> Bool # (<=) :: DecidedStrictness -> DecidedStrictness -> Bool # (>) :: DecidedStrictness -> DecidedStrictness -> Bool # (>=) :: DecidedStrictness -> DecidedStrictness -> Bool # max :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # min :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # | |
Ord Con | |
Ord Bang | |
Ord PatSynDir | |
Defined in Language.Haskell.TH.Syntax | |
Ord PatSynArgs | |
Defined in Language.Haskell.TH.Syntax compare :: PatSynArgs -> PatSynArgs -> Ordering # (<) :: PatSynArgs -> PatSynArgs -> Bool # (<=) :: PatSynArgs -> PatSynArgs -> Bool # (>) :: PatSynArgs -> PatSynArgs -> Bool # (>=) :: PatSynArgs -> PatSynArgs -> Bool # max :: PatSynArgs -> PatSynArgs -> PatSynArgs # min :: PatSynArgs -> PatSynArgs -> PatSynArgs # | |
Ord TyVarBndr | |
Defined in Language.Haskell.TH.Syntax | |
Ord FamilyResultSig | |
Defined in Language.Haskell.TH.Syntax compare :: FamilyResultSig -> FamilyResultSig -> Ordering # (<) :: FamilyResultSig -> FamilyResultSig -> Bool # (<=) :: FamilyResultSig -> FamilyResultSig -> Bool # (>) :: FamilyResultSig -> FamilyResultSig -> Bool # (>=) :: FamilyResultSig -> FamilyResultSig -> Bool # max :: FamilyResultSig -> FamilyResultSig -> FamilyResultSig # min :: FamilyResultSig -> FamilyResultSig -> FamilyResultSig # | |
Ord TyLit | |
Ord Role | |
Ord AnnLookup | |
Defined in Language.Haskell.TH.Syntax | |
Ord LocalTime | |
Defined in Data.Time.LocalTime.Internal.LocalTime | |
Ord TimeOfDay | |
Defined in Data.Time.LocalTime.Internal.TimeOfDay | |
Ord UniversalTime | |
Defined in Data.Time.Clock.Internal.UniversalTime compare :: UniversalTime -> UniversalTime -> Ordering # (<) :: UniversalTime -> UniversalTime -> Bool # (<=) :: UniversalTime -> UniversalTime -> Bool # (>) :: UniversalTime -> UniversalTime -> Bool # (>=) :: UniversalTime -> UniversalTime -> Bool # max :: UniversalTime -> UniversalTime -> UniversalTime # min :: UniversalTime -> UniversalTime -> UniversalTime # | |
Ord SystemTime | |
Defined in Data.Time.Clock.Internal.SystemTime compare :: SystemTime -> SystemTime -> Ordering # (<) :: SystemTime -> SystemTime -> Bool # (<=) :: SystemTime -> SystemTime -> Bool # (>) :: SystemTime -> SystemTime -> Bool # (>=) :: SystemTime -> SystemTime -> Bool # max :: SystemTime -> SystemTime -> SystemTime # min :: SystemTime -> SystemTime -> SystemTime # | |
Ord NominalDiffTime | |
Defined in Data.Time.Clock.Internal.NominalDiffTime compare :: NominalDiffTime -> NominalDiffTime -> Ordering # (<) :: NominalDiffTime -> NominalDiffTime -> Bool # (<=) :: NominalDiffTime -> NominalDiffTime -> Bool # (>) :: NominalDiffTime -> NominalDiffTime -> Bool # (>=) :: NominalDiffTime -> NominalDiffTime -> Bool # max :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # min :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # | |
Ord AbsoluteTime | |
Defined in Data.Time.Clock.Internal.AbsoluteTime compare :: AbsoluteTime -> AbsoluteTime -> Ordering # (<) :: AbsoluteTime -> AbsoluteTime -> Bool # (<=) :: AbsoluteTime -> AbsoluteTime -> Bool # (>) :: AbsoluteTime -> AbsoluteTime -> Bool # (>=) :: AbsoluteTime -> AbsoluteTime -> Bool # max :: AbsoluteTime -> AbsoluteTime -> AbsoluteTime # min :: AbsoluteTime -> AbsoluteTime -> AbsoluteTime # | |
Ord DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime | |
Ord DayOfWeek | |
Defined in Data.Time.Calendar.Week | |
Ord QuarterOfYear | |
Defined in Data.Time.Calendar.Quarter compare :: QuarterOfYear -> QuarterOfYear -> Ordering # (<) :: QuarterOfYear -> QuarterOfYear -> Bool # (<=) :: QuarterOfYear -> QuarterOfYear -> Bool # (>) :: QuarterOfYear -> QuarterOfYear -> Bool # (>=) :: QuarterOfYear -> QuarterOfYear -> Bool # max :: QuarterOfYear -> QuarterOfYear -> QuarterOfYear # min :: QuarterOfYear -> QuarterOfYear -> QuarterOfYear # | |
Ord Quarter | |
Ord Month | |
Ord Pos | |
Ord Number | |
Ord Concept Source # | |
Ord a => Ord [a] | |
Ord a => Ord (Maybe a) | Since: base-2.1 |
Integral a => Ord (Ratio a) | Since: base-2.0.1 |
Ord (Ptr a) | Since: base-2.1 |
Ord (FunPtr a) | |
Ord p => Ord (Par1 p) | Since: base-4.7.0.0 |
Ord a => Ord (Min a) | Since: base-4.9.0.0 |
Ord a => Ord (Max a) | Since: base-4.9.0.0 |
Ord a => Ord (First a) | Since: base-4.9.0.0 |
Ord a => Ord (Last a) | Since: base-4.9.0.0 |
Ord m => Ord (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup compare :: WrappedMonoid m -> WrappedMonoid m -> Ordering # (<) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (<=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (>) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (>=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # max :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # min :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # | |
Ord a => Ord (Option a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
Ord a => Ord (ZipList a) | Since: base-4.7.0.0 |
Defined in Control.Applicative | |
Ord a => Ord (Identity a) | Since: base-4.8.0.0 |
Ord a => Ord (First a) | Since: base-2.1 |
Ord a => Ord (Last a) | Since: base-2.1 |
Ord a => Ord (Dual a) | Since: base-2.1 |
Ord a => Ord (Sum a) | Since: base-2.1 |
Ord a => Ord (Product a) | Since: base-2.1 |
Defined in Data.Semigroup.Internal | |
Ord a => Ord (Down a) | Since: base-4.6.0.0 |
Ord a => Ord (NonEmpty a) | Since: base-4.9.0.0 |
Ord a => Ord (IntMap a) | |
Defined in Data.IntMap.Internal | |
Ord a => Ord (Seq a) | |
Ord a => Ord (ViewL a) | |
Ord a => Ord (ViewR a) | |
Ord a => Ord (Set a) | |
Ord a => Ord (DNonEmpty a) | |
Defined in Data.DList.DNonEmpty.Internal | |
Ord a => Ord (DList a) | |
Ord1 f => Ord (Fix f) | |
(Functor f, Ord1 f) => Ord (Mu f) | |
(Functor f, Ord1 f) => Ord (Nu f) | |
Ord a => Ord (Hashed a) | |
Defined in Data.Hashable.Class | |
Ord a => Ord (HashSet a) | |
Defined in Data.HashSet.Internal | |
Ord a => Ord (Interval a) | Imposes a total ordering on |
(Ord a, Prim a) => Ord (PrimArray a) | Lexicographic ordering. Subject to change between major versions. Since: primitive-0.6.4.0 |
Defined in Data.Primitive.PrimArray | |
Ord a => Ord (SmallArray a) | Lexicographic ordering. Subject to change between major versions. |
Defined in Data.Primitive.SmallArray compare :: SmallArray a -> SmallArray a -> Ordering # (<) :: SmallArray a -> SmallArray a -> Bool # (<=) :: SmallArray a -> SmallArray a -> Bool # (>) :: SmallArray a -> SmallArray a -> Bool # (>=) :: SmallArray a -> SmallArray a -> Bool # max :: SmallArray a -> SmallArray a -> SmallArray a # min :: SmallArray a -> SmallArray a -> SmallArray a # | |
Ord a => Ord (Array a) | Lexicographic ordering. Subject to change between major versions. |
Ord g => Ord (AtomicGen g) | |
Defined in System.Random.Stateful | |
Ord g => Ord (IOGen g) | |
Ord g => Ord (STGen g) | |
Ord g => Ord (StateGen g) | |
Ord (Encoding' a) | |
Defined in Data.Aeson.Encoding.Internal | |
Ord a => Ord (Maybe a) | |
(Storable a, Ord a) => Ord (Vector a) | |
Defined in Data.Vector.Storable | |
(Prim a, Ord a) => Ord (Vector a) | |
Defined in Data.Vector.Primitive | |
Ord a => Ord (Vector a) | |
Defined in Data.Vector | |
(Ord a, Ord b) => Ord (Either a b) | Since: base-2.1 |
Ord (V1 p) | Since: base-4.9.0.0 |
Ord (U1 p) | Since: base-4.7.0.0 |
(Ord a, Ord b) => Ord (a, b) | |
Ord (Fixed a) | Since: base-2.1 |
Ord a => Ord (Arg a b) | Since: base-4.9.0.0 |
Ord (Proxy s) | Since: base-4.7.0.0 |
(Ord k, Ord v) => Ord (Map k v) | |
(Ord k, Ord v) => Ord (HashMap k v) | The ordering is total and consistent with the |
Defined in Data.HashMap.Internal | |
(Eq a, Eq b, Ord a) => Ord (PairedInterval b a) | Defines A total ordering on 'PairedInterval b a' based on the 'Interval a' part. |
Defined in IntervalAlgebra.PairedInterval compare :: PairedInterval b a -> PairedInterval b a -> Ordering # (<) :: PairedInterval b a -> PairedInterval b a -> Bool # (<=) :: PairedInterval b a -> PairedInterval b a -> Bool # (>) :: PairedInterval b a -> PairedInterval b a -> Bool # (>=) :: PairedInterval b a -> PairedInterval b a -> Bool # max :: PairedInterval b a -> PairedInterval b a -> PairedInterval b a # min :: PairedInterval b a -> PairedInterval b a -> PairedInterval b a # | |
(Ord a, Ord b) => Ord (Pair a b) | |
Defined in Data.Strict.Tuple | |
(Ord a, Ord b) => Ord (These a b) | |
Defined in Data.Strict.These | |
(Ord a, Ord b) => Ord (Either a b) | |
(Ord a, Ord b) => Ord (These a b) | |
Defined in Data.These | |
Ord (f p) => Ord (Rec1 f p) | Since: base-4.7.0.0 |
Defined in GHC.Generics | |
Ord (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering # (<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # | |
Ord (URec Char p) | Since: base-4.9.0.0 |
Ord (URec Double p) | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec Double p -> URec Double p -> Ordering # (<) :: URec Double p -> URec Double p -> Bool # (<=) :: URec Double p -> URec Double p -> Bool # (>) :: URec Double p -> URec Double p -> Bool # (>=) :: URec Double p -> URec Double p -> Bool # | |
Ord (URec Float p) | |
Defined in GHC.Generics | |
Ord (URec Int p) | Since: base-4.9.0.0 |
Ord (URec Word p) | Since: base-4.9.0.0 |
(Ord a, Ord b, Ord c) => Ord (a, b, c) | |
Defined in GHC.Classes | |
Ord a => Ord (Const a b) | Since: base-4.9.0.0 |
Defined in Data.Functor.Const | |
Ord (f a) => Ord (Ap f a) | Since: base-4.12.0.0 |
Ord (f a) => Ord (Alt f a) | Since: base-4.8.0.0 |
(Ord e, Ord1 m, Ord a) => Ord (ErrorT e m a) | |
Defined in Control.Monad.Trans.Error | |
Ord b => Ord (Tagged s b) | |
(Ord1 f, Ord1 g, Ord a) => Ord (These1 f g a) | |
Defined in Data.Functor.These | |
Ord c => Ord (K1 i c p) | Since: base-4.7.0.0 |
Defined in GHC.Generics | |
(Ord (f p), Ord (g p)) => Ord ((f :+: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :*: g) p) | Since: base-4.7.0.0 |
(Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) | |
Defined in GHC.Classes | |
(Ord1 f, Ord1 g, Ord a) => Ord (Product f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product compare :: Product f g a -> Product f g a -> Ordering # (<) :: Product f g a -> Product f g a -> Bool # (<=) :: Product f g a -> Product f g a -> Bool # (>) :: Product f g a -> Product f g a -> Bool # (>=) :: Product f g a -> Product f g a -> Bool # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
Ord (f p) => Ord (M1 i c f p) | Since: base-4.7.0.0 |
Ord (f (g p)) => Ord ((f :.: g) p) | Since: base-4.7.0.0 |
(Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) | |
Defined in GHC.Classes compare :: (a, b, c, d, e) -> (a, b, c, d, e) -> Ordering # (<) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (<=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # max :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # min :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose compare :: Compose f g a -> Compose f g a -> Ordering # (<) :: Compose f g a -> Compose f g a -> Bool # (<=) :: Compose f g a -> Compose f g a -> Bool # (>) :: Compose f g a -> Compose f g a -> Bool # (>=) :: Compose f g a -> Compose f g a -> Bool # | |
Ord (p b a) => Ord (Flip p a b) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Ordering # (<) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (<=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # max :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # min :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # | |
(Ord (p a b), Ord (q a b)) => Ord (Sum p q a b) | |
Defined in Data.Bifunctor.Sum | |
(Ord (f a b), Ord (g a b)) => Ord (Product f g a b) | |
Defined in Data.Bifunctor.Product compare :: Product f g a b -> Product f g a b -> Ordering # (<) :: Product f g a b -> Product f g a b -> Bool # (<=) :: Product f g a b -> Product f g a b -> Bool # (>) :: Product f g a b -> Product f g a b -> Bool # (>=) :: Product f g a b -> Product f g a b -> Bool # max :: Product f g a b -> Product f g a b -> Product f g a b # min :: Product f g a b -> Product f g a b -> Product f g a b # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Ordering # (<) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (<=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # max :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # min :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # | |
Ord (f (p a b)) => Ord (Tannen f p a b) | |
Defined in Data.Bifunctor.Tannen compare :: Tannen f p a b -> Tannen f p a b -> Ordering # (<) :: Tannen f p a b -> Tannen f p a b -> Bool # (<=) :: Tannen f p a b -> Tannen f p a b -> Bool # (>) :: Tannen f p a b -> Tannen f p a b -> Bool # (>=) :: Tannen f p a b -> Tannen f p a b -> Bool # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Ordering # (<) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (<=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # max :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) # min :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # max :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) # min :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) # | |
Ord (p (f a) (g b)) => Ord (Biff p f g a b) | |
Defined in Data.Bifunctor.Biff compare :: Biff p f g a b -> Biff p f g a b -> Ordering # (<) :: Biff p f g a b -> Biff p f g a b -> Bool # (<=) :: Biff p f g a b -> Biff p f g a b -> Bool # (>) :: Biff p f g a b -> Biff p f g a b -> Bool # (>=) :: Biff p f g a b -> Biff p f g a b -> Bool # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) # min :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) # min :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) # min :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # |
The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.
Instances
Enum Day | |
Eq Day | |
Data Day | |
Defined in Data.Time.Calendar.Days gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Day -> c Day # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Day # dataTypeOf :: Day -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Day) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Day) # gmapT :: (forall b. Data b => b -> b) -> Day -> Day # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r # gmapQ :: (forall d. Data d => d -> u) -> Day -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Day -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Day -> m Day # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day # | |
Ord Day | |
Ix Day | |
NFData Day | |
Defined in Data.Time.Calendar.Days | |
ToJSON Day | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Day | |
Defined in Data.Aeson.Types.ToJSON | |
FromJSON Day | |
FromJSONKey Day | |
Defined in Data.Aeson.Types.FromJSON | |
IntervalSizeable Day Integer | |
FromJSON (Interval Day) Source # | |
FromJSON (Event Day) Source # | |
fromGregorian :: Year -> MonthOfYear -> DayOfMonth -> Day #
Convert from proleptic Gregorian calendar. Invalid values will be clipped to the correct range, month first, then day.
type MonthOfYear = Int #
Month of year, in range 1 (January) to 12 (December).
A space efficient, packed, unboxed Unicode text type.
Instances
Hashable Text | |
Defined in Data.Hashable.Class | |
ToJSON Text | |
Defined in Data.Aeson.Types.ToJSON | |
KeyValue Object | Constructs a singleton |
KeyValue Pair | |
ToJSONKey Text | |
Defined in Data.Aeson.Types.ToJSON | |
FromJSON Text | |
FromJSONKey Text | |
Defined in Data.Aeson.Types.FromJSON | |
Chunk Text | |
Defined in Data.Attoparsec.Internal.Types | |
FromPairs Value (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON | |
v ~ Value => KeyValuePair v (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON | |
type Item Text | |
type State Text | |
Defined in Data.Attoparsec.Internal.Types | |
type ChunkElem Text | |
Defined in Data.Attoparsec.Internal.Types |
uncurry :: (a -> b -> c) -> (a, b) -> c #
uncurry
converts a curried function to a function on pairs.
Examples
>>>
uncurry (+) (1,2)
3
>>>
uncurry ($) (show, 1)
"1"
>>>
map (uncurry max) [(1,2), (3,4), (6,8)]
[2,4,8]
(<!) :: (a -> b) -> a -> b infixr 0 #
Right-associative apply'
operator. Read as "strict apply backward" or
"strict pipe from". Use this to create long chains of computation that
suggest which direction things move in. You may prefer this operator over
(!>
) for IO
actions since it puts the last function first.
>>>
print <! negate <! recip <! succ <! 3
-0.25
The difference between this and (<|
) is that this evaluates its argument
before passing it to the function.
>>>
const True <| undefined
True>>>
const True <! undefined
*** Exception: Prelude.undefined ...
Note that (<!
) and (!>
) have the same precedence, so they cannot be used
together.
>>>
-- This doesn't work!
>>>
-- print <! 3 !> succ !> recip !> negate
\ x -> (f <! x) == seq x (f x)
\ x -> (g <! f <! x) == let y = seq x (f x) in seq y (g y)
(!>) :: a -> (a -> b) -> b infixl 0 #
Left-associative apply'
operator. Read as "strict apply forward" or
"strict pipe into". Use this to create long chains of computation that
suggest which direction things move in.
>>>
3 !> succ !> recip !> negate
-0.25
The difference between this and (|>
) is that this evaluates its argument
before passing it to the function.
>>>
undefined |> const True
True>>>
undefined !> const True
*** Exception: Prelude.undefined ...
\ x -> (x !> f) == seq x (f x)
\ x -> (x !> f !> g) == let y = seq x (f x) in seq y (g y)
(<.) :: (b -> c) -> (a -> b) -> a -> c infixr 9 #
Right-associative compose
operator. Read as "compose backward" or "but
first". Use this to create long chains of computation that suggest which
direction things move in. You may prefer this operator over (.>
) for
IO
actions since it puts the last function first.
>>>
let f = print <. negate <. recip <. succ
>>>
f 3
-0.25
Or use it anywhere you would use (.
).
Note that (<.
) and (.>
) have the same precedence, so they cannot be used
together.
>>>
-- This doesn't work!
>>>
-- print <. succ .> recip .> negate
\ x -> (g <. f) x == g (f x)
\ x -> (h <. g <. f) x == h (g (f x))
(.>) :: (a -> b) -> (b -> c) -> a -> c infixl 9 #
Left-associative compose
operator. Read as "compose forward" or "and
then". Use this to create long chains of computation that suggest which
direction things move in.
>>>
let f = succ .> recip .> negate
>>>
f 3
-0.25
Or use it anywhere you would use (>>>
).
\ x -> (f .> g) x == g (f x)
\ x -> (f .> g .> h) x == h (g (f x))
(<|) :: (a -> b) -> a -> b infixr 0 #
Right-associative apply
operator. Read as "apply backward" or "pipe
from". Use this to create long chains of computation that suggest which
direction things move in. You may prefer this operator over (|>
) for
IO
actions since it puts the last function first.
>>>
print <| negate <| recip <| succ <| 3
-0.25
Or use it anywhere you would use ($
).
Note that (<|
) and (|>
) have the same precedence, so they cannot be used
together.
>>>
-- This doesn't work!
>>>
-- print <| 3 |> succ |> recip |> negate
\ x -> (f <| x) == f x
\ x -> (g <| f <| x) == g (f x)
class Functor f => Filterable (f :: Type -> Type) where #
Like Functor
, but you can remove elements instead of updating them.
Formally, the class Filterable
represents a functor from Kleisli Maybe
to Hask
.
A definition of mapMaybe
must satisfy the following laws: