Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Charon.Prelude
Contents
Description
Custom prelude.
Synopsis
- data NonEmpty a = a :| [a]
- data Bool
- data Char
- data Double
- data Int
- data Ordering
- data Maybe a
- class a ~# b => (a :: k) ~ (b :: k)
- data Natural
- data Integer
- class Generic a
- class Show a where
- class Bounded a where
- class Enum a where
- class (Real a, Enum a) => Integral a where
- div :: a -> a -> a
- data IO a
- class Eq a => Ord a where
- type String = [Char]
- type Type = TYPE LiftedRep
- type Constraint = CONSTRAINT LiftedRep
- class Eq a where
- class Semigroup a => Monoid a where
- class Semigroup a where
- (<>) :: a -> a -> a
- class Functor f => Applicative (f :: Type -> Type) where
- class Functor (f :: Type -> Type) where
- fmap :: (a -> b) -> f a -> f b
- class Applicative m => Monad (m :: Type -> Type) where
- (>>=) :: m a -> (a -> m b) -> m b
- data ByteString
- data HashMap k v
- data Text
- data Either a b
- class Eq a => Hashable a where
- hashWithSalt :: Int -> a -> Int
- class Foldable (t :: Type -> Type) where
- class Monad m => MonadFail (m :: Type -> Type) where
- class Num a where
- data Doc ann
- class Pretty a where
- data Word8
- data Handle
- data Word16
- class (forall a. Functor (p a)) => Bifunctor (p :: Type -> Type -> Type) where
- bimap :: (a -> b) -> (c -> d) -> p a c -> p b d
- class (Typeable e, Show e) => Exception e where
- displayException :: e -> String
- class Monad m => MonadIO (m :: Type -> Type) where
- data IOException
- class IsString a where
- fromString :: String -> a
- data CallStack
- type HasCallStack = ?callStack :: CallStack
- data SomeException
- class Applicative f => Alternative (f :: Type -> Type) where
- (<|>) :: f a -> f a -> f a
- data Proxy (t :: k) = Proxy
- data IOMode = AppendMode
- type FilePath = String
- data IORef a
- data BufferMode = NoBuffering
- data ExitCode
- data Vector a
- data Size = B
- class Monad m => MonadThrow (m :: Type -> Type)
- data ReaderT r (m :: Type -> Type) a
- data Seq a where
- class NFData a
- type OsPath = OsString
- class Monad m => MonadAsync (m :: Type -> Type)
- class MonadCatch m => MonadMask (m :: Type -> Type)
- class MonadThrow m => MonadCatch (m :: Type -> Type)
- data ExceptionCS e = MkExceptionCS e CallStack
- data PathType
- class Monad m => MonadPathReader (m :: Type -> Type) where
- listDirectory :: OsPath -> m [OsPath]
- getHomeDirectory :: m OsPath
- getFileSize :: OsPath -> m Integer
- canonicalizePath :: OsPath -> m OsPath
- makeAbsolute :: OsPath -> m OsPath
- doesPathExist :: OsPath -> m Bool
- doesFileExist :: OsPath -> m Bool
- doesDirectoryExist :: OsPath -> m Bool
- class Monad m => MonadPathWriter (m :: Type -> Type) where
- createDirectoryIfMissing :: Bool -> OsPath -> m ()
- removeDirectoryRecursive :: OsPath -> m ()
- removePathForcibly :: OsPath -> m ()
- renameDirectory :: OsPath -> OsPath -> m ()
- renameFile :: OsPath -> OsPath -> m ()
- class Monad m => MonadHandleWriter (m :: Type -> Type) where
- class Monad m => MonadFileWriter (m :: Type -> Type) where
- writeBinaryFile :: OsPath -> ByteString -> m ()
- appendBinaryFile :: OsPath -> ByteString -> m ()
- class Monad m => MonadFileReader (m :: Type -> Type) where
- readBinaryFile :: OsPath -> m ByteString
- class Monad m => MonadIORef (m :: Type -> Type) where
- newIORef :: HasCallStack => a -> m (IORef a)
- readIORef :: HasCallStack => IORef a -> m a
- writeIORef :: HasCallStack => IORef a -> a -> m ()
- modifyIORef' :: HasCallStack => IORef a -> (a -> a) -> m ()
- class Monad m => MonadLogger (m :: Type -> Type) where
- monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> m ()
- data LogLevel
- class MonadLogger m => MonadLoggerNS (m :: Type -> Type) where
- getNamespace :: m Namespace
- localNamespace :: HasCallStack => (Namespace -> Namespace) -> m a -> m a
- class Monad m => MonadOptparse (m :: Type -> Type) where
- execParser :: HasCallStack => ParserInfo a -> m a
- class Monad m => MonadTerminal (m :: Type -> Type) where
- class Monad m => MonadTime (m :: Type -> Type)
- class Monad m => MonadPosixCompat (m :: Type -> Type)
- class Monad m => MonadReader r (m :: Type -> Type) | m -> r where
- data NESeq a where
- type Lens s t a b = Optic A_Lens NoIx s t a b
- type Getter s a = Optic' A_Getter NoIx s a
- data A_Getter
- data A_Setter
- data A_Lens
- class Is k l
- type Optic' k (is :: IxList) s a = Optic k is s s a a
- type AffineTraversal' s a = Optic' An_AffineTraversal NoIx s a
- type Lens' s a = Optic' A_Lens NoIx s a
- type Prism' s a = Optic' A_Prism NoIx s a
- type Iso' s a = Optic' An_Iso NoIx s a
- type LabelOptic' (name :: Symbol) k s a = LabelOptic name k s s a a
- class LabelOptic (name :: Symbol) k s t a b | name s -> k a, name t -> k b, name s b -> t, name t a -> s where
- labelOptic :: Optic k NoIx s t a b
- newtype Bytes (s :: Size) n = MkBytes n
- data HashSet a
- void :: Functor f => f a -> f ()
- finally :: (HasCallStack, MonadMask m) => m a -> m b -> m a
- realToFrac :: (Real a, Fractional b) => a -> b
- fromIntegral :: (Integral a, Num b) => a -> b
- ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- otherwise :: Bool
- (++) :: [a] -> [a] -> [a]
- join :: Monad m => m (m a) -> m a
- traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
- filter :: (a -> Bool) -> [a] -> [a]
- id :: a -> a
- (.) :: (b -> c) -> (a -> b) -> a -> c
- const :: a -> b -> a
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- vsep :: [Doc ann] -> Doc ann
- (<+>) :: Doc ann -> Doc ann -> Doc ann
- (</>) :: OsPath -> OsPath -> OsPath
- line :: Doc ann
- error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
- callStack :: HasCallStack => CallStack
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- even :: Integral a => a -> Bool
- bracket :: (HasCallStack, MonadMask m) => m a -> (a -> m c) -> (a -> m b) -> m b
- fst :: (a, b) -> a
- uncurry :: (a -> b -> c) -> (a, b) -> c
- try :: (HasCallStack, MonadCatch m, Exception e) => m a -> m (Either e a)
- catch :: (HasCallStack, MonadCatch m, Exception e) => m a -> (e -> m a) -> m a
- print :: (HasCallStack, MonadTerminal m, Show a) => a -> m ()
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- when :: Applicative f => Bool -> f () -> f ()
- flip :: (a -> b -> c) -> b -> a -> c
- maybe :: b -> (a -> b) -> Maybe a -> b
- fromMaybe :: a -> Maybe a -> a
- (%) :: forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a b. (JoinKinds k l m, AppendIndices is js ks) => Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
- curry :: ((a, b) -> c) -> a -> b -> c
- (<&>) :: Functor f => f a -> (a -> b) -> f b
- ($>) :: Functor f => f a -> b -> f b
- (&) :: a -> (a -> b) -> b
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- to :: (s -> a) -> Getter s a
- traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
- prettyCallStack :: CallStack -> String
- catchAny :: (HasCallStack, MonadCatch m) => m a -> (SomeException -> m a) -> m a
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- unless :: Applicative f => Bool -> f () -> f ()
- exitFailure :: (HasCallStack, MonadThrow m) => m a
- asks :: MonadReader r m => (r -> a) -> m a
- throwM :: (HasCallStack, MonadThrow m, Exception e) => e -> m a
- encodeUtf8 :: Text -> ByteString
- decodeUtf8 :: ByteString -> Either UnicodeException Text
- decodeUtf8Lenient :: ByteString -> Text
- (<.>) :: OsPath -> OsString -> OsPath
- throwString :: (MonadThrow m, HasCallStack) => String -> m a
- throwCS :: forall m e a. (Exception e, HasCallStack, MonadThrow m) => e -> m a
- catchCS :: forall m e a. (Exception e, HasCallStack, MonadCatch m) => m a -> (e -> m a) -> m a
- catchAnyCS :: (HasCallStack, MonadCatch m) => m a -> (SomeException -> m a) -> m a
- tryCS :: forall m e a. (Exception e, MonadCatch m) => m a -> m (Either e a)
- tryAnyCS :: MonadCatch m => m a -> m (Either SomeException a)
- addCS :: (HasCallStack, MonadCatch m) => m a -> m a
- displayNoCS :: Exception e => e -> String
- tryAny :: (HasCallStack, MonadCatch m) => m a -> m (Either SomeException a)
- osp :: QuasiQuoter
- encodeFpToOs :: FilePath -> Either EncodingException OsPath
- encodeFpToOsThrowM :: (HasCallStack, MonadThrow m) => FilePath -> m OsPath
- decodeOsToFp :: OsPath -> Either EncodingException FilePath
- decodeOsToFpThrowM :: (HasCallStack, MonadThrow m) => OsPath -> m FilePath
- decodeOsToFpDisplayEx :: OsPath -> String
- getXdgConfig :: (HasCallStack, MonadPathReader m) => OsPath -> m OsPath
- doesSymbolicLinkExist :: (HasCallStack, MonadCatch m, MonadPathReader m) => OsPath -> m Bool
- readFileUtf8ThrowM :: (HasCallStack, MonadFileReader m, MonadThrow m) => OsPath -> m Text
- logDebug :: Q Exp
- logInfo :: Q Exp
- logWarn :: Q Exp
- logError :: Q Exp
- addNamespace :: MonadLoggerNS m => Text -> m a -> m a
- levelTrace :: LogLevel
- levelFatal :: LogLevel
- logTrace :: Q Exp
- logFatal :: Q Exp
- putTextLn :: (HasCallStack, MonadTerminal m) => Text -> m ()
- preview :: forall k (is :: IxList) s a. Is k An_AffineFold => Optic' k is s a -> s -> Maybe a
- is :: forall k (is :: IxList) s a. Is k An_AffineFold => Optic' k is s a -> s -> Bool
- _1 :: Field1 s t a b => Lens s t a b
- view :: forall k (is :: IxList) s a. Is k A_Getter => Optic' k is s a -> s -> a
- (.~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t
- (^.) :: forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a
- lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
- prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b
- _Just :: Prism (Maybe a) (Maybe b) a b
- (%?) :: forall (is :: IxList) (js :: IxList) (ks :: IxList) k k' l m s t u v a b. (AppendIndices is js ks, JoinKinds k A_Prism k', JoinKinds k' l m) => Optic k is s t (Maybe u) (Maybe v) -> Optic l js u v a b -> Optic m ks s t a b
- review :: forall k (is :: IxList) t b. Is k A_Review => Optic' k is t b -> b -> t
- iso :: (s -> a) -> (b -> t) -> Iso s t a b
- over' :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t
- set' :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t
- (^?) :: forall k s (is :: IxList) a. Is k An_AffineFold => s -> Optic' k is s a -> Maybe a
- _4 :: Field4 s t a b => Lens s t a b
- _3 :: Field3 s t a b => Lens s t a b
- _2 :: Field2 s t a b => Lens s t a b
- makePrisms :: Name -> DecsQ
- makeFieldLabelsWith :: LensRules -> Name -> DecsQ
- makeFieldLabelsNoPrefix :: Name -> DecsQ
- generateUpdateableOptics :: Lens' LensRules Bool
- noPrefixFieldLabels :: LensRules
- findLargestPaths :: (HasCallStack, MonadAsync m, MonadCatch m, MonadPathReader m, MonadPosixCompat m) => Config -> OsPath -> m (PathSizeResult SubPathData)
- layoutCompact :: Doc ann1 -> SimpleDocStream ann2
- renderStrict :: SimpleDocStream ann -> Text
- _MkBytes :: forall (s :: Size) n. Iso' (Bytes s n) n
- bsToStr :: ByteString -> String
- bsToStrLenient :: ByteString -> String
- showt :: Show a => a -> Text
- displayExceptiont :: Exception e => e -> Text
- decodeOsToFpDisplayExT :: OsPath -> Text
- packed :: Iso' String Text
- unpacked :: Iso' Text String
- pathDotTrash :: OsPath
- pathCharon :: OsPath
- doesAnyPathExist :: (HasCallStack, MonadCatch m, MonadPathReader m) => OsPath -> m Bool
- doesAnyPathNotExist :: (HasCallStack, MonadCatch m, MonadPathReader m) => OsPath -> m Bool
- usingReaderT :: b -> ReaderT b m a -> m a
Documentation
Non-empty (and non-strict) list type.
Since: base-4.9.0.0
Constructors
a :| [a] infixr 5 |
Instances
Instances
The character type Char
is an enumeration whose values represent
Unicode (or equivalently ISO/IEC 10646) code points (i.e. characters, see
http://www.unicode.org/ for details). This set extends the ISO 8859-1
(Latin-1) character set (the first 256 characters), which is itself an extension
of the ASCII character set (the first 128 characters). A character literal in
Haskell has type Char
.
To convert a Char
to or from the corresponding Int
value defined
by Unicode, use toEnum
and fromEnum
from the
Enum
class respectively (or equivalently ord
and
chr
).
Instances
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Instances
FromJSON Double | |
FromJSONKey Double | |
Defined in Data.Aeson.Types.FromJSON Methods | |
ToJSON Double | |
ToJSONKey Double | |
Defined in Data.Aeson.Types.ToJSON Methods | |
AMonoid Double | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Additive.AMonoid | |
ASemigroup Double | Since: algebra-simple-0.1 |
MGroup Double | Since: algebra-simple-0.1 |
MMonoid Double | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Multiplicative.MMonoid | |
MSemigroup Double | Since: algebra-simple-0.1 |
Normed Double | Since: algebra-simple-0.1 |
Semifield Double | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semifield | |
Semiring Double | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semiring | |
FromInteger Double | Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Integer Methods afromInteger :: Integer -> Double Source # | |
FromRational Double | Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Rational Methods afromRational :: Rational -> Double Source # | |
Pretty Double | |
Floating Double | Since: base-2.1 |
RealFloat Double | Since: base-2.1 |
Defined in GHC.Float Methods floatRadix :: Double -> Integer # floatDigits :: Double -> Int # floatRange :: Double -> (Int, Int) # decodeFloat :: Double -> (Integer, Int) # encodeFloat :: Integer -> Int -> Double # significand :: Double -> Double # scaleFloat :: Int -> Double -> Double # isInfinite :: Double -> Bool # isDenormalized :: Double -> Bool # isNegativeZero :: Double -> Bool # | |
Read Double | Since: base-2.1 |
PrintfArg Double | Since: base-2.1 |
Defined in Text.Printf | |
NFData Double | |
Defined in Control.DeepSeq | |
ToLogStr Double | Since: fast-logger-2.4.14 |
Eq Double | Note that due to the presence of
Also note that
|
Ord Double | Note that due to the presence of
Also note that, due to the same,
|
Hashable Double | Note: prior to The Since: hashable-1.3.0.0 |
Pretty Double |
|
UniformRange Double | |
Defined in System.Random.Internal | |
Serialise Double | Since: serialise-0.2.0.0 |
DecodeTOML Double | |
Defined in TOML.Decode Methods | |
Unbox Double | |
Defined in Data.Vector.Unboxed.Base | |
Lift Double | |
Vector Vector Double | |
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Double -> ST s (Vector Double) Source # basicUnsafeThaw :: Vector Double -> ST s (Mutable Vector s Double) Source # basicLength :: Vector Double -> Int Source # basicUnsafeSlice :: Int -> Int -> Vector Double -> Vector Double Source # basicUnsafeIndexM :: Vector Double -> Int -> Box Double Source # basicUnsafeCopy :: Mutable Vector s Double -> Vector Double -> ST s () Source # | |
MVector MVector Double | |
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Double -> Int Source # basicUnsafeSlice :: Int -> Int -> MVector s Double -> MVector s Double Source # basicOverlaps :: MVector s Double -> MVector s Double -> Bool Source # basicUnsafeNew :: Int -> ST s (MVector s Double) Source # basicInitialize :: MVector s Double -> ST s () Source # basicUnsafeReplicate :: Int -> Double -> ST s (MVector s Double) Source # basicUnsafeRead :: MVector s Double -> Int -> ST s Double Source # basicUnsafeWrite :: MVector s Double -> Int -> Double -> ST s () Source # basicClear :: MVector s Double -> ST s () Source # basicSet :: MVector s Double -> Double -> ST s () Source # basicUnsafeCopy :: MVector s Double -> MVector s Double -> ST s () Source # basicUnsafeMove :: MVector s Double -> MVector s Double -> ST s () Source # basicUnsafeGrow :: MVector s Double -> Int -> ST s (MVector s Double) Source # | |
Generic1 (URec Double :: k -> Type) | |
Foldable (UDouble :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UDouble m -> m # foldMap :: Monoid m => (a -> m) -> UDouble a -> m # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m # foldr :: (a -> b -> b) -> b -> UDouble a -> b # foldr' :: (a -> b -> b) -> b -> UDouble a -> b # foldl :: (b -> a -> b) -> b -> UDouble a -> b # foldl' :: (b -> a -> b) -> b -> UDouble a -> b # foldr1 :: (a -> a -> a) -> UDouble a -> a # foldl1 :: (a -> a -> a) -> UDouble a -> a # elem :: Eq a => a -> UDouble a -> Bool # maximum :: Ord a => UDouble a -> a # minimum :: Ord a => UDouble a -> a # | |
Traversable (UDouble :: Type -> Type) | Since: base-4.9.0.0 |
Functor (URec Double :: Type -> Type) | Since: base-4.9.0.0 |
Generic (URec Double p) | |
Show (URec Double p) | Since: base-4.9.0.0 |
Eq (URec Double p) | Since: base-4.9.0.0 |
Ord (URec Double p) | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods 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 # | |
type BaseFormatter Double | |
Defined in Data.Bytes.Formatting.Base | |
newtype Vector Double | |
data URec Double (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 |
newtype MVector s Double | |
type Rep1 (URec Double :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Rep (URec Double p) | Since: base-4.9.0.0 |
Defined in GHC.Generics |
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
Instances
FromJSON Ordering | |
ToJSON Ordering | |
Monoid Ordering | Since: base-2.1 |
Semigroup Ordering | Since: base-4.9.0.0 |
Bounded Ordering | Since: base-2.1 |
Enum Ordering | Since: base-2.1 |
Generic Ordering | |
Read Ordering | Since: base-2.1 |
Show Ordering | Since: base-2.1 |
NFData Ordering | |
Defined in Control.DeepSeq | |
Eq Ordering | |
Ord Ordering | |
Defined in GHC.Classes | |
Hashable Ordering | |
Serialise Ordering | Since: serialise-0.2.0.0 |
DecodeTOML Ordering | |
Defined in TOML.Decode Methods | |
type Rep Ordering | Since: base-4.6.0.0 |
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
FromJSON1 Maybe | |
ToJSON1 Maybe | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> Maybe a -> Value Source # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Maybe a] -> Value Source # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Maybe a -> Encoding Source # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Maybe a] -> Encoding Source # | |
MonadFail Maybe | Since: base-4.9.0.0 |
Defined in Control.Monad.Fail | |
Foldable Maybe | Since: base-2.1 |
Defined in Data.Foldable Methods 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 |
Alternative Maybe | Picks the leftmost Since: base-2.1 |
Applicative Maybe | Since: base-2.1 |
Functor Maybe | Since: base-2.1 |
Monad Maybe | Since: base-2.1 |
MonadPlus Maybe | Picks the leftmost Since: base-2.1 |
NFData1 Maybe | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
MonadThrow Maybe | |
Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> Maybe a # | |
Hashable1 Maybe | |
Defined in Data.Hashable.Class | |
Generic1 Maybe | |
MonadBaseControl Maybe 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 | |
FromJSON a => FromJSON (Maybe a) | |
ToJSON a => ToJSON (Maybe a) | |
Pretty a => Pretty (Maybe a) | |
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
Semigroup a => Semigroup (Maybe a) | Since: base-4.9.0.0 |
Generic (Maybe a) | |
SingKind a => SingKind (Maybe a) | Since: base-4.9.0.0 |
Defined in GHC.Generics Associated Types type DemoteRep (Maybe a) | |
Read a => Read (Maybe a) | Since: base-2.1 |
Show a => Show (Maybe a) | Since: base-2.1 |
NFData a => NFData (Maybe a) | |
Defined in Control.DeepSeq | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Ord a => Ord (Maybe a) | Since: base-2.1 |
Hashable a => Hashable (Maybe a) | |
At (Maybe a) | |
Ixed (Maybe a) | |
Pretty a => Pretty (Maybe a) | Ignore
|
Serialise a => Serialise (Maybe a) | Since: serialise-0.2.0.0 |
DecodeTOML a => DecodeTOML (Maybe a) | Since TOML doesn't support literal NULLs, this will only ever return |
Defined in TOML.Decode Methods tomlDecoder :: Decoder (Maybe a) Source # | |
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 Rep1 Maybe | Since: base-4.6.0.0 |
type StM Maybe a | |
Defined in Control.Monad.Trans.Control | |
type DemoteRep (Maybe a) | |
Defined in GHC.Generics | |
type Rep (Maybe a) | Since: base-4.6.0.0 |
Defined in GHC.Generics | |
data Sing (b :: Maybe a) | |
type Index (Maybe a) | |
Defined in Optics.At.Core | |
type IxKind (Maybe a) | |
Defined in Optics.At.Core | |
type IxValue (Maybe a) | |
Defined in Optics.At.Core |
class a ~# b => (a :: k) ~ (b :: k) infix 4 #
Lifted, homogeneous equality. By lifted, we mean that it
can be bogus (deferred type error). By homogeneous, the two
types a
and b
must have the same kinds.
Natural number
Invariant: numbers <= 0xffffffffffffffff use the NS
constructor
Instances
FromJSON Natural | |
FromJSONKey Natural | |
Defined in Data.Aeson.Types.FromJSON Methods | |
ToJSON Natural | |
ToJSONKey Natural | |
Defined in Data.Aeson.Types.ToJSON Methods | |
AMonoid Natural | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Additive.AMonoid | |
ASemigroup Natural | Since: algebra-simple-0.1 |
MGroup Natural | Since: algebra-simple-0.1 |
MMonoid Natural | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Multiplicative.MMonoid | |
MSemigroup Natural | Since: algebra-simple-0.1 |
Normed Natural | Since: algebra-simple-0.1 |
Semifield Natural | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semifield | |
Semiring Natural | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semiring | |
FromInteger Natural | WARNING: Partial Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Integer Methods afromInteger :: Integer -> Natural Source # | |
Enum Natural | Since: base-4.8.0.0 |
Num Natural | Note that Since: base-4.8.0.0 |
Read Natural | Since: base-4.8.0.0 |
Integral Natural | Since: base-4.8.0.0 |
Defined in GHC.Real | |
Real Natural | Since: base-4.8.0.0 |
Defined in GHC.Real Methods toRational :: Natural -> Rational # | |
Show Natural | Since: base-4.8.0.0 |
PrintfArg Natural | Since: base-4.8.0.0 |
Defined in Text.Printf | |
NFData Natural | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
Eq Natural | |
Ord Natural | |
Hashable Natural | |
Pretty Natural | |
UniformRange Natural | |
Defined in System.Random.Internal | |
Serialise Natural | Since: serialise-0.2.0.0 |
DecodeTOML Natural | |
Defined in TOML.Decode Methods | |
MSemiSpace TimeSpec Natural | Since: effects-time-0.1 |
MSpace TimeSpec Natural | Since: effects-time-0.1 |
Semimodule TimeSpec Natural | Since: effects-time-0.1 |
Defined in Effects.Time | |
SemivectorSpace TimeSpec Natural | Since: effects-time-0.1 |
Defined in Effects.Time | |
KnownNat n => HasResolution (n :: Nat) | For example, |
Defined in Data.Fixed Methods resolution :: p n -> Integer # | |
Lift Natural | |
LabelOptic "unSubPathData" A_Getter SubPathData SubPathData (NESeq (PathData Natural)) (NESeq (PathData Natural)) | Since: path-size-0.1 |
Defined in PathSize.Data.SubPathData.Internal Methods labelOptic :: Optic A_Getter NoIx SubPathData SubPathData (NESeq (PathData Natural)) (NESeq (PathData Natural)) Source # | |
AMonoid (Ratio Natural) | Since: algebra-simple-0.1 |
ASemigroup (Ratio Natural) | Since: algebra-simple-0.1 |
MGroup (Ratio Natural) | Since: algebra-simple-0.1 |
MMonoid (Ratio Natural) | Since: algebra-simple-0.1 |
MSemigroup (Ratio Natural) | Since: algebra-simple-0.1 |
Normed (Ratio Natural) | Since: algebra-simple-0.1 |
Semifield (Ratio Natural) | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semifield | |
Semiring (Ratio Natural) | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semiring | |
FromInteger (Ratio Natural) | WARNING: Partial Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Integer | |
FromRational (Ratio Natural) | WARNING: Partial Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Rational | |
type BaseFormatter Natural | |
Defined in Data.Bytes.Formatting.Base | |
type Compare (a :: Natural) (b :: Natural) | |
Defined in Data.Type.Ord |
Arbitrary precision integers. In contrast with fixed-size integral types
such as Int
, the Integer
type represents the entire infinite range of
integers.
Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
If the value is small (fit into an Int
), IS
constructor is used.
Otherwise Integer
and IN
constructors are used to store a BigNat
representing respectively the positive or the negative value magnitude.
Invariant: Integer
and IN
are used iff value doesn't fit in IS
Instances
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 | |
Defined in Data.Aeson.Types.FromJSON Methods | |
ToJSON Integer | |
ToJSONKey Integer | |
Defined in Data.Aeson.Types.ToJSON Methods | |
AMonoid Integer | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Additive.AMonoid | |
ASemigroup Integer | Since: algebra-simple-0.1 |
MGroup Integer | Since: algebra-simple-0.1 |
MMonoid Integer | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Multiplicative.MMonoid | |
MSemigroup Integer | Since: algebra-simple-0.1 |
Normed Integer | Since: algebra-simple-0.1 |
Semifield Integer | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semifield | |
Semiring Integer | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semiring | |
FromInteger Integer | Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Integer Methods afromInteger :: Integer -> Integer Source # | |
Pretty Integer | |
Enum Integer | Since: base-2.1 |
Num Integer | Since: base-2.1 |
Read Integer | Since: base-2.1 |
Integral Integer | Since: base-2.0.1 |
Defined in GHC.Real | |
Real Integer | Since: base-2.0.1 |
Defined in GHC.Real Methods toRational :: Integer -> Rational # | |
Show Integer | Since: base-2.1 |
PrintfArg Integer | Since: base-2.1 |
Defined in Text.Printf | |
NFData Integer | |
Defined in Control.DeepSeq | |
ToLogStr Integer | Since: fast-logger-2.4.14 |
Eq Integer | |
Ord Integer | |
Hashable Integer | |
Pretty Integer |
|
UniformRange Integer | |
Defined in System.Random.Internal | |
Serialise Integer | Since: serialise-0.2.0.0 |
DecodeTOML Integer | |
Defined in TOML.Decode Methods | |
Lift Integer | |
AMonoid (Ratio Integer) | Since: algebra-simple-0.1 |
ASemigroup (Ratio Integer) | Since: algebra-simple-0.1 |
MGroup (Ratio Integer) | Since: algebra-simple-0.1 |
MMonoid (Ratio Integer) | Since: algebra-simple-0.1 |
MSemigroup (Ratio Integer) | Since: algebra-simple-0.1 |
Normed (Ratio Integer) | Since: algebra-simple-0.1 |
Semifield (Ratio Integer) | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semifield | |
Semiring (Ratio Integer) | Since: algebra-simple-0.1 |
Defined in Numeric.Algebra.Semiring | |
FromInteger (Ratio Integer) | Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Integer | |
FromRational (Ratio Integer) | Since: algebra-simple-0.1 |
Defined in Numeric.Literal.Rational | |
type BaseFormatter Integer | |
Defined in Data.Bytes.Formatting.Base |
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)"
.
Methods
Instances
The Bounded
class is used to name the upper and lower limits of a
type. Ord
is not a superclass of Bounded
since types that are not
totally ordered may also have upper and lower bounds.
The Bounded
class may be derived for any enumeration type;
minBound
is the first constructor listed in the data
declaration
and maxBound
is the last.
Bounded
may also be derived for single-constructor datatypes whose
constituent types are in Bounded
.
Instances
Class Enum
defines operations on sequentially ordered types.
The enumFrom
... methods are used in Haskell's translation of
arithmetic sequences.
Instances of Enum
may be derived for any enumeration type (types
whose constructors have no fields). The nullary constructors are
assumed to be numbered left-to-right by fromEnum
from 0
through n-1
.
See Chapter 10 of the Haskell Report for more details.
For any type that is an instance of class Bounded
as well as Enum
,
the following should hold:
- The calls
andsucc
maxBound
should result in a runtime error.pred
minBound
fromEnum
andtoEnum
should give a runtime error if the result value is not representable in the result type. For example,
is an error.toEnum
7 ::Bool
enumFrom
andenumFromThen
should be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound enumFromThen x y = enumFromThenTo x y bound where bound | fromEnum y >= fromEnum x = maxBound | otherwise = minBound
Instances
class (Real a, Enum a) => Integral a where #
Integral numbers, supporting integer division.
The Haskell Report defines no laws for Integral
. However, Integral
instances are customarily expected to define a Euclidean domain and have the
following properties for the div
/mod
and quot
/rem
pairs, given
suitable Euclidean functions f
and g
:
x
=y * quot x y + rem x y
withrem x y
=fromInteger 0
org (rem x y)
<g y
x
=y * div x y + mod x y
withmod x y
=fromInteger 0
orf (mod x y)
<f y
An example of a suitable Euclidean function, for Integer
's instance, is
abs
.
In addition, toInteger
should be total, and fromInteger
should be a left
inverse for it, i.e. fromInteger (toInteger i) = i
.
Methods
integer division truncated toward negative infinity
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base
.
Instances
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
There is really only one way to "perform" an I/O action: bind it to
Main.main
in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO
monad and called
at some point, directly or indirectly, from Main.main
.
IO
is a monad, so IO
actions can be combined using either the do-notation
or the >>
and >>=
operations from the Monad
class.
Instances
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.
Ord
, as defined by the Haskell report, implements a total order and has the
following properties:
- Comparability
x <= y || y <= x
=True
- Transitivity
- if
x <= y && y <= z
=True
, thenx <= z
=True
- Reflexivity
x <= x
=True
- Antisymmetry
- if
x <= y && y <= x
=True
, thenx == y
=True
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.
Methods
compare :: a -> a -> Ordering #
(<) :: a -> a -> Bool infix 4 #
(<=) :: a -> a -> Bool infix 4 #
(>) :: a -> a -> Bool infix 4 #
Instances
type Constraint = CONSTRAINT LiftedRep #
The kind of lifted constraints
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, instances are
encouraged to follow these properties:
Instances
class Semigroup a => Monoid a where #
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:
- Right identity
x
<>
mempty
= x- Left identity
mempty
<>
x = x- Associativity
x
(<>
(y<>
z) = (x<>
y)<>
zSemigroup
law)- Concatenation
mconcat
=foldr
(<>
)mempty
You can alternatively define mconcat
instead of mempty
, in which case the
laws are:
- Unit
mconcat
(pure
x) = x- Multiplication
mconcat
(join
xss) =mconcat
(fmap
mconcat
xss)- Subclass
mconcat
(toList
xs) =sconcat
xs
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
NOTE: Semigroup
is a superclass of Monoid
since base-4.11.0.0.
Methods
Identity of mappend
>>>
"Hello world" <> mempty
"Hello world"
Fold a list using the monoid.
For most types, the default definition for mconcat
will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.
>>>
mconcat ["Hello", " ", "Haskell", "!"]
"Hello Haskell!"
Instances
Monoid Series | |
Monoid Key | |
Monoid Doc | |
Monoid More | |
Monoid ByteArray | Since: base-4.17.0.0 |
Monoid All | Since: base-2.1 |
Monoid Any | Since: base-2.1 |
Monoid Builder | |
Monoid ByteString | |
Defined in Data.ByteString.Internal.Type Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
Monoid ByteString | |
Defined in Data.ByteString.Lazy.Internal Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
Monoid ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods mappend :: ShortByteString -> ShortByteString -> ShortByteString # mconcat :: [ShortByteString] -> ShortByteString # | |
Monoid Encoding | Since: cborg-0.2.0.0 |
Monoid DirectorySizes Source # | |
Defined in Charon.Backend.Fdo.DirectorySizes Methods mappend :: DirectorySizes -> DirectorySizes -> DirectorySizes # mconcat :: [DirectorySizes] -> DirectorySizes # | |
Monoid IntSet | |
Monoid Namespace | Since: effects-logger-ns-0.1 |
Monoid LogStr | |
Monoid OsString | "String-Concatenation" for |
Monoid PosixString | |
Defined in System.OsString.Internal.Types Methods mempty :: PosixString # mappend :: PosixString -> PosixString -> PosixString # mconcat :: [PosixString] -> PosixString # | |
Monoid WindowsString | |
Defined in System.OsString.Internal.Types Methods mempty :: WindowsString # mappend :: WindowsString -> WindowsString -> WindowsString # mconcat :: [WindowsString] -> WindowsString # | |
Monoid Ordering | Since: base-2.1 |
Monoid PrefsMod | |
Monoid Completer | |
Monoid ParseError | |
Defined in Options.Applicative.Types Methods mempty :: ParseError # mappend :: ParseError -> ParseError -> ParseError # mconcat :: [ParseError] -> ParseError # | |
Monoid Doc | |
Monoid ShortText | |
Monoid Query | |
Monoid () | Since: base-2.1 |
Monoid (KeyMap v) | |
Monoid (IResult a) | |
Monoid (Parser a) | |
Monoid (Result a) | |
(Semigroup a, Monoid a) => Monoid (Concurrently a) | Since: async-2.1.0 |
Defined in Control.Concurrent.Async Methods mempty :: Concurrently a # mappend :: Concurrently a -> Concurrently a -> Concurrently a # mconcat :: [Concurrently a] -> Concurrently a # | |
Monoid a => Monoid (Identity a) | Since: base-4.9.0.0 |
Ord a => Monoid (Max a) | Since: base-4.8.0.0 |
Ord a => Monoid (Min a) | Since: base-4.8.0.0 |
Monoid (First a) | Since: base-2.1 |
Monoid (Last a) | Since: base-2.1 |
Monoid a => Monoid (Down a) | Since: base-4.11.0.0 |
(Ord a, Bounded a) => Monoid (Max a) | Since: base-4.9.0.0 |
(Ord a, Bounded a) => Monoid (Min a) | Since: base-4.9.0.0 |
Monoid m => Monoid (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods mempty :: WrappedMonoid m # mappend :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # mconcat :: [WrappedMonoid m] -> WrappedMonoid m # | |
Monoid a => Monoid (Dual a) | Since: base-2.1 |
Monoid (Endo a) | Since: base-2.1 |
Num a => Monoid (Product a) | Since: base-2.1 |
Num a => Monoid (Sum a) | Since: base-2.1 |
(Generic a, Monoid (Rep a ())) => Monoid (Generically a) | Since: base-4.17.0.0 |
Defined in GHC.Generics Methods mempty :: Generically a # mappend :: Generically a -> Generically a -> Generically a # mconcat :: [Generically a] -> Generically a # | |
Monoid p => Monoid (Par1 p) | Since: base-4.12.0.0 |
Hashable a => Monoid (UniqueSeq a) Source # | |
Monoid (IntMap a) | |
Monoid (Seq a) | |
Monoid (MergeSet a) | |
Ord a => Monoid (Set a) | |
Monoid (DList a) | |
Monoid a => Monoid (IO a) | Since: base-4.9.0.0 |
Ord t => Monoid (Hints t) | |
Monoid (InfoMod a) | |
Monoid (DefaultProp a) | |
Defined in Options.Applicative.Builder.Internal Methods mempty :: DefaultProp a # mappend :: DefaultProp a -> DefaultProp a -> DefaultProp a # mconcat :: [DefaultProp a] -> DefaultProp a # | |
Semigroup a => Monoid (Chunk a) | |
Monoid (Doc a) | |
Monoid (Doc ann) |
|
Monoid (Array a) | |
Monoid (PrimArray a) | Since: primitive-0.6.4.0 |
Monoid (SmallArray a) | |
Defined in Data.Primitive.SmallArray Methods mempty :: SmallArray a # mappend :: SmallArray a -> SmallArray a -> SmallArray a # mconcat :: [SmallArray a] -> SmallArray a # | |
Semigroup a => Monoid (Maybe a) | |
Monoid a => Monoid (Q a) | Since: template-haskell-2.17.0.0 |
(Hashable a, Eq a) => Monoid (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
Monoid (Vector a) | |
Prim a => Monoid (Vector a) | |
Storable a => Monoid (Vector a) | |
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
Monoid a => Monoid (a) | Since: base-4.15 |
Monoid [a] | Since: base-2.1 |
Monoid (Parser i a) | |
Monoid (Proxy s) | Since: base-4.7.0.0 |
Monoid (U1 p) | Since: base-4.12.0.0 |
Monoid a => Monoid (ST s a) | Since: base-4.11.0.0 |
Ord k => Monoid (Map k v) | |
(MonadAsync m, Monoid a) => Monoid (Concurrently m a) | Since: effects-async-0.1 |
Defined in Effects.Concurrent.Async Methods mempty :: Concurrently m a # mappend :: Concurrently m a -> Concurrently m a -> Concurrently m a # mconcat :: [Concurrently m a] -> Concurrently m a # | |
(Stream s, Ord e) => Monoid (ParseError s e) | |
Defined in Text.Megaparsec.Error Methods mempty :: ParseError s e # mappend :: ParseError s e -> ParseError s e -> ParseError s e # mconcat :: [ParseError s e] -> ParseError s e # | |
(Applicative m, Monoid a) => Monoid (LoggingT m a) | |
(Applicative m, Monoid a) => Monoid (NoLoggingT m a) | |
Defined in Control.Monad.Logger Methods mempty :: NoLoggingT m a # mappend :: NoLoggingT m a -> NoLoggingT m a -> NoLoggingT m a # mconcat :: [NoLoggingT m a] -> NoLoggingT m a # | |
(Applicative m, Monoid a) => Monoid (WriterLoggingT m a) | |
Defined in Control.Monad.Logger Methods mempty :: WriterLoggingT m a # mappend :: WriterLoggingT m a -> WriterLoggingT m a -> WriterLoggingT m a # mconcat :: [WriterLoggingT m a] -> WriterLoggingT m a # | |
Monoid (Mod f a) | |
(Monoid a, Monoid b) => Monoid (Pair a b) | |
(Monoid a, MonadUnliftIO m) => Monoid (Conc m a) | Since: unliftio-0.2.9.0 |
(Semigroup a, Monoid a, MonadUnliftIO m) => Monoid (Concurrently m a) | Since: unliftio-0.1.0.0 |
Defined in UnliftIO.Internals.Async Methods mempty :: Concurrently m a # mappend :: Concurrently m a -> Concurrently m a -> Concurrently m a # mconcat :: [Concurrently m a] -> Concurrently m a # | |
(Eq k, Hashable k) => Monoid (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
Monoid (Parser' e a) | |
(Monoid a, Monoid b) => Monoid (a, b) | Since: base-2.1 |
Monoid b => Monoid (a -> b) | Since: base-2.1 |
Monoid a => Monoid (Const a b) | Since: base-4.9.0.0 |
(Applicative f, Monoid a) => Monoid (Ap f a) | Since: base-4.12.0.0 |
Alternative f => Monoid (Alt f a) | Since: base-4.8.0.0 |
Monoid (f p) => Monoid (Rec1 f p) | Since: base-4.12.0.0 |
(Semigroup a, Monoid a) => Monoid (Tagged s a) | |
Monoid a => Monoid (Constant a b) | |
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: base-2.1 |
(Monoid (f a), Monoid (g a)) => Monoid (Product f g a) | Since: base-4.16.0.0 |
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | Since: base-4.12.0.0 |
Monoid c => Monoid (K1 i c p) | Since: base-4.12.0.0 |
Monad m => Monoid (ConduitT i o m ()) | |
(Stream s, Monoid a) => Monoid (ParsecT e s m a) | Since: megaparsec-5.3.0 |
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: base-2.1 |
Monoid (f (g a)) => Monoid (Compose f g a) | Since: base-4.16.0.0 |
Monoid (f (g p)) => Monoid ((f :.: g) p) | Since: base-4.12.0.0 |
Monoid (f p) => Monoid (M1 i c f p) | Since: base-4.12.0.0 |
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: base-2.1 |
Monad m => Monoid (Pipe l i o u m ()) | |
The class of semigroups (types with an associative binary operation).
Instances should satisfy the following:
You can alternatively define sconcat
instead of (<>
), in which case the
laws are:
Since: base-4.9.0.0
Instances
class Functor f => Applicative (f :: Type -> Type) where #
A functor with application, providing operations to
A minimal complete definition must include implementations of pure
and of either <*>
or liftA2
. If it defines both, then they must behave
the same as their default definitions:
(<*>
) =liftA2
id
liftA2
f x y = f<$>
x<*>
y
Further, any definition must satisfy the following:
- Identity
pure
id
<*>
v = v- Composition
pure
(.)<*>
u<*>
v<*>
w = u<*>
(v<*>
w)- Homomorphism
pure
f<*>
pure
x =pure
(f x)- Interchange
u
<*>
pure
y =pure
($
y)<*>
u
The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:
As a consequence of these laws, the Functor
instance for f
will satisfy
It may be useful to note that supposing
forall x y. p (q x y) = f x . g y
it follows from the above that
liftA2
p (liftA2
q u v) =liftA2
f u .liftA2
g v
If f
is also a Monad
, it should satisfy
(which implies that pure
and <*>
satisfy the applicative functor laws).
Methods
Lift a value.
(<*>) :: f (a -> b) -> f a -> f b infixl 4 #
Sequential application.
A few functors support an implementation of <*>
that is more
efficient than the default one.
Example
Used in combination with (
, <$>
)(
can be used to build a record.<*>
)
>>>
data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
>>>
produceFoo :: Applicative f => f Foo
>>>
produceBar :: Applicative f => f Bar
>>>
produceBaz :: Applicative f => f Baz
>>>
mkState :: Applicative f => f MyState
>>>
mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz
liftA2 :: (a -> b -> c) -> f a -> f b -> f c #
Lift a binary function to actions.
Some functors support an implementation of liftA2
that is more
efficient than the default one. In particular, if fmap
is an
expensive operation, it is likely better to use liftA2
than to
fmap
over the structure and then use <*>
.
This became a typeclass method in 4.10.0.0. Prior to that, it was
a function defined in terms of <*>
and fmap
.
Example
>>>
liftA2 (,) (Just 3) (Just 5)
Just (3,5)
(*>) :: f a -> f b -> f b infixl 4 #
Sequence actions, discarding the value of the first argument.
Examples
If used in conjunction with the Applicative instance for Maybe
,
you can chain Maybe computations, with a possible "early return"
in case of Nothing
.
>>>
Just 2 *> Just 3
Just 3
>>>
Nothing *> Just 3
Nothing
Of course a more interesting use case would be to have effectful computations instead of just returning pure values.
>>>
import Data.Char
>>>
import Text.ParserCombinators.ReadP
>>>
let p = string "my name is " *> munch1 isAlpha <* eof
>>>
readP_to_S p "my name is Simon"
[("Simon","")]
Instances
Applicative IResult | |
Applicative Parser | |
Applicative Result | |
Applicative Concurrently | |
Defined in Control.Concurrent.Async Methods pure :: a -> Concurrently a # (<*>) :: Concurrently (a -> b) -> Concurrently a -> Concurrently b # liftA2 :: (a -> b -> c) -> Concurrently a -> Concurrently b -> Concurrently c # (*>) :: Concurrently a -> Concurrently b -> Concurrently b # (<*) :: Concurrently a -> Concurrently b -> Concurrently a # | |
Applicative ZipList | f <$> ZipList xs1 <*> ... <*> ZipList xsN = ZipList (zipWithN f xs1 ... xsN) where (\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..]) = ZipList {getZipList = ["a5","b6b6","c7c7c7"]} Since: base-2.1 |
Applicative Complex | Since: base-4.9.0.0 |
Applicative Identity | Since: base-4.8.0.0 |
Applicative First | Since: base-4.8.0.0 |
Applicative Last | Since: base-4.8.0.0 |
Applicative Down | Since: base-4.11.0.0 |
Applicative First | Since: base-4.9.0.0 |
Applicative Last | Since: base-4.9.0.0 |
Applicative Max | Since: base-4.9.0.0 |
Applicative Min | Since: base-4.9.0.0 |
Applicative Dual | Since: base-4.8.0.0 |
Applicative Product | Since: base-4.8.0.0 |
Applicative Sum | Since: base-4.8.0.0 |
Applicative NonEmpty | Since: base-4.9.0.0 |
Applicative Par1 | Since: base-4.9.0.0 |
Applicative P | Since: base-4.5.0.0 |
Applicative ReadP | Since: base-4.6.0.0 |
Applicative Put | |
Applicative Seq | Since: containers-0.5.4 |
Applicative Tree | |
Applicative DNonEmpty | |
Defined in Data.DList.DNonEmpty.Internal | |
Applicative DList | |
Applicative ExceptionCS | Since: effects-exceptions-0.1 |
Defined in Effects.Exception Methods pure :: a -> ExceptionCS a # (<*>) :: ExceptionCS (a -> b) -> ExceptionCS a -> ExceptionCS b # liftA2 :: (a -> b -> c) -> ExceptionCS a -> ExceptionCS b -> ExceptionCS c # (*>) :: ExceptionCS a -> ExceptionCS b -> ExceptionCS b # (<*) :: ExceptionCS a -> ExceptionCS b -> ExceptionCS a # | |
Applicative IO | Since: base-2.1 |
Applicative NESeq | |
Applicative Chunk | |
Applicative Parser | |
Applicative ParserM | |
Applicative ParserResult | |
Defined in Options.Applicative.Types Methods pure :: a -> ParserResult a # (<*>) :: ParserResult (a -> b) -> ParserResult a -> ParserResult b # liftA2 :: (a -> b -> c) -> ParserResult a -> ParserResult b -> ParserResult c # (*>) :: ParserResult a -> ParserResult b -> ParserResult b # (<*) :: ParserResult a -> ParserResult b -> ParserResult a # | |
Applicative ReadM | |
Applicative Array | |
Applicative SmallArray | |
Defined in Data.Primitive.SmallArray Methods pure :: a -> SmallArray a # (<*>) :: SmallArray (a -> b) -> SmallArray a -> SmallArray b # liftA2 :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c # (*>) :: SmallArray a -> SmallArray b -> SmallArray b # (<*) :: SmallArray a -> SmallArray b -> SmallArray a # | |
Applicative Q | |
Applicative DecodeM | |
Applicative Decoder | |
Applicative Flat | |
Applicative FlatApp | |
Applicative Vector | |
Applicative Id | |
Applicative Maybe | Since: base-2.1 |
Applicative Solo | Since: base-4.15 |
Applicative List | Since: base-2.1 |
Applicative (Parser i) | |
Monad m => Applicative (WrappedMonad m) | Since: base-2.1 |
Defined in Control.Applicative Methods pure :: a -> WrappedMonad m a # (<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b # liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c # (*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # (<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a # | |
Arrow a => Applicative (ArrowMonad a) | Since: base-4.6.0.0 |
Defined in Control.Arrow Methods pure :: a0 -> ArrowMonad a a0 # (<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b # liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c # (*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b # (<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 # | |
Applicative (Either e) | Since: base-3.0 |
Applicative (StateL s) | Since: base-4.0 |
Applicative (StateR s) | Since: base-4.0 |
Applicative (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Applicative (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Applicative (ST s) | Since: base-4.4.0.0 |
Applicative (Decoder s) | Since: cborg-0.2.0.0 |
Applicative (IncrementalDecoder s) | |
Defined in Codec.CBOR.Read Methods pure :: a -> IncrementalDecoder s a # (<*>) :: IncrementalDecoder s (a -> b) -> IncrementalDecoder s a -> IncrementalDecoder s b # liftA2 :: (a -> b -> c) -> IncrementalDecoder s a -> IncrementalDecoder s b -> IncrementalDecoder s c # (*>) :: IncrementalDecoder s a -> IncrementalDecoder s b -> IncrementalDecoder s b # (<*) :: IncrementalDecoder s a -> IncrementalDecoder s b -> IncrementalDecoder s a # | |
Monad m => Applicative (ZipSource m) | |
Defined in Data.Conduit.Internal.Conduit | |
MonadAsync m => Applicative (Concurrently m) | Since: effects-async-0.1 |
Defined in Effects.Concurrent.Async Methods pure :: a -> Concurrently m a # (<*>) :: Concurrently m (a -> b) -> Concurrently m a -> Concurrently m b # liftA2 :: (a -> b -> c) -> Concurrently m a -> Concurrently m b -> Concurrently m c # (*>) :: Concurrently m a -> Concurrently m b -> Concurrently m b # (<*) :: Concurrently m a -> Concurrently m b -> Concurrently m a # | |
Applicative m => Applicative (LoggingT m) | |
Defined in Control.Monad.Logger | |
Applicative m => Applicative (NoLoggingT m) | |
Defined in Control.Monad.Logger Methods pure :: a -> NoLoggingT m a # (<*>) :: NoLoggingT m (a -> b) -> NoLoggingT m a -> NoLoggingT m b # liftA2 :: (a -> b -> c) -> NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m c # (*>) :: NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m b # (<*) :: NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m a # | |
Applicative m => Applicative (WriterLoggingT m) | |
Defined in Control.Monad.Logger Methods pure :: a -> WriterLoggingT m a # (<*>) :: WriterLoggingT m (a -> b) -> WriterLoggingT m a -> WriterLoggingT m b # liftA2 :: (a -> b -> c) -> WriterLoggingT m a -> WriterLoggingT m b -> WriterLoggingT m c # (*>) :: WriterLoggingT m a -> WriterLoggingT m b -> WriterLoggingT m b # (<*) :: WriterLoggingT m a -> WriterLoggingT m b -> WriterLoggingT m a # | |
Applicative m => Applicative (ResourceT m) | |
Defined in Control.Monad.Trans.Resource.Internal | |
Applicative (Bytes s) | Since: si-bytes-0.1 |
Semigroup a => Applicative (These a) | |
Semigroup a => Applicative (These a) | |
Applicative f => Applicative (Lift f) | A combination is |
(Functor m, Monad m) => Applicative (MaybeT m) | |
MonadUnliftIO m => Applicative (Conc m) | Since: unliftio-0.2.9.0 |
MonadUnliftIO m => Applicative (Concurrently m) | Since: unliftio-0.1.0.0 |
Defined in UnliftIO.Internals.Async Methods pure :: a -> Concurrently m a # (<*>) :: Concurrently m (a -> b) -> Concurrently m a -> Concurrently m b # liftA2 :: (a -> b -> c) -> Concurrently m a -> Concurrently m b -> Concurrently m c # (*>) :: Concurrently m a -> Concurrently m b -> Concurrently m b # (<*) :: Concurrently m a -> Concurrently m b -> Concurrently m a # | |
Applicative (Parser' e) | |
Monoid a => Applicative ((,) a) | For tuples, the ("hello ", (+15)) <*> ("world!", 2002) ("hello world!",2017) Since: base-2.1 |
Arrow a => Applicative (WrappedArrow a b) | Since: base-2.1 |
Defined in Control.Applicative Methods pure :: a0 -> WrappedArrow a b a0 # (<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c # (*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 # (<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |
Applicative m => Applicative (Kleisli m a) | Since: base-4.14.0.0 |
Defined in Control.Arrow | |
Monoid m => Applicative (Const m :: Type -> Type) | Since: base-2.0.1 |
Monad m => Applicative (StateT s m) | Since: base-4.18.0.0 |
Defined in Data.Functor.Utils | |
Applicative f => Applicative (Ap f) | Since: base-4.12.0.0 |
Applicative f => Applicative (Alt f) | Since: base-4.8.0.0 |
(Generic1 f, Applicative (Rep1 f)) => Applicative (Generically1 f) | Since: base-4.17.0.0 |
Defined in GHC.Generics Methods pure :: a -> Generically1 f a # (<*>) :: Generically1 f (a -> b) -> Generically1 f a -> Generically1 f b # liftA2 :: (a -> b -> c) -> Generically1 f a -> Generically1 f b -> Generically1 f c # (*>) :: Generically1 f a -> Generically1 f b -> Generically1 f b # (<*) :: Generically1 f a -> Generically1 f b -> Generically1 f a # | |
Applicative f => Applicative (Rec1 f) | Since: base-4.9.0.0 |
Biapplicative p => Applicative (Fix p) | |
Biapplicative p => Applicative (Join p) | |
Applicative m => Applicative (CharonT env m) Source # | |
Defined in Charon.Runner.CharonT Methods pure :: a -> CharonT env m a # (<*>) :: CharonT env m (a -> b) -> CharonT env m a -> CharonT env m b # liftA2 :: (a -> b -> c) -> CharonT env m a -> CharonT env m b -> CharonT env m c # (*>) :: CharonT env m a -> CharonT env m b -> CharonT env m b # (<*) :: CharonT env m a -> CharonT env m b -> CharonT env m a # | |
Monad m => Applicative (ZipSink i m) | |
Defined in Data.Conduit.Internal.Conduit | |
(Applicative f, Monad f) => Applicative (WhenMissing f x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMissing f x a # (<*>) :: WhenMissing f x (a -> b) -> WhenMissing f x a -> WhenMissing f x b # liftA2 :: (a -> b -> c) -> WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x c # (*>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b # (<*) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x a # | |
(Applicative (Rep p), Representable p) => Applicative (Prep p) | |
Applicative (Tagged s) | |
Applicative f => Applicative (Backwards f) | Apply |
Defined in Control.Applicative.Backwards | |
(Monoid w, Functor m, Monad m) => Applicative (AccumT w m) | |
Defined in Control.Monad.Trans.Accum | |
(Functor m, Monad m) => Applicative (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
Applicative m => Applicative (IdentityT m) | |
Defined in Control.Monad.Trans.Identity | |
Applicative m => Applicative (ReaderT r m) | |
Defined in Control.Monad.Trans.Reader | |
(Functor m, Monad m) => Applicative (SelectT r m) | |
Defined in Control.Monad.Trans.Select | |
(Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
(Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Strict | |
(Functor m, Monad m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.CPS | |
(Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Lazy | |
(Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Strict | |
Monoid a => Applicative (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant | |
Applicative f => Applicative (Reverse f) | Derived instance. |
(Monoid a, Monoid b) => Applicative ((,,) a b) | Since: base-4.14.0.0 |
(Applicative f, Applicative g) => Applicative (Product f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product | |
(Applicative f, Applicative g) => Applicative (f :*: g) | Since: base-4.9.0.0 |
Monoid c => Applicative (K1 i c :: Type -> Type) | Since: base-4.12.0.0 |
Applicative (ConduitT i o m) | |
Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ConduitT i o m a # (<*>) :: ConduitT i o m (a -> b) -> ConduitT i o m a -> ConduitT i o m b # liftA2 :: (a -> b -> c) -> ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m c # (*>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b # (<*) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m a # | |
Monad m => Applicative (ZipConduit i o m) | |
Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ZipConduit i o m a # (<*>) :: ZipConduit i o m (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b # liftA2 :: (a -> b -> c) -> ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m c # (*>) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m b # (<*) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m a # | |
(Monad f, Applicative f) => Applicative (WhenMatched f x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMatched f x y a # (<*>) :: WhenMatched f x y (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b # liftA2 :: (a -> b -> c) -> WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y c # (*>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b # (<*) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y a # | |
(Applicative f, Monad f) => Applicative (WhenMissing f k x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods pure :: a -> WhenMissing f k x a # (<*>) :: WhenMissing f k x (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b # liftA2 :: (a -> b -> c) -> WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x c # (*>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b # (<*) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x a # | |
Stream s => Applicative (ParsecT e s m) |
|
Defined in Text.Megaparsec.Internal Methods pure :: a -> ParsecT e s m a # (<*>) :: ParsecT e s m (a -> b) -> ParsecT e s m a -> ParsecT e s m b # liftA2 :: (a -> b -> c) -> ParsecT e s m a -> ParsecT e s m b -> ParsecT e s m c # (*>) :: ParsecT e s m a -> ParsecT e s m b -> ParsecT e s m b # (<*) :: ParsecT e s m a -> ParsecT e s m b -> ParsecT e s m a # | |
Applicative (ContT r m) | |
Defined in Control.Monad.Trans.Cont | |
(Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) | Since: base-4.14.0.0 |
Defined in GHC.Base | |
Applicative ((->) r) | Since: base-2.1 |
(Applicative f, Applicative g) => Applicative (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
(Applicative f, Applicative g) => Applicative (f :.: g) | Since: base-4.9.0.0 |
Applicative f => Applicative (M1 i c f) | Since: base-4.9.0.0 |
(Monad f, Applicative f) => Applicative (WhenMatched f k x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods pure :: a -> WhenMatched f k x y a # (<*>) :: WhenMatched f k x y (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b # liftA2 :: (a -> b -> c) -> WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y c # (*>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b # (<*) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y a # | |
(Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.CPS | |
(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Lazy | |
(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Strict | |
Monad m => Applicative (Pipe l i o u m) | |
Defined in Data.Conduit.Internal.Pipe Methods pure :: a -> Pipe l i o u m a # (<*>) :: Pipe l i o u m (a -> b) -> Pipe l i o u m a -> Pipe l i o u m b # liftA2 :: (a -> b -> c) -> Pipe l i o u m a -> Pipe l i o u m b -> Pipe l i o u m c # (*>) :: Pipe l i o u m a -> Pipe l i o u m b -> Pipe l i o u m b # (<*) :: Pipe l i o u m a -> Pipe l i o u m b -> Pipe l i o u m a # |
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.
See https://www.schoolofhaskell.com/user/edwardk/snippets/fmap or
https://github.com/quchen/articles/blob/master/second_functor_law.md
for an explanation.
Methods
fmap :: (a -> b) -> f a -> f b #
fmap
is used to apply a function of type (a -> b)
to a value of type f a
,
where f is a functor, to produce a value of type f b
.
Note that for any type constructor with more than one parameter (e.g., Either
),
only the last type parameter can be modified with fmap
(e.g., b
in `Either a b`).
Some type constructors with two parameters or more have a
instance that allows
both the last and the penultimate parameters to be mapped over.Bifunctor
Examples
Convert from a
to a Maybe
IntMaybe String
using show
:
>>>
fmap show Nothing
Nothing>>>
fmap show (Just 3)
Just "3"
Convert from an
to an
Either
Int IntEither Int String
using show
:
>>>
fmap show (Left 17)
Left 17>>>
fmap show (Right 17)
Right "17"
Double each element of a list:
>>>
fmap (*2) [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
fmap even (2,2)
(2,True)
It may seem surprising that the function is only applied to the last element of the tuple
compared to the list example above which applies it to every element in the list.
To understand, remember that tuples are type constructors with multiple type parameters:
a tuple of 3 elements (a,b,c)
can also be written (,,) a b c
and its Functor
instance
is defined for Functor ((,,) a b)
(i.e., only the third parameter is free to be mapped over
with fmap
).
It explains why fmap
can be used with tuples containing values of different types as in the
following example:
>>>
fmap even ("hello", 1.0, 4)
("hello",1.0,True)
Instances
Functor KeyMap | |
Functor FromJSONKeyFunction | Only law abiding up to interpretation |
Defined in Data.Aeson.Types.FromJSON Methods fmap :: (a -> b) -> FromJSONKeyFunction a -> FromJSONKeyFunction b # (<$) :: a -> FromJSONKeyFunction b -> FromJSONKeyFunction a # | |
Functor IResult | |
Functor Parser | |
Functor Result | |
Functor Async | |
Functor Concurrently | |
Defined in Control.Concurrent.Async Methods fmap :: (a -> b) -> Concurrently a -> Concurrently b # (<$) :: a -> Concurrently b -> Concurrently a # | |
Functor ZipList | Since: base-2.1 |
Functor Handler | Since: base-4.6.0.0 |
Functor Complex | Since: base-4.9.0.0 |
Functor Identity | Since: base-4.8.0.0 |
Functor First | Since: base-4.8.0.0 |
Functor Last | Since: base-4.8.0.0 |
Functor Down | Since: base-4.11.0.0 |
Functor First | Since: base-4.9.0.0 |
Functor Last | Since: base-4.9.0.0 |
Functor Max | Since: base-4.9.0.0 |
Functor Min | Since: base-4.9.0.0 |
Functor Dual | Since: base-4.8.0.0 |
Functor Product | Since: base-4.8.0.0 |
Functor Sum | Since: base-4.8.0.0 |
Functor NonEmpty | Since: base-4.9.0.0 |
Functor Par1 | Since: base-4.9.0.0 |
Functor P | Since: base-4.8.0.0 |
Defined in Text.ParserCombinators.ReadP | |
Functor ReadP | Since: base-2.1 |
Functor Put | |
Functor Flush | |
Functor IntMap | |
Functor Digit | |
Functor Elem | |
Functor FingerTree | |
Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> FingerTree a -> FingerTree b # (<$) :: a -> FingerTree b -> FingerTree a # | |
Functor Node | |
Functor Seq | |
Functor ViewL | |
Functor ViewR | |
Functor Tree | |
Functor DNonEmpty | |
Functor DList | |
Functor ExceptionCS | Since: effects-exceptions-0.1 |
Defined in Effects.Exception Methods fmap :: (a -> b) -> ExceptionCS a -> ExceptionCS b # (<$) :: a -> ExceptionCS b -> ExceptionCS a # | |
Functor IO | Since: base-2.1 |
Functor ErrorFancy | |
Defined in Text.Megaparsec.Error Methods fmap :: (a -> b) -> ErrorFancy a -> ErrorFancy b # (<$) :: a -> ErrorFancy b -> ErrorFancy a # | |
Functor ErrorItem | |
Functor NESeq | |
Functor Chunk | |
Functor CReader | |
Functor OptReader | |
Functor Option | |
Functor Parser | |
Functor ParserFailure | |
Defined in Options.Applicative.Types Methods fmap :: (a -> b) -> ParserFailure a -> ParserFailure b # (<$) :: a -> ParserFailure b -> ParserFailure a # | |
Functor ParserInfo | |
Defined in Options.Applicative.Types Methods fmap :: (a -> b) -> ParserInfo a -> ParserInfo b # (<$) :: a -> ParserInfo b -> ParserInfo a # | |
Functor ParserM | |
Functor ParserResult | |
Defined in Options.Applicative.Types Methods fmap :: (a -> b) -> ParserResult a -> ParserResult b # (<$) :: a -> ParserResult b -> ParserResult a # | |
Functor ReadM | |
Functor PathSizeResult | Since: path-size-0.1 |
Defined in PathSize.Data.PathSizeResult Methods fmap :: (a -> b) -> PathSizeResult a -> PathSizeResult b # (<$) :: a -> PathSizeResult b -> PathSizeResult a # | |
Functor AnnotDetails | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods fmap :: (a -> b) -> AnnotDetails a -> AnnotDetails b # (<$) :: a -> AnnotDetails b -> AnnotDetails a # | |
Functor Doc | |
Functor Span | |
Functor Doc | Alter the document’s annotations. This instance makes |
Functor FlattenResult | |
Defined in Prettyprinter.Internal | |
Functor SimpleDocStream | Alter the document’s annotations. This instance makes |
Defined in Prettyprinter.Internal Methods fmap :: (a -> b) -> SimpleDocStream a -> SimpleDocStream b # (<$) :: a -> SimpleDocStream b -> SimpleDocStream a # | |
Functor Array | |
Functor SmallArray | |
Defined in Data.Primitive.SmallArray Methods fmap :: (a -> b) -> SmallArray a -> SmallArray b # (<$) :: a -> SmallArray b -> SmallArray a # | |
Functor SomeSize | Since: si-bytes-0.1 |
Functor Maybe | |
Functor Q | |
Functor TyVarBndr | |
Functor Window | |
Functor DecodeM | |
Functor Decoder | |
Functor Flat | |
Functor FlatApp | |
Functor Vector | |
Functor Id | |
Functor Maybe | Since: base-2.1 |
Functor Solo | Since: base-4.15 |
Functor List | Since: base-2.1 |
Functor (IResult i) | |
Defined in Data.Attoparsec.Internal.Types | |
Functor (Parser i) | |
Defined in Data.Attoparsec.Internal.Types | |
Monad m => Functor (WrappedMonad m) | Since: base-2.1 |
Defined in Control.Applicative Methods 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 Methods fmap :: (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b # (<$) :: a0 -> ArrowMonad a b -> ArrowMonad a a0 # | |
Functor (Either a) | Since: base-3.0 |
Functor (StateL s) | Since: base-4.0 |
Defined in Data.Functor.Utils | |
Functor (StateR s) | Since: base-4.0 |
Defined in Data.Functor.Utils | |
Functor (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Functor (Arg a) | Since: base-4.9.0.0 |
Functor (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor (ST s) | Since: base-2.1 |
Functor (Decoder s) | Since: cborg-0.2.0.0 |
Functor (IncrementalDecoder s) | |
Defined in Codec.CBOR.Read | |
Monad m => Functor (ZipSource m) | |
Functor (Map k) | |
Functor m => Functor (Concurrently m) | Since: effects-async-0.1 |
Defined in Effects.Concurrent.Async Methods fmap :: (a -> b) -> Concurrently m a -> Concurrently m b # (<$) :: a -> Concurrently m b -> Concurrently m a # | |
Monad m => Functor (Handler m) | |
Functor m => Functor (LoggingT m) | |
Functor m => Functor (NoLoggingT m) | |
Defined in Control.Monad.Logger Methods fmap :: (a -> b) -> NoLoggingT m a -> NoLoggingT m b # (<$) :: a -> NoLoggingT m b -> NoLoggingT m a # | |
Functor m => Functor (WriterLoggingT m) | |
Defined in Control.Monad.Logger Methods fmap :: (a -> b) -> WriterLoggingT m a -> WriterLoggingT m b # (<$) :: a -> WriterLoggingT m b -> WriterLoggingT m a # | |
Functor m => Functor (ResourceT m) | |
Functor (Bytes s) | Since: si-bytes-0.1 |
Functor (Either a) | |
Functor (These a) | |
Functor (Pair e) | |
Functor (These a) | |
Functor f => Functor (Lift f) | |
Functor m => Functor (MaybeT m) | |
Functor m => Functor (Conc m) | |
Monad m => Functor (Concurrently m) | Since: unliftio-0.1.0.0 |
Defined in UnliftIO.Internals.Async Methods fmap :: (a -> b) -> Concurrently m a -> Concurrently m b # (<$) :: a -> Concurrently m b -> Concurrently m a # | |
Functor (HashMap k) | |
Functor (Parser' e) | |
Defined in URI.ByteString.Internal | |
Functor ((,) a) | Since: base-2.1 |
Arrow a => Functor (WrappedArrow a b) | Since: base-2.1 |
Defined in Control.Applicative Methods 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 |
Monad m => Functor (StateT s m) | Since: base-4.18.0.0 |
Defined in Data.Functor.Utils | |
Functor f => Functor (Ap f) | Since: base-4.12.0.0 |
Functor f => Functor (Alt f) | Since: base-4.8.0.0 |
(Generic1 f, Functor (Rep1 f)) => Functor (Generically1 f) | Since: base-4.17.0.0 |
Defined in GHC.Generics Methods fmap :: (a -> b) -> Generically1 f a -> Generically1 f b # (<$) :: a -> Generically1 f b -> Generically1 f a # | |
Functor f => Functor (Rec1 f) | Since: base-4.9.0.0 |
Functor (URec (Ptr ()) :: Type -> Type) | 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 |
Bifunctor p => Functor (Fix p) | |
Bifunctor p => Functor (Join p) | |
Functor m => Functor (CharonT env m) Source # | |
Monad m => Functor (ZipSink i m) | |
(Applicative f, Monad f) => Functor (WhenMissing f x) | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods fmap :: (a -> b) -> WhenMissing f x a -> WhenMissing f x b # (<$) :: a -> WhenMissing f x b -> WhenMissing f x a # | |
Functor (Context a b) | |
Functor (Tagged i a) | |
Profunctor p => Functor (Coprep p) | |
Profunctor p => Functor (Prep p) | |
Functor (Tagged s) | |
(Functor f, Functor g) => Functor (These1 f g) | |
Functor f => Functor (Backwards f) | Derived instance. |
Functor m => Functor (AccumT w m) | |
Functor m => Functor (ExceptT e m) | |
Functor m => Functor (IdentityT m) | |
Functor m => Functor (ReaderT r m) | |
Functor m => Functor (SelectT r m) | |
Functor m => Functor (StateT s m) | |
Functor m => Functor (StateT s m) | |
Functor m => Functor (WriterT w m) | |
Functor m => Functor (WriterT w m) | |
Functor m => Functor (WriterT w m) | |
Functor (Constant a :: Type -> Type) | |
Functor f => Functor (Reverse f) | Derived instance. |
Monad m => Functor (Bundle m v) | |
Functor ((,,) a b) | 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 g) => Functor (f :*: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :+: g) | Since: base-4.9.0.0 |
Functor (K1 i c :: Type -> Type) | Since: base-4.9.0.0 |
Functor (ConduitT i o m) | |
Functor (ZipConduit i o m) | |
Defined in Data.Conduit.Internal.Conduit Methods fmap :: (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b # (<$) :: a -> ZipConduit i o m b -> ZipConduit i o m a # | |
Functor f => Functor (WhenMatched f x y) | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods 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 Methods 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 (ParsecT e s m) | |
Functor (ContT r m) | |
Functor ((,,,) a b c) | Since: base-4.14.0.0 |
Functor ((->) r) | Since: base-2.1 |
(Functor f, Functor g) => Functor (Compose f g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :.: g) | Since: base-4.9.0.0 |
Functor f => Functor (M1 i c f) | Since: base-4.9.0.0 |
Functor (Clown f a :: Type -> Type) | |
Bifunctor p => Functor (Flip p a) | |
Functor g => Functor (Joker g a) | |
Bifunctor p => Functor (WrappedBifunctor p a) | |
Defined in Data.Bifunctor.Wrapped Methods fmap :: (a0 -> b) -> WrappedBifunctor p a a0 -> WrappedBifunctor p a b # (<$) :: a0 -> WrappedBifunctor p a b -> WrappedBifunctor p a a0 # | |
Functor f => Functor (WhenMatched f k x y) | Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods 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 (Market a b i s) | |
Functor m => Functor (RWST r w s m) | |
Functor m => Functor (RWST r w s m) | |
Functor m => Functor (RWST r w s m) | |
Functor ((,,,,) a b c d) | Since: base-4.18.0.0 |
(Functor (f a), Functor (g a)) => Functor (Product f g a) | |
(Functor (f a), Functor (g a)) => Functor (Sum f g a) | |
Monad m => Functor (Pipe l i o u m) | |
Functor ((,,,,,) a b c d e) | Since: base-4.18.0.0 |
(Functor f, Bifunctor p) => Functor (Tannen f p a) | |
Profunctor p => Functor (Procompose p q a) | |
Defined in Data.Profunctor.Composition Methods fmap :: (a0 -> b) -> Procompose p q a a0 -> Procompose p q a b # (<$) :: a0 -> Procompose p q a b -> Procompose p q a a0 # | |
Profunctor p => Functor (Rift p q a) | |
Functor ((,,,,,,) a b c d e f) | Since: base-4.18.0.0 |
(Bifunctor p, Functor g) => Functor (Biff p f g a) | |
class Applicative m => Monad (m :: Type -> Type) where #
The Monad
class defines the basic operations over a monad,
a concept from a branch of mathematics known as category theory.
From the perspective of a Haskell programmer, however, it is best to
think of a monad as an abstract datatype of actions.
Haskell's do
expressions provide a convenient syntax for writing
monadic expressions.
Instances of Monad
should satisfy the following:
- Left identity
return
a>>=
k = k a- Right identity
m
>>=
return
= m- Associativity
m
>>=
(\x -> k x>>=
h) = (m>>=
k)>>=
h
Furthermore, the Monad
and Applicative
operations should relate as follows:
The above laws imply:
and that pure
and (<*>
) satisfy the applicative functor laws.
The instances of Monad
for lists, Maybe
and IO
defined in the Prelude satisfy these laws.
Methods
(>>=) :: m a -> (a -> m b) -> m b infixl 1 #
Sequentially compose two actions, passing any value produced by the first as an argument to the second.
'as
' can be understood as the >>=
bsdo
expression
do a <- as bs a
Instances
Monad IResult | |
Monad Parser | |
Monad Result | |
Monad Complex | Since: base-4.9.0.0 |
Monad Identity | Since: base-4.8.0.0 |
Monad First | Since: base-4.8.0.0 |
Monad Last | Since: base-4.8.0.0 |
Monad Down | Since: base-4.11.0.0 |
Monad First | Since: base-4.9.0.0 |
Monad Last | Since: base-4.9.0.0 |
Monad Max | Since: base-4.9.0.0 |
Monad Min | Since: base-4.9.0.0 |
Monad Dual | Since: base-4.8.0.0 |
Monad Product | Since: base-4.8.0.0 |
Monad Sum | Since: base-4.8.0.0 |
Monad NonEmpty | Since: base-4.9.0.0 |
Monad Par1 | Since: base-4.9.0.0 |
Monad P | Since: base-2.1 |
Monad ReadP | Since: base-2.1 |
Monad Put | |
Monad Seq | |
Monad Tree | |
Monad DNonEmpty | |
Monad DList | |
Monad ExceptionCS | Since: effects-exceptions-0.1 |
Defined in Effects.Exception Methods (>>=) :: ExceptionCS a -> (a -> ExceptionCS b) -> ExceptionCS b # (>>) :: ExceptionCS a -> ExceptionCS b -> ExceptionCS b # return :: a -> ExceptionCS a # | |
Monad IO | Since: base-2.1 |
Monad NESeq | |
Monad Chunk | |
Monad ParserM | |
Monad ParserResult | |
Defined in Options.Applicative.Types Methods (>>=) :: ParserResult a -> (a -> ParserResult b) -> ParserResult b # (>>) :: ParserResult a -> ParserResult b -> ParserResult b # return :: a -> ParserResult a # | |
Monad ReadM | |
Monad Array | |
Monad SmallArray | |
Defined in Data.Primitive.SmallArray Methods (>>=) :: SmallArray a -> (a -> SmallArray b) -> SmallArray b # (>>) :: SmallArray a -> SmallArray b -> SmallArray b # return :: a -> SmallArray a # | |
Monad Q | |
Monad DecodeM | |
Monad Decoder | |
Monad Vector | |
Monad Id | |
Monad Maybe | Since: base-2.1 |
Monad Solo | Since: base-4.15 |
Monad List | Since: base-2.1 |
Monad (Parser i) | |
Monad m => Monad (WrappedMonad m) | Since: base-4.7.0.0 |
Defined in Control.Applicative Methods (>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b # (>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # return :: a -> WrappedMonad m a # | |
ArrowApply a => Monad (ArrowMonad a) | Since: base-2.1 |
Defined in Control.Arrow Methods (>>=) :: ArrowMonad a a0 -> (a0 -> ArrowMonad a b) -> ArrowMonad a b # (>>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b # return :: a0 -> ArrowMonad a a0 # | |
Monad (Either e) | Since: base-4.4.0.0 |
Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Monad (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Monad (ST s) | Since: base-2.1 |
Monad (Decoder s) | Since: cborg-0.2.0.0 |
Monad (IncrementalDecoder s) | |
Monad m => Monad (LoggingT m) | |
Monad m => Monad (NoLoggingT m) | |
Defined in Control.Monad.Logger Methods (>>=) :: NoLoggingT m a -> (a -> NoLoggingT m b) -> NoLoggingT m b # (>>) :: NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m b # return :: a -> NoLoggingT m a # | |
Monad m => Monad (WriterLoggingT m) | |
Defined in Control.Monad.Logger Methods (>>=) :: WriterLoggingT m a -> (a -> WriterLoggingT m b) -> WriterLoggingT m b # (>>) :: WriterLoggingT m a -> WriterLoggingT m b -> WriterLoggingT m b # return :: a -> WriterLoggingT m a # | |
Monad m => Monad (ResourceT m) | |
Monad (Bytes s) | Since: si-bytes-0.1 |
Semigroup a => Monad (These a) | |
Semigroup a => Monad (These a) | |
Monad m => Monad (MaybeT m) | |
Monad (Parser' e) | |
Monoid a => Monad ((,) a) | Since: base-4.9.0.0 |
Monad m => Monad (Kleisli m a) | Since: base-4.14.0.0 |
Monad m => Monad (StateT s m) | Since: base-4.18.0.0 |
Monad f => Monad (Ap f) | Since: base-4.12.0.0 |
Monad f => Monad (Alt f) | Since: base-4.8.0.0 |
Monad f => Monad (Rec1 f) | Since: base-4.9.0.0 |
Monad m => Monad (CharonT env m) Source # | |
(Applicative f, Monad f) => Monad (WhenMissing f x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods (>>=) :: WhenMissing f x a -> (a -> WhenMissing f x b) -> WhenMissing f x b # (>>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b # return :: a -> WhenMissing f x a # | |
(Monad (Rep p), Representable p) => Monad (Prep p) | |
Monad (Tagged s) | |
(Monoid w, Functor m, Monad m) => Monad (AccumT w m) | |
Monad m => Monad (ExceptT e m) | |
Monad m => Monad (IdentityT m) | |
Monad m => Monad (ReaderT r m) | |
Monad m => Monad (SelectT r m) | |
Monad m => Monad (StateT s m) | |
Monad m => Monad (StateT s m) | |
Monad m => Monad (WriterT w m) | |
(Monoid w, Monad m) => Monad (WriterT w m) | |
(Monoid w, Monad m) => Monad (WriterT w m) | |
Monad m => Monad (Reverse m) | Derived instance. |
(Monoid a, Monoid b) => Monad ((,,) a b) | Since: base-4.14.0.0 |
(Monad f, Monad g) => Monad (Product f g) | Since: base-4.9.0.0 |
(Monad f, Monad g) => Monad (f :*: g) | Since: base-4.9.0.0 |
Monad (ConduitT i o m) | |
(Monad f, Applicative f) => Monad (WhenMatched f x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods (>>=) :: WhenMatched f x y a -> (a -> WhenMatched f x y b) -> WhenMatched f x y b # (>>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b # return :: a -> WhenMatched f x y a # | |
(Applicative f, Monad f) => Monad (WhenMissing f k x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods (>>=) :: WhenMissing f k x a -> (a -> WhenMissing f k x b) -> WhenMissing f k x b # (>>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b # return :: a -> WhenMissing f k x a # | |
Stream s => Monad (ParsecT e s m) |
|
Monad (ContT r m) | |
(Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) | Since: base-4.14.0.0 |
Monad ((->) r) | Since: base-2.1 |
Monad f => Monad (M1 i c f) | Since: base-4.9.0.0 |
(Monad f, Applicative f) => Monad (WhenMatched f k x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods (>>=) :: WhenMatched f k x y a -> (a -> WhenMatched f k x y b) -> WhenMatched f k x y b # (>>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b # return :: a -> WhenMatched f k x y a # | |
Monad m => Monad (RWST r w s m) | |
(Monoid w, Monad m) => Monad (RWST r w s m) | |
(Monoid w, Monad m) => Monad (RWST r w s m) | |
Monad m => Monad (Pipe l i o u m) | |
data ByteString #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
Instances
A map from keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
Instances
Bifoldable HashMap | Since: unordered-containers-0.2.11 |
Eq2 HashMap | |
Ord2 HashMap | |
Defined in Data.HashMap.Internal | |
Show2 HashMap | |
NFData2 HashMap | Since: unordered-containers-0.2.14.0 |
Defined in Data.HashMap.Internal | |
Hashable2 HashMap | |
(Lift k, Lift v) => Lift (HashMap k v :: Type) | Since: unordered-containers-0.2.17.0 |
(FromJSONKey k, Eq k, Hashable k) => FromJSON1 (HashMap k) | |
ToJSONKey k => ToJSON1 (HashMap k) | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> HashMap k a -> Value Source # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [HashMap k a] -> Value Source # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> HashMap k a -> Encoding Source # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [HashMap k a] -> Encoding Source # | |
Foldable (HashMap k) | |
Defined in Data.HashMap.Internal Methods fold :: Monoid m => HashMap k m -> m # foldMap :: Monoid m => (a -> m) -> HashMap k a -> m # foldMap' :: Monoid m => (a -> m) -> HashMap k a -> m # foldr :: (a -> b -> b) -> b -> HashMap k a -> b # foldr' :: (a -> b -> b) -> b -> HashMap k a -> b # foldl :: (b -> a -> b) -> b -> HashMap k a -> b # foldl' :: (b -> a -> b) -> b -> HashMap k a -> b # foldr1 :: (a -> a -> a) -> HashMap k a -> a # foldl1 :: (a -> a -> a) -> HashMap k a -> a # toList :: HashMap k a -> [a] # length :: HashMap k a -> Int # elem :: Eq a => a -> HashMap k a -> Bool # maximum :: Ord a => HashMap k a -> a # minimum :: Ord a => HashMap k a -> a # | |
Eq k => Eq1 (HashMap k) | |
Ord k => Ord1 (HashMap k) | |
Defined in Data.HashMap.Internal | |
(Eq k, Hashable k, Read k) => Read1 (HashMap k) | |
Defined in Data.HashMap.Internal | |
Show k => Show1 (HashMap k) | |
Traversable (HashMap k) | |
Defined in Data.HashMap.Internal | |
Functor (HashMap k) | |
NFData k => NFData1 (HashMap k) | Since: unordered-containers-0.2.14.0 |
Defined in Data.HashMap.Internal | |
Hashable k => Hashable1 (HashMap k) | |
Defined in Data.HashMap.Internal | |
(FromJSON v, FromJSONKey k, Eq k, Hashable k) => FromJSON (HashMap k v) | |
(ToJSON v, ToJSONKey k) => ToJSON (HashMap k v) | |
(Data k, Data v, Eq k, Hashable k) => Data (HashMap k v) | |
Defined in Data.HashMap.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashMap k v -> c (HashMap k v) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashMap k v) # toConstr :: HashMap k v -> Constr # dataTypeOf :: HashMap k v -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashMap k v)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashMap k v)) # gmapT :: (forall b. Data b => b -> b) -> HashMap k v -> HashMap k v # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r # gmapQ :: (forall d. Data d => d -> u) -> HashMap k v -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HashMap k v -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # | |
(Eq k, Hashable k) => Monoid (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
(Eq k, Hashable k) => Semigroup (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
(Eq k, Hashable k) => IsList (HashMap k v) | |
(Eq k, Hashable k, Read k, Read e) => Read (HashMap k e) | |
(Show k, Show v) => Show (HashMap k v) | |
(NFData k, NFData v) => NFData (HashMap k v) | |
Defined in Data.HashMap.Internal | |
(Eq k, Eq v) => Eq (HashMap k v) | Note that, in the presence of hash collisions, equal
In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals. |
(Ord k, Ord v) => Ord (HashMap k v) | The ordering is total and consistent with the |
Defined in Data.HashMap.Internal | |
(Hashable k, Hashable v) => Hashable (HashMap k v) | |
(Serialise k, Hashable k, Eq k, Serialise v) => Serialise (HashMap k v) | Since: serialise-0.2.0.0 |
type Item (HashMap k v) | |
Defined in Data.HashMap.Internal |
A space efficient, packed, unboxed Unicode text type.
Instances
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
class Eq a => Hashable a where Source #
The class of types that can be converted to a hash value.
Minimal implementation: hashWithSalt
.
Note: the hash is not guaranteed to be stable across library versions, operating systems or architectures. For stable hashing use named hashes: SHA256, CRC32 etc.
If you are looking for Hashable
instance in time
package,
check time-compat
Minimal complete definition
Nothing
Methods
hashWithSalt :: Int -> a -> Int infixl 0 Source #
Return a hash value for the argument, using the given salt.
The general contract of hashWithSalt
is:
- If two values are equal according to the
==
method, then applying thehashWithSalt
method on each of the two values must produce the same integer result if the same salt is used in each case. - It is not required that if two values are unequal
according to the
==
method, then applying thehashWithSalt
method on each of the two values must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal values may improve the performance of hashing-based data structures. - This method can be used to compute different hash values for
the same input by providing a different salt in each
application of the method. This implies that any instance
that defines
hashWithSalt
must make use of the salt in its implementation. hashWithSalt
may return negativeInt
values.
Instances
class Foldable (t :: Type -> Type) where #
The Foldable class represents data structures that can be reduced to a summary value one element at a time. Strict left-associative folds are a good fit for space-efficient reduction, while lazy right-associative folds are a good fit for corecursive iteration, or for folds that short-circuit after processing an initial subsequence of the structure's elements.
Instances can be derived automatically by enabling the DeriveFoldable
extension. For example, a derived instance for a binary tree might be:
{-# LANGUAGE DeriveFoldable #-} data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) deriving Foldable
A more detailed description can be found in the Overview section of Data.Foldable.
For the class laws see the Laws section of Data.Foldable.
Methods
foldMap' :: Monoid m => (a -> m) -> t a -> m #
A left-associative variant of foldMap
that is strict in the
accumulator. Use this method for strict reduction when partial
results are merged via (
.<>
)
Examples
Define a Monoid
over finite bit strings under xor
. Use it to
strictly compute the xor
of a list of Int
values.
>>>
:set -XGeneralizedNewtypeDeriving
>>>
import Data.Bits (Bits, FiniteBits, xor, zeroBits)
>>>
import Data.Foldable (foldMap')
>>>
import Numeric (showHex)
>>>
>>>
newtype X a = X a deriving (Eq, Bounded, Enum, Bits, FiniteBits)
>>>
instance Bits a => Semigroup (X a) where X a <> X b = X (a `xor` b)
>>>
instance Bits a => Monoid (X a) where mempty = X zeroBits
>>>
>>>
let bits :: [Int]; bits = [0xcafe, 0xfeed, 0xdeaf, 0xbeef, 0x5411]
>>>
(\ (X a) -> showString "0x" . showHex a $ "") $ foldMap' X bits
"0x42"
Since: base-4.13.0.0
foldr :: (a -> b -> b) -> b -> t a -> b #
Right-associative fold of a structure, lazy in the accumulator.
In the case of lists, foldr
, when applied to a binary operator, a
starting value (typically the right-identity of the operator), and a
list, reduces the list using the binary operator, from right to left:
foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
Note that since the head of the resulting expression is produced by an
application of the operator to the first element of the list, given an
operator lazy in its right argument, foldr
can produce a terminating
expression from an unbounded list.
For a general Foldable
structure this should be semantically identical
to,
foldr f z =foldr
f z .toList
Examples
Basic usage:
>>>
foldr (||) False [False, True, False]
True
>>>
foldr (||) False []
False
>>>
foldr (\c acc -> acc ++ [c]) "foo" ['a', 'b', 'c', 'd']
"foodcba"
Infinite structures
⚠️ Applying foldr
to infinite structures usually doesn't terminate.
It may still terminate under one of the following conditions:
- the folding function is short-circuiting
- the folding function is lazy on its second argument
Short-circuiting
(
short-circuits on ||
)True
values, so the following terminates
because there is a True
value finitely far from the left side:
>>>
foldr (||) False (True : repeat False)
True
But the following doesn't terminate:
>>>
foldr (||) False (repeat False ++ [True])
* Hangs forever *
Laziness in the second argument
Applying foldr
to infinite structures terminates when the operator is
lazy in its second argument (the initial accumulator is never used in
this case, and so could be left undefined
, but []
is more clear):
>>>
take 5 $ foldr (\i acc -> i : fmap (+3) acc) [] (repeat 1)
[1,4,7,10,13]
foldl' :: (b -> a -> b) -> b -> t a -> b #
Left-associative fold of a structure but with strict application of the operator.
This ensures that each step of the fold is forced to Weak Head Normal
Form before being applied, avoiding the collection of thunks that would
otherwise occur. This is often what you want to strictly reduce a
finite structure to a single strict result (e.g. sum
).
For a general Foldable
structure this should be semantically identical
to,
foldl' f z =foldl'
f z .toList
Since: base-4.6.0.0
Test whether the structure is empty. The default implementation is Left-associative and lazy in both the initial element and the accumulator. Thus optimised for structures where the first element can be accessed in constant time. Structures where this is not the case should have a non-default implementation.
Examples
Basic usage:
>>>
null []
True
>>>
null [1]
False
null
is expected to terminate even for infinite structures.
The default implementation terminates provided the structure
is bounded on the left (there is a leftmost element).
>>>
null [1..]
False
Since: base-4.8.0.0
Returns the size/length of a finite structure as an Int
. The
default implementation just counts elements starting with the leftmost.
Instances for structures that can compute the element count faster
than via element-by-element counting, should provide a specialised
implementation.
Examples
Basic usage:
>>>
length []
0
>>>
length ['a', 'b', 'c']
3>>>
length [1..]
* Hangs forever *
Since: base-4.8.0.0
Instances
Foldable KeyMap | |
Defined in Data.Aeson.KeyMap Methods fold :: Monoid m => KeyMap m -> m # foldMap :: Monoid m => (a -> m) -> KeyMap a -> m # foldMap' :: Monoid m => (a -> m) -> KeyMap a -> m # foldr :: (a -> b -> b) -> b -> KeyMap a -> b # foldr' :: (a -> b -> b) -> b -> KeyMap a -> b # foldl :: (b -> a -> b) -> b -> KeyMap a -> b # foldl' :: (b -> a -> b) -> b -> KeyMap a -> b # foldr1 :: (a -> a -> a) -> KeyMap a -> a # foldl1 :: (a -> a -> a) -> KeyMap a -> a # elem :: Eq a => a -> KeyMap a -> Bool # maximum :: Ord a => KeyMap a -> a # minimum :: Ord a => KeyMap a -> a # | |
Foldable IResult | |
Defined in Data.Aeson.Types.Internal Methods fold :: Monoid m => IResult m -> m # foldMap :: Monoid m => (a -> m) -> IResult a -> m # foldMap' :: Monoid m => (a -> m) -> IResult a -> m # foldr :: (a -> b -> b) -> b -> IResult a -> b # foldr' :: (a -> b -> b) -> b -> IResult a -> b # foldl :: (b -> a -> b) -> b -> IResult a -> b # foldl' :: (b -> a -> b) -> b -> IResult a -> b # foldr1 :: (a -> a -> a) -> IResult a -> a # foldl1 :: (a -> a -> a) -> IResult a -> a # elem :: Eq a => a -> IResult a -> Bool # maximum :: Ord a => IResult a -> a # minimum :: Ord a => IResult a -> a # | |
Foldable Result | |
Defined in Data.Aeson.Types.Internal Methods fold :: Monoid m => Result m -> m # foldMap :: Monoid m => (a -> m) -> Result a -> m # foldMap' :: Monoid m => (a -> m) -> Result a -> m # foldr :: (a -> b -> b) -> b -> Result a -> b # foldr' :: (a -> b -> b) -> b -> Result a -> b # foldl :: (b -> a -> b) -> b -> Result a -> b # foldl' :: (b -> a -> b) -> b -> Result a -> b # foldr1 :: (a -> a -> a) -> Result a -> a # foldl1 :: (a -> a -> a) -> Result a -> a # elem :: Eq a => a -> Result a -> Bool # maximum :: Ord a => Result a -> a # minimum :: Ord a => Result a -> a # | |
Foldable ZipList | Since: base-4.9.0.0 |
Defined in Control.Applicative Methods fold :: Monoid m => ZipList m -> m # foldMap :: Monoid m => (a -> m) -> ZipList a -> m # foldMap' :: Monoid m => (a -> m) -> ZipList a -> m # foldr :: (a -> b -> b) -> b -> ZipList a -> b # foldr' :: (a -> b -> b) -> b -> ZipList a -> b # foldl :: (b -> a -> b) -> b -> ZipList a -> b # foldl' :: (b -> a -> b) -> b -> ZipList a -> b # foldr1 :: (a -> a -> a) -> ZipList a -> a # foldl1 :: (a -> a -> a) -> ZipList a -> a # elem :: Eq a => a -> ZipList a -> Bool # maximum :: Ord a => ZipList a -> a # minimum :: Ord a => ZipList a -> a # | |
Foldable Complex | Since: base-4.9.0.0 |
Defined in Data.Complex Methods fold :: Monoid m => Complex m -> m # foldMap :: Monoid m => (a -> m) -> Complex a -> m # foldMap' :: Monoid m => (a -> m) -> Complex a -> m # foldr :: (a -> b -> b) -> b -> Complex a -> b # foldr' :: (a -> b -> b) -> b -> Complex a -> b # foldl :: (b -> a -> b) -> b -> Complex a -> b # foldl' :: (b -> a -> b) -> b -> Complex a -> b # foldr1 :: (a -> a -> a) -> Complex a -> a # foldl1 :: (a -> a -> a) -> Complex a -> a # elem :: Eq a => a -> Complex a -> Bool # maximum :: Ord a => Complex a -> a # minimum :: Ord a => Complex a -> a # | |
Foldable Identity | Since: base-4.8.0.0 |
Defined in Data.Functor.Identity Methods fold :: Monoid m => Identity m -> m # foldMap :: Monoid m => (a -> m) -> Identity a -> m # foldMap' :: Monoid m => (a -> m) -> Identity a -> m # foldr :: (a -> b -> b) -> b -> Identity a -> b # foldr' :: (a -> b -> b) -> b -> Identity a -> b # foldl :: (b -> a -> b) -> b -> Identity a -> b # foldl' :: (b -> a -> b) -> b -> Identity a -> b # foldr1 :: (a -> a -> a) -> Identity a -> a # foldl1 :: (a -> a -> a) -> Identity a -> a # elem :: Eq a => a -> Identity a -> Bool # maximum :: Ord a => Identity a -> a # minimum :: Ord a => Identity a -> a # | |
Foldable First | Since: base-4.8.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => First m -> m # foldMap :: Monoid m => (a -> m) -> First a -> m # foldMap' :: Monoid m => (a -> m) -> First a -> m # foldr :: (a -> b -> b) -> b -> First a -> b # foldr' :: (a -> b -> b) -> b -> First a -> b # foldl :: (b -> a -> b) -> b -> First a -> b # foldl' :: (b -> a -> b) -> b -> First a -> b # foldr1 :: (a -> a -> a) -> First a -> a # foldl1 :: (a -> a -> a) -> First a -> a # elem :: Eq a => a -> First a -> Bool # maximum :: Ord a => First a -> a # minimum :: Ord a => First a -> a # | |
Foldable Last | Since: base-4.8.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Last m -> m # foldMap :: Monoid m => (a -> m) -> Last a -> m # foldMap' :: Monoid m => (a -> m) -> Last a -> m # foldr :: (a -> b -> b) -> b -> Last a -> b # foldr' :: (a -> b -> b) -> b -> Last a -> b # foldl :: (b -> a -> b) -> b -> Last a -> b # foldl' :: (b -> a -> b) -> b -> Last a -> b # foldr1 :: (a -> a -> a) -> Last a -> a # foldl1 :: (a -> a -> a) -> Last a -> a # elem :: Eq a => a -> Last a -> Bool # maximum :: Ord a => Last a -> a # | |
Foldable Down | Since: base-4.12.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Down m -> m # foldMap :: Monoid m => (a -> m) -> Down a -> m # foldMap' :: Monoid m => (a -> m) -> Down a -> m # foldr :: (a -> b -> b) -> b -> Down a -> b # foldr' :: (a -> b -> b) -> b -> Down a -> b # foldl :: (b -> a -> b) -> b -> Down a -> b # foldl' :: (b -> a -> b) -> b -> Down a -> b # foldr1 :: (a -> a -> a) -> Down a -> a # foldl1 :: (a -> a -> a) -> Down a -> a # elem :: Eq a => a -> Down a -> Bool # maximum :: Ord a => Down a -> a # | |
Foldable First | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => First m -> m # foldMap :: Monoid m => (a -> m) -> First a -> m # foldMap' :: Monoid m => (a -> m) -> First a -> m # foldr :: (a -> b -> b) -> b -> First a -> b # foldr' :: (a -> b -> b) -> b -> First a -> b # foldl :: (b -> a -> b) -> b -> First a -> b # foldl' :: (b -> a -> b) -> b -> First a -> b # foldr1 :: (a -> a -> a) -> First a -> a # foldl1 :: (a -> a -> a) -> First a -> a # elem :: Eq a => a -> First a -> Bool # maximum :: Ord a => First a -> a # minimum :: Ord a => First a -> a # | |
Foldable Last | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Last m -> m # foldMap :: Monoid m => (a -> m) -> Last a -> m # foldMap' :: Monoid m => (a -> m) -> Last a -> m # foldr :: (a -> b -> b) -> b -> Last a -> b # foldr' :: (a -> b -> b) -> b -> Last a -> b # foldl :: (b -> a -> b) -> b -> Last a -> b # foldl' :: (b -> a -> b) -> b -> Last a -> b # foldr1 :: (a -> a -> a) -> Last a -> a # foldl1 :: (a -> a -> a) -> Last a -> a # elem :: Eq a => a -> Last a -> Bool # maximum :: Ord a => Last a -> a # | |
Foldable Max | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Max m -> m # foldMap :: Monoid m => (a -> m) -> Max a -> m # foldMap' :: Monoid m => (a -> m) -> Max a -> m # foldr :: (a -> b -> b) -> b -> Max a -> b # foldr' :: (a -> b -> b) -> b -> Max a -> b # foldl :: (b -> a -> b) -> b -> Max a -> b # foldl' :: (b -> a -> b) -> b -> Max a -> b # foldr1 :: (a -> a -> a) -> Max a -> a # foldl1 :: (a -> a -> a) -> Max a -> a # elem :: Eq a => a -> Max a -> Bool # maximum :: Ord a => Max a -> a # | |
Foldable Min | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Min m -> m # foldMap :: Monoid m => (a -> m) -> Min a -> m # foldMap' :: Monoid m => (a -> m) -> Min a -> m # foldr :: (a -> b -> b) -> b -> Min a -> b # foldr' :: (a -> b -> b) -> b -> Min a -> b # foldl :: (b -> a -> b) -> b -> Min a -> b # foldl' :: (b -> a -> b) -> b -> Min a -> b # foldr1 :: (a -> a -> a) -> Min a -> a # foldl1 :: (a -> a -> a) -> Min a -> a # elem :: Eq a => a -> Min a -> Bool # maximum :: Ord a => Min a -> a # | |
Foldable Dual | Since: base-4.8.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Dual m -> m # foldMap :: Monoid m => (a -> m) -> Dual a -> m # foldMap' :: Monoid m => (a -> m) -> Dual a -> m # foldr :: (a -> b -> b) -> b -> Dual a -> b # foldr' :: (a -> b -> b) -> b -> Dual a -> b # foldl :: (b -> a -> b) -> b -> Dual a -> b # foldl' :: (b -> a -> b) -> b -> Dual a -> b # foldr1 :: (a -> a -> a) -> Dual a -> a # foldl1 :: (a -> a -> a) -> Dual a -> a # elem :: Eq a => a -> Dual a -> Bool # maximum :: Ord a => Dual a -> a # | |
Foldable Product | Since: base-4.8.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Product m -> m # foldMap :: Monoid m => (a -> m) -> Product a -> m # foldMap' :: Monoid m => (a -> m) -> Product a -> m # foldr :: (a -> b -> b) -> b -> Product a -> b # foldr' :: (a -> b -> b) -> b -> Product a -> b # foldl :: (b -> a -> b) -> b -> Product a -> b # foldl' :: (b -> a -> b) -> b -> Product a -> b # foldr1 :: (a -> a -> a) -> Product a -> a # foldl1 :: (a -> a -> a) -> Product a -> a # elem :: Eq a => a -> Product a -> Bool # maximum :: Ord a => Product a -> a # minimum :: Ord a => Product a -> a # | |
Foldable Sum | Since: base-4.8.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Sum m -> m # foldMap :: Monoid m => (a -> m) -> Sum a -> m # foldMap' :: Monoid m => (a -> m) -> Sum a -> m # foldr :: (a -> b -> b) -> b -> Sum a -> b # foldr' :: (a -> b -> b) -> b -> Sum a -> b # foldl :: (b -> a -> b) -> b -> Sum a -> b # foldl' :: (b -> a -> b) -> b -> Sum a -> b # foldr1 :: (a -> a -> a) -> Sum a -> a # foldl1 :: (a -> a -> a) -> Sum a -> a # elem :: Eq a => a -> Sum a -> Bool # maximum :: Ord a => Sum a -> a # | |
Foldable NonEmpty | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => NonEmpty m -> m # foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m # foldMap' :: Monoid m => (a -> m) -> NonEmpty a -> m # foldr :: (a -> b -> b) -> b -> NonEmpty a -> b # foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b # foldl :: (b -> a -> b) -> b -> NonEmpty a -> b # foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b # foldr1 :: (a -> a -> a) -> NonEmpty a -> a # foldl1 :: (a -> a -> a) -> NonEmpty a -> a # elem :: Eq a => a -> NonEmpty a -> Bool # maximum :: Ord a => NonEmpty a -> a # minimum :: Ord a => NonEmpty a -> a # | |
Foldable Par1 | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Par1 m -> m # foldMap :: Monoid m => (a -> m) -> Par1 a -> m # foldMap' :: Monoid m => (a -> m) -> Par1 a -> m # foldr :: (a -> b -> b) -> b -> Par1 a -> b # foldr' :: (a -> b -> b) -> b -> Par1 a -> b # foldl :: (b -> a -> b) -> b -> Par1 a -> b # foldl' :: (b -> a -> b) -> b -> Par1 a -> b # foldr1 :: (a -> a -> a) -> Par1 a -> a # foldl1 :: (a -> a -> a) -> Par1 a -> a # elem :: Eq a => a -> Par1 a -> Bool # maximum :: Ord a => Par1 a -> a # | |
Foldable UniqueSeq Source # | |
Defined in Charon.Data.UniqueSeq.Internal Methods fold :: Monoid m => UniqueSeq m -> m # foldMap :: Monoid m => (a -> m) -> UniqueSeq a -> m # foldMap' :: Monoid m => (a -> m) -> UniqueSeq a -> m # foldr :: (a -> b -> b) -> b -> UniqueSeq a -> b # foldr' :: (a -> b -> b) -> b -> UniqueSeq a -> b # foldl :: (b -> a -> b) -> b -> UniqueSeq a -> b # foldl' :: (b -> a -> b) -> b -> UniqueSeq a -> b # foldr1 :: (a -> a -> a) -> UniqueSeq a -> a # foldl1 :: (a -> a -> a) -> UniqueSeq a -> a # toList :: UniqueSeq a -> [a] # length :: UniqueSeq a -> Int # elem :: Eq a => a -> UniqueSeq a -> Bool # maximum :: Ord a => UniqueSeq a -> a # minimum :: Ord a => UniqueSeq a -> a # | |
Foldable UniqueSeqNE Source # | |
Defined in Charon.Data.UniqueSeqNE.Internal Methods fold :: Monoid m => UniqueSeqNE m -> m # foldMap :: Monoid m => (a -> m) -> UniqueSeqNE a -> m # foldMap' :: Monoid m => (a -> m) -> UniqueSeqNE a -> m # foldr :: (a -> b -> b) -> b -> UniqueSeqNE a -> b # foldr' :: (a -> b -> b) -> b -> UniqueSeqNE a -> b # foldl :: (b -> a -> b) -> b -> UniqueSeqNE a -> b # foldl' :: (b -> a -> b) -> b -> UniqueSeqNE a -> b # foldr1 :: (a -> a -> a) -> UniqueSeqNE a -> a # foldl1 :: (a -> a -> a) -> UniqueSeqNE a -> a # toList :: UniqueSeqNE a -> [a] # null :: UniqueSeqNE a -> Bool # length :: UniqueSeqNE a -> Int # elem :: Eq a => a -> UniqueSeqNE a -> Bool # maximum :: Ord a => UniqueSeqNE a -> a # minimum :: Ord a => UniqueSeqNE a -> a # sum :: Num a => UniqueSeqNE a -> a # product :: Num a => UniqueSeqNE a -> a # | |
Foldable IntMap | Folds in order of increasing key. |
Defined in Data.IntMap.Internal Methods fold :: Monoid m => IntMap m -> m # foldMap :: Monoid m => (a -> m) -> IntMap a -> m # foldMap' :: Monoid m => (a -> m) -> IntMap a -> m # foldr :: (a -> b -> b) -> b -> IntMap a -> b # foldr' :: (a -> b -> b) -> b -> IntMap a -> b # foldl :: (b -> a -> b) -> b -> IntMap a -> b # foldl' :: (b -> a -> b) -> b -> IntMap a -> b # foldr1 :: (a -> a -> a) -> IntMap a -> a # foldl1 :: (a -> a -> a) -> IntMap a -> a # elem :: Eq a => a -> IntMap a -> Bool # maximum :: Ord a => IntMap a -> a # minimum :: Ord a => IntMap a -> a # | |
Foldable Digit | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Digit m -> m # foldMap :: Monoid m => (a -> m) -> Digit a -> m # foldMap' :: Monoid m => (a -> m) -> Digit a -> m # foldr :: (a -> b -> b) -> b -> Digit a -> b # foldr' :: (a -> b -> b) -> b -> Digit a -> b # foldl :: (b -> a -> b) -> b -> Digit a -> b # foldl' :: (b -> a -> b) -> b -> Digit a -> b # foldr1 :: (a -> a -> a) -> Digit a -> a # foldl1 :: (a -> a -> a) -> Digit a -> a # elem :: Eq a => a -> Digit a -> Bool # maximum :: Ord a => Digit a -> a # minimum :: Ord a => Digit a -> a # | |
Foldable Elem | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Elem m -> m # foldMap :: Monoid m => (a -> m) -> Elem a -> m # foldMap' :: Monoid m => (a -> m) -> Elem a -> m # foldr :: (a -> b -> b) -> b -> Elem a -> b # foldr' :: (a -> b -> b) -> b -> Elem a -> b # foldl :: (b -> a -> b) -> b -> Elem a -> b # foldl' :: (b -> a -> b) -> b -> Elem a -> b # foldr1 :: (a -> a -> a) -> Elem a -> a # foldl1 :: (a -> a -> a) -> Elem a -> a # elem :: Eq a => a -> Elem a -> Bool # maximum :: Ord a => Elem a -> a # | |
Foldable FingerTree | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => FingerTree m -> m # foldMap :: Monoid m => (a -> m) -> FingerTree a -> m # foldMap' :: Monoid m => (a -> m) -> FingerTree a -> m # foldr :: (a -> b -> b) -> b -> FingerTree a -> b # foldr' :: (a -> b -> b) -> b -> FingerTree a -> b # foldl :: (b -> a -> b) -> b -> FingerTree a -> b # foldl' :: (b -> a -> b) -> b -> FingerTree a -> b # foldr1 :: (a -> a -> a) -> FingerTree a -> a # foldl1 :: (a -> a -> a) -> FingerTree a -> a # toList :: FingerTree a -> [a] # null :: FingerTree a -> Bool # length :: FingerTree a -> Int # elem :: Eq a => a -> FingerTree a -> Bool # maximum :: Ord a => FingerTree a -> a # minimum :: Ord a => FingerTree a -> a # sum :: Num a => FingerTree a -> a # product :: Num a => FingerTree a -> a # | |
Foldable Node | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Node m -> m # foldMap :: Monoid m => (a -> m) -> Node a -> m # foldMap' :: Monoid m => (a -> m) -> Node a -> m # foldr :: (a -> b -> b) -> b -> Node a -> b # foldr' :: (a -> b -> b) -> b -> Node a -> b # foldl :: (b -> a -> b) -> b -> Node a -> b # foldl' :: (b -> a -> b) -> b -> Node a -> b # foldr1 :: (a -> a -> a) -> Node a -> a # foldl1 :: (a -> a -> a) -> Node a -> a # elem :: Eq a => a -> Node a -> Bool # maximum :: Ord a => Node a -> a # | |
Foldable Seq | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Seq m -> m # foldMap :: Monoid m => (a -> m) -> Seq a -> m # foldMap' :: Monoid m => (a -> m) -> Seq a -> m # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # elem :: Eq a => a -> Seq a -> Bool # maximum :: Ord a => Seq a -> a # | |
Foldable ViewL | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => ViewL m -> m # foldMap :: Monoid m => (a -> m) -> ViewL a -> m # foldMap' :: Monoid m => (a -> m) -> ViewL a -> m # foldr :: (a -> b -> b) -> b -> ViewL a -> b # foldr' :: (a -> b -> b) -> b -> ViewL a -> b # foldl :: (b -> a -> b) -> b -> ViewL a -> b # foldl' :: (b -> a -> b) -> b -> ViewL a -> b # foldr1 :: (a -> a -> a) -> ViewL a -> a # foldl1 :: (a -> a -> a) -> ViewL a -> a # elem :: Eq a => a -> ViewL a -> Bool # maximum :: Ord a => ViewL a -> a # minimum :: Ord a => ViewL a -> a # | |
Foldable ViewR | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => ViewR m -> m # foldMap :: Monoid m => (a -> m) -> ViewR a -> m # foldMap' :: Monoid m => (a -> m) -> ViewR a -> m # foldr :: (a -> b -> b) -> b -> ViewR a -> b # foldr' :: (a -> b -> b) -> b -> ViewR a -> b # foldl :: (b -> a -> b) -> b -> ViewR a -> b # foldl' :: (b -> a -> b) -> b -> ViewR a -> b # foldr1 :: (a -> a -> a) -> ViewR a -> a # foldl1 :: (a -> a -> a) -> ViewR a -> a # elem :: Eq a => a -> ViewR a -> Bool # maximum :: Ord a => ViewR a -> a # minimum :: Ord a => ViewR a -> a # | |
Foldable Set | Folds in order of increasing key. |
Defined in Data.Set.Internal Methods fold :: Monoid m => Set m -> m # foldMap :: Monoid m => (a -> m) -> Set a -> m # foldMap' :: Monoid m => (a -> m) -> Set a -> m # foldr :: (a -> b -> b) -> b -> Set a -> b # foldr' :: (a -> b -> b) -> b -> Set a -> b # foldl :: (b -> a -> b) -> b -> Set a -> b # foldl' :: (b -> a -> b) -> b -> Set a -> b # foldr1 :: (a -> a -> a) -> Set a -> a # foldl1 :: (a -> a -> a) -> Set a -> a # elem :: Eq a => a -> Set a -> Bool # maximum :: Ord a => Set a -> a # | |
Foldable Tree | Folds in preorder |
Defined in Data.Tree Methods fold :: Monoid m => Tree m -> m # foldMap :: Monoid m => (a -> m) -> Tree a -> m # foldMap' :: Monoid m => (a -> m) -> Tree a -> m # foldr :: (a -> b -> b) -> b -> Tree a -> b # foldr' :: (a -> b -> b) -> b -> Tree a -> b # foldl :: (b -> a -> b) -> b -> Tree a -> b # foldl' :: (b -> a -> b) -> b -> Tree a -> b # foldr1 :: (a -> a -> a) -> Tree a -> a # foldl1 :: (a -> a -> a) -> Tree a -> a # elem :: Eq a => a -> Tree a -> Bool # maximum :: Ord a => Tree a -> a # | |
Foldable DNonEmpty | |
Defined in Data.DList.DNonEmpty.Internal Methods fold :: Monoid m => DNonEmpty m -> m # foldMap :: Monoid m => (a -> m) -> DNonEmpty a -> m # foldMap' :: Monoid m => (a -> m) -> DNonEmpty a -> m # foldr :: (a -> b -> b) -> b -> DNonEmpty a -> b # foldr' :: (a -> b -> b) -> b -> DNonEmpty a -> b # foldl :: (b -> a -> b) -> b -> DNonEmpty a -> b # foldl' :: (b -> a -> b) -> b -> DNonEmpty a -> b # foldr1 :: (a -> a -> a) -> DNonEmpty a -> a # foldl1 :: (a -> a -> a) -> DNonEmpty a -> a # toList :: DNonEmpty a -> [a] # length :: DNonEmpty a -> Int # elem :: Eq a => a -> DNonEmpty a -> Bool # maximum :: Ord a => DNonEmpty a -> a # minimum :: Ord a => DNonEmpty a -> a # | |
Foldable DList | |
Defined in Data.DList.Internal Methods fold :: Monoid m => DList m -> m # foldMap :: Monoid m => (a -> m) -> DList a -> m # foldMap' :: Monoid m => (a -> m) -> DList a -> m # foldr :: (a -> b -> b) -> b -> DList a -> b # foldr' :: (a -> b -> b) -> b -> DList a -> b # foldl :: (b -> a -> b) -> b -> DList a -> b # foldl' :: (b -> a -> b) -> b -> DList a -> b # foldr1 :: (a -> a -> a) -> DList a -> a # foldl1 :: (a -> a -> a) -> DList a -> a # elem :: Eq a => a -> DList a -> Bool # maximum :: Ord a => DList a -> a # minimum :: Ord a => DList a -> a # | |
Foldable Hashed | |
Defined in Data.Hashable.Class Methods fold :: Monoid m => Hashed m -> m # foldMap :: Monoid m => (a -> m) -> Hashed a -> m # foldMap' :: Monoid m => (a -> m) -> Hashed a -> m # foldr :: (a -> b -> b) -> b -> Hashed a -> b # foldr' :: (a -> b -> b) -> b -> Hashed a -> b # foldl :: (b -> a -> b) -> b -> Hashed a -> b # foldl' :: (b -> a -> b) -> b -> Hashed a -> b # foldr1 :: (a -> a -> a) -> Hashed a -> a # foldl1 :: (a -> a -> a) -> Hashed a -> a # elem :: Eq a => a -> Hashed a -> Bool # maximum :: Ord a => Hashed a -> a # minimum :: Ord a => Hashed a -> a # | |
Foldable NESeq |
|
Defined in Data.Sequence.NonEmpty.Internal Methods fold :: Monoid m => NESeq m -> m # foldMap :: Monoid m => (a -> m) -> NESeq a -> m # foldMap' :: Monoid m => (a -> m) -> NESeq a -> m # foldr :: (a -> b -> b) -> b -> NESeq a -> b # foldr' :: (a -> b -> b) -> b -> NESeq a -> b # foldl :: (b -> a -> b) -> b -> NESeq a -> b # foldl' :: (b -> a -> b) -> b -> NESeq a -> b # foldr1 :: (a -> a -> a) -> NESeq a -> a # foldl1 :: (a -> a -> a) -> NESeq a -> a # elem :: Eq a => a -> NESeq a -> Bool # maximum :: Ord a => NESeq a -> a # minimum :: Ord a => NESeq a -> a # | |
Foldable SimpleDocStream | Collect all annotations from a document. |
Defined in Prettyprinter.Internal Methods fold :: Monoid m => SimpleDocStream m -> m # foldMap :: Monoid m => (a -> m) -> SimpleDocStream a -> m # foldMap' :: Monoid m => (a -> m) -> SimpleDocStream a -> m # foldr :: (a -> b -> b) -> b -> SimpleDocStream a -> b # foldr' :: (a -> b -> b) -> b -> SimpleDocStream a -> b # foldl :: (b -> a -> b) -> b -> SimpleDocStream a -> b # foldl' :: (b -> a -> b) -> b -> SimpleDocStream a -> b # foldr1 :: (a -> a -> a) -> SimpleDocStream a -> a # foldl1 :: (a -> a -> a) -> SimpleDocStream a -> a # toList :: SimpleDocStream a -> [a] # null :: SimpleDocStream a -> Bool # length :: SimpleDocStream a -> Int # elem :: Eq a => a -> SimpleDocStream a -> Bool # maximum :: Ord a => SimpleDocStream a -> a # minimum :: Ord a => SimpleDocStream a -> a # sum :: Num a => SimpleDocStream a -> a # product :: Num a => SimpleDocStream a -> a # | |
Foldable Array | |
Defined in Data.Primitive.Array Methods fold :: Monoid m => Array m -> m # foldMap :: Monoid m => (a -> m) -> Array a -> m # foldMap' :: Monoid m => (a -> m) -> Array a -> m # foldr :: (a -> b -> b) -> b -> Array a -> b # foldr' :: (a -> b -> b) -> b -> Array a -> b # foldl :: (b -> a -> b) -> b -> Array a -> b # foldl' :: (b -> a -> b) -> b -> Array a -> b # foldr1 :: (a -> a -> a) -> Array a -> a # foldl1 :: (a -> a -> a) -> Array a -> a # elem :: Eq a => a -> Array a -> Bool # maximum :: Ord a => Array a -> a # minimum :: Ord a => Array a -> a # | |
Foldable SmallArray | |
Defined in Data.Primitive.SmallArray Methods fold :: Monoid m => SmallArray m -> m # foldMap :: Monoid m => (a -> m) -> SmallArray a -> m # foldMap' :: Monoid m => (a -> m) -> SmallArray a -> m # foldr :: (a -> b -> b) -> b -> SmallArray a -> b # foldr' :: (a -> b -> b) -> b -> SmallArray a -> b # foldl :: (b -> a -> b) -> b -> SmallArray a -> b # foldl' :: (b -> a -> b) -> b -> SmallArray a -> b # foldr1 :: (a -> a -> a) -> SmallArray a -> a # foldl1 :: (a -> a -> a) -> SmallArray a -> a # toList :: SmallArray a -> [a] # null :: SmallArray a -> Bool # length :: SmallArray a -> Int # elem :: Eq a => a -> SmallArray a -> Bool # maximum :: Ord a => SmallArray a -> a # minimum :: Ord a => SmallArray a -> a # sum :: Num a => SmallArray a -> a # product :: Num a => SmallArray a -> a # | |
Foldable Maybe | |
Defined in Data.Strict.Maybe Methods 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 # | |
Foldable Window | |
Defined in System.Console.Terminal.Common Methods fold :: Monoid m => Window m -> m # foldMap :: Monoid m => (a -> m) -> Window a -> m # foldMap' :: Monoid m => (a -> m) -> Window a -> m # foldr :: (a -> b -> b) -> b -> Window a -> b # foldr' :: (a -> b -> b) -> b -> Window a -> b # foldl :: (b -> a -> b) -> b -> Window a -> b # foldl' :: (b -> a -> b) -> b -> Window a -> b # foldr1 :: (a -> a -> a) -> Window a -> a # foldl1 :: (a -> a -> a) -> Window a -> a # elem :: Eq a => a -> Window a -> Bool # maximum :: Ord a => Window a -> a # minimum :: Ord a => Window a -> a # | |
Foldable HashSet | |
Defined in Data.HashSet.Internal Methods fold :: Monoid m => HashSet m -> m # foldMap :: Monoid m => (a -> m) -> HashSet a -> m # foldMap' :: Monoid m => (a -> m) -> HashSet a -> m # foldr :: (a -> b -> b) -> b -> HashSet a -> b # foldr' :: (a -> b -> b) -> b -> HashSet a -> b # foldl :: (b -> a -> b) -> b -> HashSet a -> b # foldl' :: (b -> a -> b) -> b -> HashSet a -> b # foldr1 :: (a -> a -> a) -> HashSet a -> a # foldl1 :: (a -> a -> a) -> HashSet a -> a # elem :: Eq a => a -> HashSet a -> Bool # maximum :: Ord a => HashSet a -> a # minimum :: Ord a => HashSet a -> a # | |
Foldable Vector | |
Defined in Data.Vector Methods fold :: Monoid m => Vector m -> m # foldMap :: Monoid m => (a -> m) -> Vector a -> m # foldMap' :: Monoid m => (a -> m) -> Vector a -> m # foldr :: (a -> b -> b) -> b -> Vector a -> b # foldr' :: (a -> b -> b) -> b -> Vector a -> b # foldl :: (b -> a -> b) -> b -> Vector a -> b # foldl' :: (b -> a -> b) -> b -> Vector a -> b # foldr1 :: (a -> a -> a) -> Vector a -> a # foldl1 :: (a -> a -> a) -> Vector a -> a # elem :: Eq a => a -> Vector a -> Bool # maximum :: Ord a => Vector a -> a # minimum :: Ord a => Vector a -> a # | |
Foldable Maybe | Since: base-2.1 |
Defined in Data.Foldable Methods 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 # | |
Foldable Solo | Since: base-4.15 |
Defined in Data.Foldable Methods fold :: Monoid m => Solo m -> m # foldMap :: Monoid m => (a -> m) -> Solo a -> m # foldMap' :: Monoid m => (a -> m) -> Solo a -> m # foldr :: (a -> b -> b) -> b -> Solo a -> b # foldr' :: (a -> b -> b) -> b -> Solo a -> b # foldl :: (b -> a -> b) -> b -> Solo a -> b # foldl' :: (b -> a -> b) -> b -> Solo a -> b # foldr1 :: (a -> a -> a) -> Solo a -> a # foldl1 :: (a -> a -> a) -> Solo a -> a # elem :: Eq a => a -> Solo a -> Bool # maximum :: Ord a => Solo a -> a # | |
Foldable List | Since: base-2.1 |
Defined in Data.Foldable Methods fold :: Monoid m => [m] -> m # foldMap :: Monoid m => (a -> m) -> [a] -> m # foldMap' :: Monoid m => (a -> m) -> [a] -> m # foldr :: (a -> b -> b) -> b -> [a] -> b # foldr' :: (a -> b -> b) -> b -> [a] -> b # foldl :: (b -> a -> b) -> b -> [a] -> b # foldl' :: (b -> a -> b) -> b -> [a] -> b # foldr1 :: (a -> a -> a) -> [a] -> a # foldl1 :: (a -> a -> a) -> [a] -> a # elem :: Eq a => a -> [a] -> Bool # maximum :: Ord a => [a] -> a # | |
Foldable (Either a) | Since: base-4.7.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Either a m -> m # foldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # toList :: Either a a0 -> [a0] # length :: Either a a0 -> Int # elem :: Eq a0 => a0 -> Either a a0 -> Bool # maximum :: Ord a0 => Either a a0 -> a0 # minimum :: Ord a0 => Either a a0 -> a0 # | |
Foldable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Proxy m -> m # foldMap :: Monoid m => (a -> m) -> Proxy a -> m # foldMap' :: Monoid m => (a -> m) -> Proxy a -> m # foldr :: (a -> b -> b) -> b -> Proxy a -> b # foldr' :: (a -> b -> b) -> b -> Proxy a -> b # foldl :: (b -> a -> b) -> b -> Proxy a -> b # foldl' :: (b -> a -> b) -> b -> Proxy a -> b # foldr1 :: (a -> a -> a) -> Proxy a -> a # foldl1 :: (a -> a -> a) -> Proxy a -> a # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # | |
Foldable (Arg a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Arg a m -> m # foldMap :: Monoid m => (a0 -> m) -> Arg a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Arg a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Arg a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Arg a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Arg a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Arg a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 # elem :: Eq a0 => a0 -> Arg a a0 -> Bool # maximum :: Ord a0 => Arg a a0 -> a0 # minimum :: Ord a0 => Arg a a0 -> a0 # | |
Foldable (Array i) | Since: base-4.8.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Array i m -> m # foldMap :: Monoid m => (a -> m) -> Array i a -> m # foldMap' :: Monoid m => (a -> m) -> Array i a -> m # foldr :: (a -> b -> b) -> b -> Array i a -> b # foldr' :: (a -> b -> b) -> b -> Array i a -> b # foldl :: (b -> a -> b) -> b -> Array i a -> b # foldl' :: (b -> a -> b) -> b -> Array i a -> b # foldr1 :: (a -> a -> a) -> Array i a -> a # foldl1 :: (a -> a -> a) -> Array i a -> a # elem :: Eq a => a -> Array i a -> Bool # maximum :: Ord a => Array i a -> a # minimum :: Ord a => Array i a -> a # | |
Foldable (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => U1 m -> m # foldMap :: Monoid m => (a -> m) -> U1 a -> m # foldMap' :: Monoid m => (a -> m) -> U1 a -> m # foldr :: (a -> b -> b) -> b -> U1 a -> b # foldr' :: (a -> b -> b) -> b -> U1 a -> b # foldl :: (b -> a -> b) -> b -> U1 a -> b # foldl' :: (b -> a -> b) -> b -> U1 a -> b # foldr1 :: (a -> a -> a) -> U1 a -> a # foldl1 :: (a -> a -> a) -> U1 a -> a # elem :: Eq a => a -> U1 a -> Bool # maximum :: Ord a => U1 a -> a # | |
Foldable (UAddr :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UAddr m -> m # foldMap :: Monoid m => (a -> m) -> UAddr a -> m # foldMap' :: Monoid m => (a -> m) -> UAddr a -> m # foldr :: (a -> b -> b) -> b -> UAddr a -> b # foldr' :: (a -> b -> b) -> b -> UAddr a -> b # foldl :: (b -> a -> b) -> b -> UAddr a -> b # foldl' :: (b -> a -> b) -> b -> UAddr a -> b # foldr1 :: (a -> a -> a) -> UAddr a -> a # foldl1 :: (a -> a -> a) -> UAddr a -> a # elem :: Eq a => a -> UAddr a -> Bool # maximum :: Ord a => UAddr a -> a # minimum :: Ord a => UAddr a -> a # | |
Foldable (UChar :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UChar m -> m # foldMap :: Monoid m => (a -> m) -> UChar a -> m # foldMap' :: Monoid m => (a -> m) -> UChar a -> m # foldr :: (a -> b -> b) -> b -> UChar a -> b # foldr' :: (a -> b -> b) -> b -> UChar a -> b # foldl :: (b -> a -> b) -> b -> UChar a -> b # foldl' :: (b -> a -> b) -> b -> UChar a -> b # foldr1 :: (a -> a -> a) -> UChar a -> a # foldl1 :: (a -> a -> a) -> UChar a -> a # elem :: Eq a => a -> UChar a -> Bool # maximum :: Ord a => UChar a -> a # minimum :: Ord a => UChar a -> a # | |
Foldable (UDouble :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UDouble m -> m # foldMap :: Monoid m => (a -> m) -> UDouble a -> m # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m # foldr :: (a -> b -> b) -> b -> UDouble a -> b # foldr' :: (a -> b -> b) -> b -> UDouble a -> b # foldl :: (b -> a -> b) -> b -> UDouble a -> b # foldl' :: (b -> a -> b) -> b -> UDouble a -> b # foldr1 :: (a -> a -> a) -> UDouble a -> a # foldl1 :: (a -> a -> a) -> UDouble a -> a # elem :: Eq a => a -> UDouble a -> Bool # maximum :: Ord a => UDouble a -> a # minimum :: Ord a => UDouble a -> a # | |
Foldable (UFloat :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UFloat m -> m # foldMap :: Monoid m => (a -> m) -> UFloat a -> m # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m # foldr :: (a -> b -> b) -> b -> UFloat a -> b # foldr' :: (a -> b -> b) -> b -> UFloat a -> b # foldl :: (b -> a -> b) -> b -> UFloat a -> b # foldl' :: (b -> a -> b) -> b -> UFloat a -> b # foldr1 :: (a -> a -> a) -> UFloat a -> a # foldl1 :: (a -> a -> a) -> UFloat a -> a # elem :: Eq a => a -> UFloat a -> Bool # maximum :: Ord a => UFloat a -> a # minimum :: Ord a => UFloat a -> a # | |
Foldable (UInt :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UInt m -> m # foldMap :: Monoid m => (a -> m) -> UInt a -> m # foldMap' :: Monoid m => (a -> m) -> UInt a -> m # foldr :: (a -> b -> b) -> b -> UInt a -> b # foldr' :: (a -> b -> b) -> b -> UInt a -> b # foldl :: (b -> a -> b) -> b -> UInt a -> b # foldl' :: (b -> a -> b) -> b -> UInt a -> b # foldr1 :: (a -> a -> a) -> UInt a -> a # foldl1 :: (a -> a -> a) -> UInt a -> a # elem :: Eq a => a -> UInt a -> Bool # maximum :: Ord a => UInt a -> a # | |
Foldable (UWord :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UWord m -> m # foldMap :: Monoid m => (a -> m) -> UWord a -> m # foldMap' :: Monoid m => (a -> m) -> UWord a -> m # foldr :: (a -> b -> b) -> b -> UWord a -> b # foldr' :: (a -> b -> b) -> b -> UWord a -> b # foldl :: (b -> a -> b) -> b -> UWord a -> b # foldl' :: (b -> a -> b) -> b -> UWord a -> b # foldr1 :: (a -> a -> a) -> UWord a -> a # foldl1 :: (a -> a -> a) -> UWord a -> a # elem :: Eq a => a -> UWord a -> Bool # maximum :: Ord a => UWord a -> a # minimum :: Ord a => UWord a -> a # | |
Foldable (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => V1 m -> m # foldMap :: Monoid m => (a -> m) -> V1 a -> m # foldMap' :: Monoid m => (a -> m) -> V1 a -> m # foldr :: (a -> b -> b) -> b -> V1 a -> b # foldr' :: (a -> b -> b) -> b -> V1 a -> b # foldl :: (b -> a -> b) -> b -> V1 a -> b # foldl' :: (b -> a -> b) -> b -> V1 a -> b # foldr1 :: (a -> a -> a) -> V1 a -> a # foldl1 :: (a -> a -> a) -> V1 a -> a # elem :: Eq a => a -> V1 a -> Bool # maximum :: Ord a => V1 a -> a # | |
Foldable (Map k) | Folds in order of increasing key. |
Defined in Data.Map.Internal Methods fold :: Monoid m => Map k m -> m # foldMap :: Monoid m => (a -> m) -> Map k a -> m # foldMap' :: Monoid m => (a -> m) -> Map k a -> m # foldr :: (a -> b -> b) -> b -> Map k a -> b # foldr' :: (a -> b -> b) -> b -> Map k a -> b # foldl :: (b -> a -> b) -> b -> Map k a -> b # foldl' :: (b -> a -> b) -> b -> Map k a -> b # foldr1 :: (a -> a -> a) -> Map k a -> a # foldl1 :: (a -> a -> a) -> Map k a -> a # elem :: Eq a => a -> Map k a -> Bool # maximum :: Ord a => Map k a -> a # minimum :: Ord a => Map k a -> a # | |
Foldable (Either e) | |
Defined in Data.Strict.Either Methods fold :: Monoid m => Either e m -> m # foldMap :: Monoid m => (a -> m) -> Either e a -> m # foldMap' :: Monoid m => (a -> m) -> Either e a -> m # foldr :: (a -> b -> b) -> b -> Either e a -> b # foldr' :: (a -> b -> b) -> b -> Either e a -> b # foldl :: (b -> a -> b) -> b -> Either e a -> b # foldl' :: (b -> a -> b) -> b -> Either e a -> b # foldr1 :: (a -> a -> a) -> Either e a -> a # foldl1 :: (a -> a -> a) -> Either e a -> a # elem :: Eq a => a -> Either e a -> Bool # maximum :: Ord a => Either e a -> a # minimum :: Ord a => Either e a -> a # | |
Foldable (These a) | |
Defined in Data.Strict.These Methods fold :: Monoid m => These a m -> m # foldMap :: Monoid m => (a0 -> m) -> These a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> These a a0 -> m # foldr :: (a0 -> b -> b) -> b -> These a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> These a a0 -> b # foldl :: (b -> a0 -> b) -> b -> These a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> These a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 # toList :: These a a0 -> [a0] # elem :: Eq a0 => a0 -> These a a0 -> Bool # maximum :: Ord a0 => These a a0 -> a0 # minimum :: Ord a0 => These a a0 -> a0 # | |
Foldable (Pair e) | |
Defined in Data.Strict.Tuple Methods fold :: Monoid m => Pair e m -> m # foldMap :: Monoid m => (a -> m) -> Pair e a -> m # foldMap' :: Monoid m => (a -> m) -> Pair e a -> m # foldr :: (a -> b -> b) -> b -> Pair e a -> b # foldr' :: (a -> b -> b) -> b -> Pair e a -> b # foldl :: (b -> a -> b) -> b -> Pair e a -> b # foldl' :: (b -> a -> b) -> b -> Pair e a -> b # foldr1 :: (a -> a -> a) -> Pair e a -> a # foldl1 :: (a -> a -> a) -> Pair e a -> a # elem :: Eq a => a -> Pair e a -> Bool # maximum :: Ord a => Pair e a -> a # minimum :: Ord a => Pair e a -> a # | |
Foldable (These a) | |
Defined in Data.These Methods fold :: Monoid m => These a m -> m # foldMap :: Monoid m => (a0 -> m) -> These a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> These a a0 -> m # foldr :: (a0 -> b -> b) -> b -> These a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> These a a0 -> b # foldl :: (b -> a0 -> b) -> b -> These a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> These a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 # toList :: These a a0 -> [a0] # elem :: Eq a0 => a0 -> These a a0 -> Bool # maximum :: Ord a0 => These a a0 -> a0 # minimum :: Ord a0 => These a a0 -> a0 # | |
Foldable f => Foldable (Lift f) | |
Defined in Control.Applicative.Lift Methods fold :: Monoid m => Lift f m -> m # foldMap :: Monoid m => (a -> m) -> Lift f a -> m # foldMap' :: Monoid m => (a -> m) -> Lift f a -> m # foldr :: (a -> b -> b) -> b -> Lift f a -> b # foldr' :: (a -> b -> b) -> b -> Lift f a -> b # foldl :: (b -> a -> b) -> b -> Lift f a -> b # foldl' :: (b -> a -> b) -> b -> Lift f a -> b # foldr1 :: (a -> a -> a) -> Lift f a -> a # foldl1 :: (a -> a -> a) -> Lift f a -> a # elem :: Eq a => a -> Lift f a -> Bool # maximum :: Ord a => Lift f a -> a # minimum :: Ord a => Lift f a -> a # | |
Foldable f => Foldable (MaybeT f) | |
Defined in Control.Monad.Trans.Maybe Methods fold :: Monoid m => MaybeT f m -> m # foldMap :: Monoid m => (a -> m) -> MaybeT f a -> m # foldMap' :: Monoid m => (a -> m) -> MaybeT f a -> m # foldr :: (a -> b -> b) -> b -> MaybeT f a -> b # foldr' :: (a -> b -> b) -> b -> MaybeT f a -> b # foldl :: (b -> a -> b) -> b -> MaybeT f a -> b # foldl' :: (b -> a -> b) -> b -> MaybeT f a -> b # foldr1 :: (a -> a -> a) -> MaybeT f a -> a # foldl1 :: (a -> a -> a) -> MaybeT f a -> a # elem :: Eq a => a -> MaybeT f a -> Bool # maximum :: Ord a => MaybeT f a -> a # minimum :: Ord a => MaybeT f a -> a # | |
Foldable (HashMap k) | |
Defined in Data.HashMap.Internal Methods fold :: Monoid m => HashMap k m -> m # foldMap :: Monoid m => (a -> m) -> HashMap k a -> m # foldMap' :: Monoid m => (a -> m) -> HashMap k a -> m # foldr :: (a -> b -> b) -> b -> HashMap k a -> b # foldr' :: (a -> b -> b) -> b -> HashMap k a -> b # foldl :: (b -> a -> b) -> b -> HashMap k a -> b # foldl' :: (b -> a -> b) -> b -> HashMap k a -> b # foldr1 :: (a -> a -> a) -> HashMap k a -> a # foldl1 :: (a -> a -> a) -> HashMap k a -> a # toList :: HashMap k a -> [a] # length :: HashMap k a -> Int # elem :: Eq a => a -> HashMap k a -> Bool # maximum :: Ord a => HashMap k a -> a # minimum :: Ord a => HashMap k a -> a # | |
Foldable ((,) a) | Since: base-4.7.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => (a, m) -> m # foldMap :: Monoid m => (a0 -> m) -> (a, a0) -> m # foldMap' :: Monoid m => (a0 -> m) -> (a, a0) -> m # foldr :: (a0 -> b -> b) -> b -> (a, a0) -> b # foldr' :: (a0 -> b -> b) -> b -> (a, a0) -> b # foldl :: (b -> a0 -> b) -> b -> (a, a0) -> b # foldl' :: (b -> a0 -> b) -> b -> (a, a0) -> b # foldr1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 # foldl1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 # elem :: Eq a0 => a0 -> (a, a0) -> Bool # maximum :: Ord a0 => (a, a0) -> a0 # minimum :: Ord a0 => (a, a0) -> a0 # | |
Foldable (Const m :: Type -> Type) | Since: base-4.7.0.0 |
Defined in Data.Functor.Const Methods fold :: Monoid m0 => Const m m0 -> m0 # foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 # foldMap' :: Monoid m0 => (a -> m0) -> Const m a -> m0 # foldr :: (a -> b -> b) -> b -> Const m a -> b # foldr' :: (a -> b -> b) -> b -> Const m a -> b # foldl :: (b -> a -> b) -> b -> Const m a -> b # foldl' :: (b -> a -> b) -> b -> Const m a -> b # foldr1 :: (a -> a -> a) -> Const m a -> a # foldl1 :: (a -> a -> a) -> Const m a -> a # elem :: Eq a => a -> Const m a -> Bool # maximum :: Ord a => Const m a -> a # minimum :: Ord a => Const m a -> a # | |
Foldable f => Foldable (Ap f) | Since: base-4.12.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Ap f m -> m # foldMap :: Monoid m => (a -> m) -> Ap f a -> m # foldMap' :: Monoid m => (a -> m) -> Ap f a -> m # foldr :: (a -> b -> b) -> b -> Ap f a -> b # foldr' :: (a -> b -> b) -> b -> Ap f a -> b # foldl :: (b -> a -> b) -> b -> Ap f a -> b # foldl' :: (b -> a -> b) -> b -> Ap f a -> b # foldr1 :: (a -> a -> a) -> Ap f a -> a # foldl1 :: (a -> a -> a) -> Ap f a -> a # elem :: Eq a => a -> Ap f a -> Bool # maximum :: Ord a => Ap f a -> a # | |
Foldable f => Foldable (Alt f) | Since: base-4.12.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Alt f m -> m # foldMap :: Monoid m => (a -> m) -> Alt f a -> m # foldMap' :: Monoid m => (a -> m) -> Alt f a -> m # foldr :: (a -> b -> b) -> b -> Alt f a -> b # foldr' :: (a -> b -> b) -> b -> Alt f a -> b # foldl :: (b -> a -> b) -> b -> Alt f a -> b # foldl' :: (b -> a -> b) -> b -> Alt f a -> b # foldr1 :: (a -> a -> a) -> Alt f a -> a # foldl1 :: (a -> a -> a) -> Alt f a -> a # elem :: Eq a => a -> Alt f a -> Bool # maximum :: Ord a => Alt f a -> a # minimum :: Ord a => Alt f a -> a # | |
Foldable f => Foldable (Rec1 f) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Rec1 f m -> m # foldMap :: Monoid m => (a -> m) -> Rec1 f a -> m # foldMap' :: Monoid m => (a -> m) -> Rec1 f a -> m # foldr :: (a -> b -> b) -> b -> Rec1 f a -> b # foldr' :: (a -> b -> b) -> b -> Rec1 f a -> b # foldl :: (b -> a -> b) -> b -> Rec1 f a -> b # foldl' :: (b -> a -> b) -> b -> Rec1 f a -> b # foldr1 :: (a -> a -> a) -> Rec1 f a -> a # foldl1 :: (a -> a -> a) -> Rec1 f a -> a # elem :: Eq a => a -> Rec1 f a -> Bool # maximum :: Ord a => Rec1 f a -> a # minimum :: Ord a => Rec1 f a -> a # | |
Bifoldable p => Foldable (Fix p) | |
Defined in Data.Bifunctor.Fix Methods fold :: Monoid m => Fix p m -> m # foldMap :: Monoid m => (a -> m) -> Fix p a -> m # foldMap' :: Monoid m => (a -> m) -> Fix p a -> m # foldr :: (a -> b -> b) -> b -> Fix p a -> b # foldr' :: (a -> b -> b) -> b -> Fix p a -> b # foldl :: (b -> a -> b) -> b -> Fix p a -> b # foldl' :: (b -> a -> b) -> b -> Fix p a -> b # foldr1 :: (a -> a -> a) -> Fix p a -> a # foldl1 :: (a -> a -> a) -> Fix p a -> a # elem :: Eq a => a -> Fix p a -> Bool # maximum :: Ord a => Fix p a -> a # minimum :: Ord a => Fix p a -> a # | |
Bifoldable p => Foldable (Join p) | |
Defined in Data.Bifunctor.Join Methods fold :: Monoid m => Join p m -> m # foldMap :: Monoid m => (a -> m) -> Join p a -> m # foldMap' :: Monoid m => (a -> m) -> Join p a -> m # foldr :: (a -> b -> b) -> b -> Join p a -> b # foldr' :: (a -> b -> b) -> b -> Join p a -> b # foldl :: (b -> a -> b) -> b -> Join p a -> b # foldl' :: (b -> a -> b) -> b -> Join p a -> b # foldr1 :: (a -> a -> a) -> Join p a -> a # foldl1 :: (a -> a -> a) -> Join p a -> a # elem :: Eq a => a -> Join p a -> Bool # maximum :: Ord a => Join p a -> a # minimum :: Ord a => Join p a -> a # | |
Foldable (Tagged s) | |
Defined in Data.Tagged Methods fold :: Monoid m => Tagged s m -> m # foldMap :: Monoid m => (a -> m) -> Tagged s a -> m # foldMap' :: Monoid m => (a -> m) -> Tagged s a -> m # foldr :: (a -> b -> b) -> b -> Tagged s a -> b # foldr' :: (a -> b -> b) -> b -> Tagged s a -> b # foldl :: (b -> a -> b) -> b -> Tagged s a -> b # foldl' :: (b -> a -> b) -> b -> Tagged s a -> b # foldr1 :: (a -> a -> a) -> Tagged s a -> a # foldl1 :: (a -> a -> a) -> Tagged s a -> a # elem :: Eq a => a -> Tagged s a -> Bool # maximum :: Ord a => Tagged s a -> a # minimum :: Ord a => Tagged s a -> a # | |
(Foldable f, Foldable g) => Foldable (These1 f g) | |
Defined in Data.Functor.These Methods fold :: Monoid m => These1 f g m -> m # foldMap :: Monoid m => (a -> m) -> These1 f g a -> m # foldMap' :: Monoid m => (a -> m) -> These1 f g a -> m # foldr :: (a -> b -> b) -> b -> These1 f g a -> b # foldr' :: (a -> b -> b) -> b -> These1 f g a -> b # foldl :: (b -> a -> b) -> b -> These1 f g a -> b # foldl' :: (b -> a -> b) -> b -> These1 f g a -> b # foldr1 :: (a -> a -> a) -> These1 f g a -> a # foldl1 :: (a -> a -> a) -> These1 f g a -> a # toList :: These1 f g a -> [a] # null :: These1 f g a -> Bool # length :: These1 f g a -> Int # elem :: Eq a => a -> These1 f g a -> Bool # maximum :: Ord a => These1 f g a -> a # minimum :: Ord a => These1 f g a -> a # | |
Foldable f => Foldable (Backwards f) | Derived instance. |
Defined in Control.Applicative.Backwards Methods fold :: Monoid m => Backwards f m -> m # foldMap :: Monoid m => (a -> m) -> Backwards f a -> m # foldMap' :: Monoid m => (a -> m) -> Backwards f a -> m # foldr :: (a -> b -> b) -> b -> Backwards f a -> b # foldr' :: (a -> b -> b) -> b -> Backwards f a -> b # foldl :: (b -> a -> b) -> b -> Backwards f a -> b # foldl' :: (b -> a -> b) -> b -> Backwards f a -> b # foldr1 :: (a -> a -> a) -> Backwards f a -> a # foldl1 :: (a -> a -> a) -> Backwards f a -> a # toList :: Backwards f a -> [a] # null :: Backwards f a -> Bool # length :: Backwards f a -> Int # elem :: Eq a => a -> Backwards f a -> Bool # maximum :: Ord a => Backwards f a -> a # minimum :: Ord a => Backwards f a -> a # | |
Foldable f => Foldable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except Methods fold :: Monoid m => ExceptT e f m -> m # foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldr1 :: (a -> a -> a) -> ExceptT e f a -> a # foldl1 :: (a -> a -> a) -> ExceptT e f a -> a # toList :: ExceptT e f a -> [a] # null :: ExceptT e f a -> Bool # length :: ExceptT e f a -> Int # elem :: Eq a => a -> ExceptT e f a -> Bool # maximum :: Ord a => ExceptT e f a -> a # minimum :: Ord a => ExceptT e f a -> a # | |
Foldable f => Foldable (IdentityT f) | |
Defined in Control.Monad.Trans.Identity Methods fold :: Monoid m => IdentityT f m -> m # foldMap :: Monoid m => (a -> m) -> IdentityT f a -> m # foldMap' :: Monoid m => (a -> m) -> IdentityT f a -> m # foldr :: (a -> b -> b) -> b -> IdentityT f a -> b # foldr' :: (a -> b -> b) -> b -> IdentityT f a -> b # foldl :: (b -> a -> b) -> b -> IdentityT f a -> b # foldl' :: (b -> a -> b) -> b -> IdentityT f a -> b # foldr1 :: (a -> a -> a) -> IdentityT f a -> a # foldl1 :: (a -> a -> a) -> IdentityT f a -> a # toList :: IdentityT f a -> [a] # null :: IdentityT f a -> Bool # length :: IdentityT f a -> Int # elem :: Eq a => a -> IdentityT f a -> Bool # maximum :: Ord a => IdentityT f a -> a # minimum :: Ord a => IdentityT f a -> a # | |
Foldable f => Foldable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Lazy Methods fold :: Monoid m => WriterT w f m -> m # foldMap :: Monoid m => (a -> m) -> WriterT w f a -> m # foldMap' :: Monoid m => (a -> m) -> WriterT w f a -> m # foldr :: (a -> b -> b) -> b -> WriterT w f a -> b # foldr' :: (a -> b -> b) -> b -> WriterT w f a -> b # foldl :: (b -> a -> b) -> b -> WriterT w f a -> b # foldl' :: (b -> a -> b) -> b -> WriterT w f a -> b # foldr1 :: (a -> a -> a) -> WriterT w f a -> a # foldl1 :: (a -> a -> a) -> WriterT w f a -> a # toList :: WriterT w f a -> [a] # null :: WriterT w f a -> Bool # length :: WriterT w f a -> Int # elem :: Eq a => a -> WriterT w f a -> Bool # maximum :: Ord a => WriterT w f a -> a # minimum :: Ord a => WriterT w f a -> a # | |
Foldable f => Foldable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Strict Methods fold :: Monoid m => WriterT w f m -> m # foldMap :: Monoid m => (a -> m) -> WriterT w f a -> m # foldMap' :: Monoid m => (a -> m) -> WriterT w f a -> m # foldr :: (a -> b -> b) -> b -> WriterT w f a -> b # foldr' :: (a -> b -> b) -> b -> WriterT w f a -> b # foldl :: (b -> a -> b) -> b -> WriterT w f a -> b # foldl' :: (b -> a -> b) -> b -> WriterT w f a -> b # foldr1 :: (a -> a -> a) -> WriterT w f a -> a # foldl1 :: (a -> a -> a) -> WriterT w f a -> a # toList :: WriterT w f a -> [a] # null :: WriterT w f a -> Bool # length :: WriterT w f a -> Int # elem :: Eq a => a -> WriterT w f a -> Bool # maximum :: Ord a => WriterT w f a -> a # minimum :: Ord a => WriterT w f a -> a # | |
Foldable (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant Methods fold :: Monoid m => Constant a m -> m # foldMap :: Monoid m => (a0 -> m) -> Constant a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Constant a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Constant a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Constant a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Constant a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Constant a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 # toList :: Constant a a0 -> [a0] # null :: Constant a a0 -> Bool # length :: Constant a a0 -> Int # elem :: Eq a0 => a0 -> Constant a a0 -> Bool # maximum :: Ord a0 => Constant a a0 -> a0 # minimum :: Ord a0 => Constant a a0 -> a0 # | |
Foldable f => Foldable (Reverse f) | Fold from right to left. |
Defined in Data.Functor.Reverse Methods fold :: Monoid m => Reverse f m -> m # foldMap :: Monoid m => (a -> m) -> Reverse f a -> m # foldMap' :: Monoid m => (a -> m) -> Reverse f a -> m # foldr :: (a -> b -> b) -> b -> Reverse f a -> b # foldr' :: (a -> b -> b) -> b -> Reverse f a -> b # foldl :: (b -> a -> b) -> b -> Reverse f a -> b # foldl' :: (b -> a -> b) -> b -> Reverse f a -> b # foldr1 :: (a -> a -> a) -> Reverse f a -> a # foldl1 :: (a -> a -> a) -> Reverse f a -> a # toList :: Reverse f a -> [a] # length :: Reverse f a -> Int # elem :: Eq a => a -> Reverse f a -> Bool # maximum :: Ord a => Reverse f a -> a # minimum :: Ord a => Reverse f a -> a # | |
(Foldable f, Foldable g) => Foldable (Product f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product Methods fold :: Monoid m => Product f g m -> m # foldMap :: Monoid m => (a -> m) -> Product f g a -> m # foldMap' :: Monoid m => (a -> m) -> Product f g a -> m # foldr :: (a -> b -> b) -> b -> Product f g a -> b # foldr' :: (a -> b -> b) -> b -> Product f g a -> b # foldl :: (b -> a -> b) -> b -> Product f g a -> b # foldl' :: (b -> a -> b) -> b -> Product f g a -> b # foldr1 :: (a -> a -> a) -> Product f g a -> a # foldl1 :: (a -> a -> a) -> Product f g a -> a # toList :: Product f g a -> [a] # null :: Product f g a -> Bool # length :: Product f g a -> Int # elem :: Eq a => a -> Product f g a -> Bool # maximum :: Ord a => Product f g a -> a # minimum :: Ord a => Product f g a -> a # | |
(Foldable f, Foldable g) => Foldable (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum Methods fold :: Monoid m => Sum f g m -> m # foldMap :: Monoid m => (a -> m) -> Sum f g a -> m # foldMap' :: Monoid m => (a -> m) -> Sum f g a -> m # foldr :: (a -> b -> b) -> b -> Sum f g a -> b # foldr' :: (a -> b -> b) -> b -> Sum f g a -> b # foldl :: (b -> a -> b) -> b -> Sum f g a -> b # foldl' :: (b -> a -> b) -> b -> Sum f g a -> b # foldr1 :: (a -> a -> a) -> Sum f g a -> a # foldl1 :: (a -> a -> a) -> Sum f g a -> a # elem :: Eq a => a -> Sum f g a -> Bool # maximum :: Ord a => Sum f g a -> a # minimum :: Ord a => Sum f g a -> a # | |
(Foldable f, Foldable g) => Foldable (f :*: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => (f :*: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldr1 :: (a -> a -> a) -> (f :*: g) a -> a # foldl1 :: (a -> a -> a) -> (f :*: g) a -> a # toList :: (f :*: g) a -> [a] # length :: (f :*: g) a -> Int # elem :: Eq a => a -> (f :*: g) a -> Bool # maximum :: Ord a => (f :*: g) a -> a # minimum :: Ord a => (f :*: g) a -> a # | |
(Foldable f, Foldable g) => Foldable (f :+: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => (f :+: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldr1 :: (a -> a -> a) -> (f :+: g) a -> a # foldl1 :: (a -> a -> a) -> (f :+: g) a -> a # toList :: (f :+: g) a -> [a] # length :: (f :+: g) a -> Int # elem :: Eq a => a -> (f :+: g) a -> Bool # maximum :: Ord a => (f :+: g) a -> a # minimum :: Ord a => (f :+: g) a -> a # | |
Foldable (K1 i c :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => K1 i c m -> m # foldMap :: Monoid m => (a -> m) -> K1 i c a -> m # foldMap' :: Monoid m => (a -> m) -> K1 i c a -> m # foldr :: (a -> b -> b) -> b -> K1 i c a -> b # foldr' :: (a -> b -> b) -> b -> K1 i c a -> b # foldl :: (b -> a -> b) -> b -> K1 i c a -> b # foldl' :: (b -> a -> b) -> b -> K1 i c a -> b # foldr1 :: (a -> a -> a) -> K1 i c a -> a # foldl1 :: (a -> a -> a) -> K1 i c a -> a # elem :: Eq a => a -> K1 i c a -> Bool # maximum :: Ord a => K1 i c a -> a # minimum :: Ord a => K1 i c a -> a # | |
(Foldable f, Foldable g) => Foldable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose Methods fold :: Monoid m => Compose f g m -> m # foldMap :: Monoid m => (a -> m) -> Compose f g a -> m # foldMap' :: Monoid m => (a -> m) -> Compose f g a -> m # foldr :: (a -> b -> b) -> b -> Compose f g a -> b # foldr' :: (a -> b -> b) -> b -> Compose f g a -> b # foldl :: (b -> a -> b) -> b -> Compose f g a -> b # foldl' :: (b -> a -> b) -> b -> Compose f g a -> b # foldr1 :: (a -> a -> a) -> Compose f g a -> a # foldl1 :: (a -> a -> a) -> Compose f g a -> a # toList :: Compose f g a -> [a] # null :: Compose f g a -> Bool # length :: Compose f g a -> Int # elem :: Eq a => a -> Compose f g a -> Bool # maximum :: Ord a => Compose f g a -> a # minimum :: Ord a => Compose f g a -> a # | |
(Foldable f, Foldable g) => Foldable (f :.: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => (f :.: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :.: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :.: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :.: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :.: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :.: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :.: g) a -> b # foldr1 :: (a -> a -> a) -> (f :.: g) a -> a # foldl1 :: (a -> a -> a) -> (f :.: g) a -> a # toList :: (f :.: g) a -> [a] # length :: (f :.: g) a -> Int # elem :: Eq a => a -> (f :.: g) a -> Bool # maximum :: Ord a => (f :.: g) a -> a # minimum :: Ord a => (f :.: g) a -> a # | |
Foldable f => Foldable (M1 i c f) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => M1 i c f m -> m # foldMap :: Monoid m => (a -> m) -> M1 i c f a -> m # foldMap' :: Monoid m => (a -> m) -> M1 i c f a -> m # foldr :: (a -> b -> b) -> b -> M1 i c f a -> b # foldr' :: (a -> b -> b) -> b -> M1 i c f a -> b # foldl :: (b -> a -> b) -> b -> M1 i c f a -> b # foldl' :: (b -> a -> b) -> b -> M1 i c f a -> b # foldr1 :: (a -> a -> a) -> M1 i c f a -> a # foldl1 :: (a -> a -> a) -> M1 i c f a -> a # elem :: Eq a => a -> M1 i c f a -> Bool # maximum :: Ord a => M1 i c f a -> a # minimum :: Ord a => M1 i c f a -> a # | |
Foldable (Clown f a :: Type -> Type) | |
Defined in Data.Bifunctor.Clown Methods fold :: Monoid m => Clown f a m -> m # foldMap :: Monoid m => (a0 -> m) -> Clown f a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Clown f a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Clown f a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Clown f a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Clown f a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Clown f a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Clown f a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Clown f a a0 -> a0 # toList :: Clown f a a0 -> [a0] # null :: Clown f a a0 -> Bool # length :: Clown f a a0 -> Int # elem :: Eq a0 => a0 -> Clown f a a0 -> Bool # maximum :: Ord a0 => Clown f a a0 -> a0 # minimum :: Ord a0 => Clown f a a0 -> a0 # | |
Bifoldable p => Foldable (Flip p a) | |
Defined in Data.Bifunctor.Flip Methods fold :: Monoid m => Flip p a m -> m # foldMap :: Monoid m => (a0 -> m) -> Flip p a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Flip p a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Flip p a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Flip p a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Flip p a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Flip p a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Flip p a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Flip p a a0 -> a0 # toList :: Flip p a a0 -> [a0] # length :: Flip p a a0 -> Int # elem :: Eq a0 => a0 -> Flip p a a0 -> Bool # maximum :: Ord a0 => Flip p a a0 -> a0 # minimum :: Ord a0 => Flip p a a0 -> a0 # | |
Foldable g => Foldable (Joker g a) | |
Defined in Data.Bifunctor.Joker Methods fold :: Monoid m => Joker g a m -> m # foldMap :: Monoid m => (a0 -> m) -> Joker g a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Joker g a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Joker g a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Joker g a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Joker g a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Joker g a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Joker g a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Joker g a a0 -> a0 # toList :: Joker g a a0 -> [a0] # null :: Joker g a a0 -> Bool # length :: Joker g a a0 -> Int # elem :: Eq a0 => a0 -> Joker g a a0 -> Bool # maximum :: Ord a0 => Joker g a a0 -> a0 # minimum :: Ord a0 => Joker g a a0 -> a0 # | |
Bifoldable p => Foldable (WrappedBifunctor p a) | |
Defined in Data.Bifunctor.Wrapped Methods fold :: Monoid m => WrappedBifunctor p a m -> m # foldMap :: Monoid m => (a0 -> m) -> WrappedBifunctor p a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> WrappedBifunctor p a a0 -> m # foldr :: (a0 -> b -> b) -> b -> WrappedBifunctor p a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> WrappedBifunctor p a a0 -> b # foldl :: (b -> a0 -> b) -> b -> WrappedBifunctor p a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> WrappedBifunctor p a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> WrappedBifunctor p a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> WrappedBifunctor p a a0 -> a0 # toList :: WrappedBifunctor p a a0 -> [a0] # null :: WrappedBifunctor p a a0 -> Bool # length :: WrappedBifunctor p a a0 -> Int # elem :: Eq a0 => a0 -> WrappedBifunctor p a a0 -> Bool # maximum :: Ord a0 => WrappedBifunctor p a a0 -> a0 # minimum :: Ord a0 => WrappedBifunctor p a a0 -> a0 # sum :: Num a0 => WrappedBifunctor p a a0 -> a0 # product :: Num a0 => WrappedBifunctor p a a0 -> a0 # | |
(Foldable (f a), Foldable (g a)) => Foldable (Product f g a) | |
Defined in Data.Bifunctor.Product Methods fold :: Monoid m => Product f g a m -> m # foldMap :: Monoid m => (a0 -> m) -> Product f g a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Product f g a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Product f g a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Product f g a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Product f g a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Product f g a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Product f g a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Product f g a a0 -> a0 # toList :: Product f g a a0 -> [a0] # null :: Product f g a a0 -> Bool # length :: Product f g a a0 -> Int # elem :: Eq a0 => a0 -> Product f g a a0 -> Bool # maximum :: Ord a0 => Product f g a a0 -> a0 # minimum :: Ord a0 => Product f g a a0 -> a0 # | |
(Foldable (f a), Foldable (g a)) => Foldable (Sum f g a) | |
Defined in Data.Bifunctor.Sum Methods fold :: Monoid m => Sum f g a m -> m # foldMap :: Monoid m => (a0 -> m) -> Sum f g a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Sum f g a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Sum f g a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Sum f g a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Sum f g a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Sum f g a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Sum f g a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Sum f g a a0 -> a0 # toList :: Sum f g a a0 -> [a0] # null :: Sum f g a a0 -> Bool # length :: Sum f g a a0 -> Int # elem :: Eq a0 => a0 -> Sum f g a a0 -> Bool # maximum :: Ord a0 => Sum f g a a0 -> a0 # minimum :: Ord a0 => Sum f g a a0 -> a0 # | |
(Foldable f, Bifoldable p) => Foldable (Tannen f p a) | |
Defined in Data.Bifunctor.Tannen Methods fold :: Monoid m => Tannen f p a m -> m # foldMap :: Monoid m => (a0 -> m) -> Tannen f p a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Tannen f p a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Tannen f p a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Tannen f p a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Tannen f p a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Tannen f p a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Tannen f p a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Tannen f p a a0 -> a0 # toList :: Tannen f p a a0 -> [a0] # null :: Tannen f p a a0 -> Bool # length :: Tannen f p a a0 -> Int # elem :: Eq a0 => a0 -> Tannen f p a a0 -> Bool # maximum :: Ord a0 => Tannen f p a a0 -> a0 # minimum :: Ord a0 => Tannen f p a a0 -> a0 # | |
(Bifoldable p, Foldable g) => Foldable (Biff p f g a) | |
Defined in Data.Bifunctor.Biff Methods fold :: Monoid m => Biff p f g a m -> m # foldMap :: Monoid m => (a0 -> m) -> Biff p f g a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Biff p f g a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Biff p f g a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Biff p f g a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Biff p f g a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Biff p f g a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Biff p f g a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Biff p f g a a0 -> a0 # toList :: Biff p f g a a0 -> [a0] # null :: Biff p f g a a0 -> Bool # length :: Biff p f g a a0 -> Int # elem :: Eq a0 => a0 -> Biff p f g a a0 -> Bool # maximum :: Ord a0 => Biff p f g a a0 -> a0 # minimum :: Ord a0 => Biff p f g a a0 -> a0 # |
class Monad m => MonadFail (m :: Type -> Type) where #
When a value is bound in do
-notation, the pattern on the left
hand side of <-
might not match. In this case, this class
provides a function to recover.
A Monad
without a MonadFail
instance may only be used in conjunction
with pattern that always match, such as newtypes, tuples, data types with
only a single data constructor, and irrefutable patterns (~pat
).
Instances of MonadFail
should satisfy the following law: fail s
should
be a left zero for >>=
,
fail s >>= f = fail s
If your Monad
is also MonadPlus
, a popular definition is
fail _ = mzero
fail s
should be an action that runs in the monad itself, not an
exception (except in instances of MonadIO
). In particular,
fail
should not be implemented in terms of error
.
Since: base-4.9.0.0
Instances
Basic numeric class.
The Haskell Report defines no laws for Num
. However, (
and +
)(
are
customarily expected to define a ring and have the following properties:*
)
- Associativity of
(
+
) (x + y) + z
=x + (y + z)
- Commutativity of
(
+
) x + y
=y + x
is the additive identityfromInteger
0x + fromInteger 0
=x
negate
gives the additive inversex + negate x
=fromInteger 0
- Associativity of
(
*
) (x * y) * z
=x * (y * z)
is the multiplicative identityfromInteger
1x * fromInteger 1
=x
andfromInteger 1 * x
=x
- Distributivity of
(
with respect to*
)(
+
) a * (b + c)
=(a * b) + (a * c)
and(b + c) * a
=(b * a) + (c * a)
- Coherence with
toInteger
- if the type also implements
Integral
, thenfromInteger
is a left inverse fortoInteger
, i.e.fromInteger (toInteger i) == i
Note that it isn't customarily expected that a type instance of both Num
and Ord
implement an ordered ring. Indeed, in base
only Integer
and
Rational
do.
Instances
Num Pos | |
Num CBool | |
Num CChar | |
Num CClock | |
Num CDouble | |
Num CFloat | |
Num CInt | |
Num CIntMax | |
Num CIntPtr | |
Num CLLong | |
Num CLong | |
Num CPtrdiff | |
Num CSChar | |
Num CSUSeconds | |
Defined in Foreign.C.Types Methods (+) :: CSUSeconds -> CSUSeconds -> CSUSeconds # (-) :: CSUSeconds -> CSUSeconds -> CSUSeconds # (*) :: CSUSeconds -> CSUSeconds -> CSUSeconds # negate :: CSUSeconds -> CSUSeconds # abs :: CSUSeconds -> CSUSeconds # signum :: CSUSeconds -> CSUSeconds # fromInteger :: Integer -> CSUSeconds # | |
Num CShort | |
Num CSigAtomic | |
Defined in Foreign.C.Types Methods (+) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (-) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (*) :: CSigAtomic -> CSigAtomic -> CSigAtomic # negate :: CSigAtomic -> CSigAtomic # abs :: CSigAtomic -> CSigAtomic # signum :: CSigAtomic -> CSigAtomic # fromInteger :: Integer -> CSigAtomic # | |
Num CSize | |
Num CTime | |
Num CUChar | |
Num CUInt | |
Num CUIntMax | |
Num CUIntPtr | |
Num CULLong | |
Num CULong | |
Num CUSeconds | |
Defined in Foreign.C.Types | |
Num CUShort | |
Num CWchar | |
Num Word16 | Since: base-2.1 |
Num Word32 | Since: base-2.1 |
Num Word64 | Since: base-2.1 |
Num Word8 | Since: base-2.1 |
Num CBlkCnt | |
Num CBlkSize | |
Num CCc | |
Num CClockId | |
Num CDev | |
Num CFsBlkCnt | |
Defined in System.Posix.Types | |
Num CFsFilCnt | |
Defined in System.Posix.Types | |
Num CGid | |
Num CId | |
Num CIno | |
Num CKey | |
Num CMode | |
Num CNfds | |
Num CNlink | |
Num COff | |
Num CPid | |
Num CRLim | |
Num CSocklen | |
Num CSpeed | |
Num CSsize | |
Num CTcflag | |
Num CUid | |
Num Fd | |
Num Half | |
Num Scientific | WARNING: |
Defined in Data.Scientific Methods (+) :: Scientific -> Scientific -> Scientific # (-) :: Scientific -> Scientific -> Scientific # (*) :: Scientific -> Scientific -> Scientific # negate :: Scientific -> Scientific # abs :: Scientific -> Scientific # signum :: Scientific -> Scientific # fromInteger :: Integer -> Scientific # | |
Num B | |
Num DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime | |
Num NominalDiffTime | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods (+) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # (-) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # (*) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # negate :: NominalDiffTime -> NominalDiffTime # abs :: NominalDiffTime -> NominalDiffTime # signum :: NominalDiffTime -> NominalDiffTime # fromInteger :: Integer -> NominalDiffTime # | |
Num Size | |
Num Integer | Since: base-2.1 |
Num Natural | Note that Since: base-4.8.0.0 |
Num Int | Since: base-2.1 |
Num Word | Since: base-2.1 |
RealFloat a => Num (Complex a) | Since: base-2.1 |
Num a => Num (Identity a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Identity | |
Num a => Num (Down a) | Since: base-4.11.0.0 |
Num a => Num (Max a) | Since: base-4.9.0.0 |
Num a => Num (Min a) | Since: base-4.9.0.0 |
Num a => Num (Product a) | Since: base-4.7.0.0 |
Defined in Data.Semigroup.Internal | |
Num a => Num (Sum a) | Since: base-4.7.0.0 |
Integral a => Num (Ratio a) | Since: base-2.0.1 |
HasResolution a => Num (Fixed a) | Since: base-2.1 |
Num a => Num (Const a b) | Since: base-4.9.0.0 |
Defined in Data.Functor.Const | |
(Applicative f, Num a) => Num (Ap f a) | Note that even if the underlying Commutativity:
Additive inverse:
Distributivity:
Since: base-4.12.0.0 |
Num (f a) => Num (Alt f a) | Since: base-4.8.0.0 |
Num a => Num (Tagged s a) | |
Defined in Data.Tagged |
The abstract data type
represents pretty documents that have
been annotated with data of type Doc
annann
.
More specifically, a value of type
represents a non-empty set of
possible layouts of a document. The layout functions select one of these
possibilities, taking into account things like the width of the output
document.Doc
The annotation is an arbitrary piece of data associated with (part of) a document. Annotations may be used by the rendering backends in order to display output differently, such as
- color information (e.g. when rendering to the terminal)
- mouseover text (e.g. when rendering to rich HTML)
- whether to show something or not (to allow simple or detailed versions)
The simplest way to display a Doc
is via the Show
class.
>>>
putStrLn (show (vsep ["hello", "world"]))
hello world
Instances
Methods
pretty :: a -> Doc ann Source #
>>>
pretty 1 <+> pretty "hello" <+> pretty 1.234
1 hello 1.234
Instances
Pretty Void | Finding a good example for printing something that does not exist is hard, so here is an example of printing a list full of nothing.
|
Pretty Int16 | |
Pretty Int32 | |
Pretty Int64 | |
Pretty Int8 | |
Pretty Word16 | |
Pretty Word32 | |
Pretty Word64 | |
Pretty Word8 | |
Pretty Metadata Source # | |
Pretty PathData Source # | |
Pretty PathTypeW Source # | |
Pretty Timestamp Source # | |
Pretty Text | Automatically converts all newlines to
Note that
Manually use |
Pretty Text | (lazy |
Pretty Integer |
|
Pretty Natural | |
Pretty () |
The argument is not used:
|
Defined in Prettyprinter.Internal | |
Pretty Bool |
|
Pretty Char | Instead of
|
Pretty Double |
|
Pretty Float |
|
Pretty Int |
|
Pretty Word | |
Pretty a => Pretty (Identity a) |
|
Pretty a => Pretty (NonEmpty a) | |
Pretty a => Pretty (Positive a) | Since: smart-math-0.1 |
Pretty a => Pretty (Maybe a) | Ignore
|
Pretty a => Pretty [a] |
|
Defined in Prettyprinter.Internal | |
(Pretty a1, Pretty a2) => Pretty (a1, a2) |
|
Defined in Prettyprinter.Internal | |
Pretty a => Pretty (Const a b) | |
(Pretty a1, Pretty a2, Pretty a3) => Pretty (a1, a2, a3) |
|
Defined in Prettyprinter.Internal |
8-bit unsigned integer type
Instances
Haskell defines operations to read and write characters from and to files,
represented by values of type Handle
. Each value of this type is a
handle: a record used by the Haskell run-time system to manage I/O
with file system objects. A handle has at least the following properties:
- whether it manages input or output or both;
- whether it is open, closed or semi-closed;
- whether the object is seekable;
- whether buffering is disabled, or enabled on a line or block basis;
- a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating where the next
input or output operation will occur. A handle is readable if it
manages only input or both input and output; likewise, it is writable if
it manages only output or both input and output. A handle is open when
first allocated.
Once it is closed it can no longer be used for either input or output,
though an implementation cannot re-use its storage while references
remain to it. Handles are in the Show
and Eq
classes. The string
produced by showing a handle is system dependent; it should include
enough information to identify the handle for debugging. A handle is
equal according to ==
only to itself; no attempt
is made to compare the internal state of different handles for equality.
Instances
16-bit unsigned integer type
Instances
class (forall a. Functor (p a)) => Bifunctor (p :: Type -> Type -> Type) where #
A bifunctor is a type constructor that takes
two type arguments and is a functor in both arguments. That
is, unlike with Functor
, a type constructor such as Either
does not need to be partially applied for a Bifunctor
instance, and the methods in this class permit mapping
functions over the Left
value or the Right
value,
or both at the same time.
Formally, the class Bifunctor
represents a bifunctor
from Hask
-> Hask
.
Intuitively it is a bifunctor where both the first and second arguments are covariant.
You can define a Bifunctor
by either defining bimap
or by
defining both first
and second
. A partially applied Bifunctor
must be a Functor
and the second
method must agree with fmap
.
From this it follows that:
second
id
=id
If you supply bimap
, you should ensure that:
bimap
id
id
≡id
If you supply first
and second
, ensure:
first
id
≡id
second
id
≡id
If you supply both, you should also ensure:
bimap
f g ≡first
f.
second
g
These ensure by parametricity:
bimap
(f.
g) (h.
i) ≡bimap
f h.
bimap
g ifirst
(f.
g) ≡first
f.
first
gsecond
(f.
g) ≡second
f.
second
g
Since 4.18.0.0 Functor
is a superclass of 'Bifunctor.
Since: base-4.8.0.0
Methods
Instances
Bifunctor Either | Since: base-4.8.0.0 |
Bifunctor Arg | Since: base-4.9.0.0 |
Bifunctor Either | |
Bifunctor These | |
Bifunctor Pair | |
Bifunctor These | |
Bifunctor (,) | Class laws for tuples hold only up to laziness. Both
Since: base-4.8.0.0 |
Bifunctor (Const :: Type -> Type -> Type) | Since: base-4.8.0.0 |
Bifunctor (Tagged :: Type -> Type -> Type) | |
Bifunctor (Constant :: Type -> Type -> Type) | |
Bifunctor ((,,) x1) | Since: base-4.8.0.0 |
Bifunctor (K1 i :: Type -> Type -> Type) | Since: base-4.9.0.0 |
Bifunctor ((,,,) x1 x2) | Since: base-4.8.0.0 |
Functor f => Bifunctor (Clown f :: Type -> Type -> Type) | |
Bifunctor p => Bifunctor (Flip p) | |
Functor g => Bifunctor (Joker g :: Type -> Type -> Type) | |
Bifunctor p => Bifunctor (WrappedBifunctor p) | |
Defined in Data.Bifunctor.Wrapped Methods bimap :: (a -> b) -> (c -> d) -> WrappedBifunctor p a c -> WrappedBifunctor p b d # first :: (a -> b) -> WrappedBifunctor p a c -> WrappedBifunctor p b c # second :: (b -> c) -> WrappedBifunctor p a b -> WrappedBifunctor p a c # | |
Bifunctor ((,,,,) x1 x2 x3) | Since: base-4.8.0.0 |
(Bifunctor f, Bifunctor g) => Bifunctor (Product f g) | |
(Bifunctor p, Bifunctor q) => Bifunctor (Sum p q) | |
Bifunctor ((,,,,,) x1 x2 x3 x4) | Since: base-4.8.0.0 |
(Functor f, Bifunctor p) => Bifunctor (Tannen f p) | |
Bifunctor ((,,,,,,) x1 x2 x3 x4 x5) | Since: base-4.8.0.0 |
(Bifunctor p, Functor f, Functor g) => Bifunctor (Biff p f g) | |
class (Typeable e, Show e) => Exception e where #
Any type that you wish to throw or catch as an exception must be an
instance of the Exception
class. The simplest case is a new exception
type directly below the root:
data MyException = ThisException | ThatException deriving Show instance Exception MyException
The default method definitions in the Exception
class do what we need
in this case. You can now throw and catch ThisException
and
ThatException
as exceptions:
*Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException)) Caught ThisException
In more complicated examples, you may wish to define a whole hierarchy of exceptions:
--------------------------------------------------------------------- -- Make the root exception type for all the exceptions in a compiler data SomeCompilerException = forall e . Exception e => SomeCompilerException e instance Show SomeCompilerException where show (SomeCompilerException e) = show e instance Exception SomeCompilerException compilerExceptionToException :: Exception e => e -> SomeException compilerExceptionToException = toException . SomeCompilerException compilerExceptionFromException :: Exception e => SomeException -> Maybe e compilerExceptionFromException x = do SomeCompilerException a <- fromException x cast a --------------------------------------------------------------------- -- Make a subhierarchy for exceptions in the frontend of the compiler data SomeFrontendException = forall e . Exception e => SomeFrontendException e instance Show SomeFrontendException where show (SomeFrontendException e) = show e instance Exception SomeFrontendException where toException = compilerExceptionToException fromException = compilerExceptionFromException frontendExceptionToException :: Exception e => e -> SomeException frontendExceptionToException = toException . SomeFrontendException frontendExceptionFromException :: Exception e => SomeException -> Maybe e frontendExceptionFromException x = do SomeFrontendException a <- fromException x cast a --------------------------------------------------------------------- -- Make an exception type for a particular frontend compiler exception data MismatchedParentheses = MismatchedParentheses deriving Show instance Exception MismatchedParentheses where toException = frontendExceptionToException fromException = frontendExceptionFromException
We can now catch a MismatchedParentheses
exception as
MismatchedParentheses
, SomeFrontendException
or
SomeCompilerException
, but not other types, e.g. IOException
:
*Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException)) *** Exception: MismatchedParentheses
Minimal complete definition
Nothing
Methods
displayException :: e -> String #
Render this exception value in a human-friendly manner.
Default implementation:
.show
Since: base-4.8.0.0
Instances
class Monad m => MonadIO (m :: Type -> Type) where #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Methods
Lift a computation from the IO
monad.
This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations
(i.e. IO
is the base monad for the stack).
Example
import Control.Monad.Trans.State -- from the "transformers" library printState :: Show s => StateT s IO () printState = do state <- get liftIO $ print state
Had we omitted
, we would have ended up with this error:liftIO
• Couldn't match type ‘IO’ with ‘StateT s IO’ Expected type: StateT s IO () Actual type: IO ()
The important part here is the mismatch between StateT s IO ()
and
.IO
()
Luckily, we know of a function that takes an
and returns an IO
a(m a)
:
,
enabling us to run the program and see the expected results:liftIO
> evalStateT printState "hello" "hello" > evalStateT printState 3 3
Instances
data IOException #
Exceptions that occur in the IO
monad.
An IOException
records a more specific error type, a descriptive
string and maybe the handle that was used when the error was
flagged.
Instances
Exception IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # | |
Show IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> IOException -> ShowS # show :: IOException -> String # showList :: [IOException] -> ShowS # | |
Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
Class for string-like datastructures; used by the overloaded string extension (-XOverloadedStrings in GHC).
Methods
fromString :: String -> a #
Instances
IsString Key | |
Defined in Data.Aeson.Key Methods fromString :: String -> Key # | |
IsString Value | |
Defined in Data.Aeson.Types.Internal Methods fromString :: String -> Value # | |
IsString Doc | |
Defined in Text.PrettyPrint.ANSI.Leijen.Internal Methods fromString :: String -> Doc # | |
IsString ByteString | Beware: |
Defined in Data.ByteString.Internal.Type Methods fromString :: String -> ByteString # | |
IsString ByteString | Beware: |
Defined in Data.ByteString.Lazy.Internal Methods fromString :: String -> ByteString # | |
IsString ShortByteString | Beware: |
Defined in Data.ByteString.Short.Internal Methods fromString :: String -> ShortByteString # | |
IsString ByteArray | |
Defined in Codec.CBOR.ByteArray Methods fromString :: String -> ByteArray # | |
IsString SlicedByteArray | |
Defined in Codec.CBOR.ByteArray.Sliced Methods fromString :: String -> SlicedByteArray # | |
IsString Namespace | Since: effects-logger-ns-0.1 |
Defined in Effects.LoggerNS Methods fromString :: String -> Namespace # | |
IsString LogStr | |
Defined in System.Log.FastLogger.LogStr Methods fromString :: String -> LogStr # | |
IsString Doc | |
Defined in Text.PrettyPrint.HughesPJ Methods fromString :: String -> Doc # | |
IsString ShortText | Note: Surrogate pairs ( |
Defined in Data.Text.Short.Internal Methods fromString :: String -> ShortText # | |
IsString a => IsString (Identity a) | Since: base-4.9.0.0 |
Defined in Data.String Methods fromString :: String -> Identity a # | |
a ~ Char => IsString (Seq a) | Since: containers-0.5.7 |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
a ~ Char => IsString (DNonEmpty a) | |
Defined in Data.DList.DNonEmpty.Internal Methods fromString :: String -> DNonEmpty a # | |
a ~ Char => IsString (DList a) | |
Defined in Data.DList.Internal Methods fromString :: String -> DList a # | |
(IsString a, Hashable a) => IsString (Hashed a) | |
Defined in Data.Hashable.Class Methods fromString :: String -> Hashed a # | |
IsString (Doc a) | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods fromString :: String -> Doc a # | |
IsString (Doc ann) |
This instance uses the |
Defined in Prettyprinter.Internal Methods fromString :: String -> Doc ann # | |
a ~ Char => IsString [a] |
Since: base-2.1 |
Defined in Data.String Methods fromString :: String -> [a] # | |
IsString a => IsString (Const a b) | Since: base-4.9.0.0 |
Defined in Data.String Methods fromString :: String -> Const a b # | |
IsString a => IsString (Tagged s a) | |
Defined in Data.Tagged Methods fromString :: String -> Tagged s a # | |
(a ~ Tokens s, IsString a, Eq a, Stream s, Ord e) => IsString (ParsecT e s m a) | Since: megaparsec-6.3.0 |
Defined in Text.Megaparsec.Internal Methods fromString :: String -> ParsecT e s m a # |
CallStack
s are a lightweight method of obtaining a
partial call-stack at any point in the program.
A function can request its call-site with the HasCallStack
constraint.
For example, we can define
putStrLnWithCallStack :: HasCallStack => String -> IO ()
as a variant of putStrLn
that will get its call-site and print it,
along with the string given as argument. We can access the
call-stack inside putStrLnWithCallStack
with callStack
.
>>>
:{
putStrLnWithCallStack :: HasCallStack => String -> IO () putStrLnWithCallStack msg = do putStrLn msg putStrLn (prettyCallStack callStack) :}
Thus, if we call putStrLnWithCallStack
we will get a formatted call-stack
alongside our string.
>>>
putStrLnWithCallStack "hello"
hello CallStack (from HasCallStack): putStrLnWithCallStack, called at <interactive>:... in interactive:Ghci...
GHC solves HasCallStack
constraints in three steps:
- If there is a
CallStack
in scope -- i.e. the enclosing function has aHasCallStack
constraint -- GHC will append the new call-site to the existingCallStack
. - If there is no
CallStack
in scope -- e.g. in the GHCi session above -- and the enclosing definition does not have an explicit type signature, GHC will infer aHasCallStack
constraint for the enclosing definition (subject to the monomorphism restriction). - If there is no
CallStack
in scope and the enclosing definition has an explicit type signature, GHC will solve theHasCallStack
constraint for the singletonCallStack
containing just the current call-site.
CallStack
s do not interact with the RTS and do not require compilation
with -prof
. On the other hand, as they are built up explicitly via the
HasCallStack
constraints, they will generally not contain as much
information as the simulated call-stacks maintained by the RTS.
A CallStack
is a [(String, SrcLoc)]
. The String
is the name of
function that was called, the SrcLoc
is the call-site. The list is
ordered with the most recently called function at the head.
NOTE: The intrepid user may notice that HasCallStack
is just an
alias for an implicit parameter ?callStack :: CallStack
. This is an
implementation detail and should not be considered part of the
CallStack
API, we may decide to change the implementation in the
future.
Since: base-4.8.1.0
type HasCallStack = ?callStack :: CallStack #
Request a CallStack.
NOTE: The implicit parameter ?callStack :: CallStack
is an
implementation detail and should not be considered part of the
CallStack
API, we may decide to change the implementation in the
future.
Since: base-4.9.0.0
data SomeException #
The SomeException
type is the root of the exception type hierarchy.
When an exception of type e
is thrown, behind the scenes it is
encapsulated in a SomeException
.
Instances
Exception SomeException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # | |
Show SomeException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods showsPrec :: Int -> SomeException -> ShowS # show :: SomeException -> String # showList :: [SomeException] -> ShowS # |
class Applicative f => Alternative (f :: Type -> Type) where #
A monoid on applicative functors.
If defined, some
and many
should be the least solutions
of the equations:
Instances
Proxy
is a type that holds no data, but has a phantom parameter of
arbitrary type (or even kind). Its use is to provide type information, even
though there is no value available of that type (or it may be too costly to
create one).
Historically,
is a safer alternative to the
Proxy
:: Proxy
a
idiom.undefined
:: a
>>>
Proxy :: Proxy (Void, Int -> Int)
Proxy
Proxy can even hold types of higher kinds,
>>>
Proxy :: Proxy Either
Proxy
>>>
Proxy :: Proxy Functor
Proxy
>>>
Proxy :: Proxy complicatedStructure
Proxy
Constructors
Proxy |
Instances
Generic1 (Proxy :: k -> Type) | |
FromJSON1 (Proxy :: Type -> Type) | |
ToJSON1 (Proxy :: Type -> Type) | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> Proxy a -> Value Source # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Proxy a] -> Value Source # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Proxy a -> Encoding Source # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Proxy a] -> Encoding Source # | |
Foldable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Proxy m -> m # foldMap :: Monoid m => (a -> m) -> Proxy a -> m # foldMap' :: Monoid m => (a -> m) -> Proxy a -> m # foldr :: (a -> b -> b) -> b -> Proxy a -> b # foldr' :: (a -> b -> b) -> b -> Proxy a -> b # foldl :: (b -> a -> b) -> b -> Proxy a -> b # foldl' :: (b -> a -> b) -> b -> Proxy a -> b # foldr1 :: (a -> a -> a) -> Proxy a -> a # foldl1 :: (a -> a -> a) -> Proxy a -> a # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # | |
Traversable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Alternative (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Applicative (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Functor (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
MonadPlus (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
NFData1 (Proxy :: Type -> Type) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Hashable1 (Proxy :: Type -> Type) | |
Defined in Data.Hashable.Class | |
FromJSON (Proxy a) | |
ToJSON (Proxy a) | |
Monoid (Proxy s) | Since: base-4.7.0.0 |
Semigroup (Proxy s) | Since: base-4.9.0.0 |
Bounded (Proxy t) | Since: base-4.7.0.0 |
Enum (Proxy s) | Since: base-4.7.0.0 |
Generic (Proxy t) | |
Ix (Proxy s) | Since: base-4.7.0.0 |
Defined in Data.Proxy | |
Read (Proxy t) | Since: base-4.7.0.0 |
Show (Proxy s) | Since: base-4.7.0.0 |
NFData (Proxy a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
Eq (Proxy s) | Since: base-4.7.0.0 |
Ord (Proxy s) | Since: base-4.7.0.0 |
Hashable (Proxy a) | |
Serialise (Proxy a) | Since: serialise-0.2.0.0 |
DecodeTOML (Proxy a) | |
Defined in TOML.Decode Methods tomlDecoder :: Decoder (Proxy a) Source # | |
type Rep1 (Proxy :: k -> Type) | Since: base-4.6.0.0 |
type Rep (Proxy t) | Since: base-4.6.0.0 |
See openFile
Constructors
AppendMode |
File and directory names are values of type String
, whose precise
meaning is operating system dependent. Files can be opened, yielding a
handle which can then be used to operate on the contents of that file.
A mutable variable in the IO
monad.
>>>
import Data.IORef
>>>
r <- newIORef 0
>>>
readIORef r
0>>>
writeIORef r 1
>>>
readIORef r
1>>>
atomicWriteIORef r 2
>>>
readIORef r
2>>>
modifyIORef' r (+ 1)
>>>
readIORef r
3>>>
atomicModifyIORef' r (\a -> (a + 1, ()))
>>>
readIORef r
4
Instances
NFData1 IORef | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
NFData (IORef a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
Eq (IORef a) | Pointer equality. Since: base-4.0.0.0 |
data BufferMode #
Three kinds of buffering are supported: line-buffering, block-buffering or no-buffering. These modes have the following effects. For output, items are written out, or flushed, from the internal buffer according to the buffer mode:
- line-buffering: the entire output buffer is flushed
whenever a newline is output, the buffer overflows,
a
hFlush
is issued, or the handle is closed. - block-buffering: the entire buffer is written out whenever it
overflows, a
hFlush
is issued, or the handle is closed. - no-buffering: output is written immediately, and never stored in the buffer.
An implementation is free to flush the buffer more frequently, but not less frequently, than specified above. The output buffer is emptied as soon as it has been written out.
Similarly, input occurs according to the buffer mode for the handle:
- line-buffering: when the buffer for the handle is not empty, the next item is obtained from the buffer; otherwise, when the buffer is empty, characters up to and including the next newline character are read into the buffer. No characters are available until the newline character is available or the buffer is full.
- block-buffering: when the buffer for the handle becomes empty, the next block of data is read into the buffer.
- no-buffering: the next input item is read and returned.
The
hLookAhead
operation implies that even a no-buffered handle may require a one-character buffer.
The default buffering mode when a handle is opened is implementation-dependent and may depend on the file system object which is attached to that handle. For most implementations, physical files will normally be block-buffered and terminals will normally be line-buffered.
Constructors
NoBuffering | buffering is disabled if possible. |
Instances
Read BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types Methods readsPrec :: Int -> ReadS BufferMode # readList :: ReadS [BufferMode] # readPrec :: ReadPrec BufferMode # readListPrec :: ReadPrec [BufferMode] # | |
Show BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types Methods showsPrec :: Int -> BufferMode -> ShowS # show :: BufferMode -> String # showList :: [BufferMode] -> ShowS # | |
Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types | |
Ord BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types Methods compare :: BufferMode -> BufferMode -> Ordering # (<) :: BufferMode -> BufferMode -> Bool # (<=) :: BufferMode -> BufferMode -> Bool # (>) :: BufferMode -> BufferMode -> Bool # (>=) :: BufferMode -> BufferMode -> Bool # max :: BufferMode -> BufferMode -> BufferMode # min :: BufferMode -> BufferMode -> BufferMode # |
Defines the exit codes that a program can return.
Constructors
ExitSuccess | indicates successful termination; |
ExitFailure Int | indicates program failure with an exit code. The exact interpretation of the code is operating-system dependent. In particular, some values may be prohibited (e.g. 0 on a POSIX-compliant system). |
Instances
Exception ExitCode | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods toException :: ExitCode -> SomeException # fromException :: SomeException -> Maybe ExitCode # displayException :: ExitCode -> String # | |
Generic ExitCode | |
Read ExitCode | |
Show ExitCode | |
NFData ExitCode | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
Eq ExitCode | |
Ord ExitCode | |
Defined in GHC.IO.Exception | |
Serialise ExitCode | Since: serialise-0.2.0.0 |
type Rep ExitCode | |
Defined in GHC.IO.Exception type Rep ExitCode = D1 ('MetaData "ExitCode" "GHC.IO.Exception" "base" 'False) (C1 ('MetaCons "ExitSuccess" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExitFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) |
Boxed vectors, supporting efficient slicing.
Instances
FromJSON1 Vector | |
ToJSON1 Vector | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> Vector a -> Value Source # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Vector a] -> Value Source # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Vector a -> Encoding Source # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Vector a] -> Encoding Source # | |
MonadFail Vector | Since: vector-0.12.1.0 |
Defined in Data.Vector | |
MonadFix Vector | This instance has the same semantics as the one for lists. Since: vector-0.12.2.0 |
Defined in Data.Vector | |
MonadZip Vector | |
Foldable Vector | |
Defined in Data.Vector Methods fold :: Monoid m => Vector m -> m # foldMap :: Monoid m => (a -> m) -> Vector a -> m # foldMap' :: Monoid m => (a -> m) -> Vector a -> m # foldr :: (a -> b -> b) -> b -> Vector a -> b # foldr' :: (a -> b -> b) -> b -> Vector a -> b # foldl :: (b -> a -> b) -> b -> Vector a -> b # foldl' :: (b -> a -> b) -> b -> Vector a -> b # foldr1 :: (a -> a -> a) -> Vector a -> a # foldl1 :: (a -> a -> a) -> Vector a -> a # elem :: Eq a => a -> Vector a -> Bool # maximum :: Ord a => Vector a -> a # minimum :: Ord a => Vector a -> a # | |
Eq1 Vector | |
Ord1 Vector | |
Defined in Data.Vector | |
Read1 Vector | |
Defined in Data.Vector | |
Show1 Vector | |
Traversable Vector | |
Alternative Vector | |
Applicative Vector | |
Functor Vector | |
Monad Vector | |
MonadPlus Vector | |
NFData1 Vector | Since: vector-0.12.1.0 |
Defined in Data.Vector | |
Vector Vector a | |
Defined in Data.Vector Methods basicUnsafeFreeze :: Mutable Vector s a -> ST s (Vector a) Source # basicUnsafeThaw :: Vector a -> ST s (Mutable Vector s a) Source # basicLength :: Vector a -> Int Source # basicUnsafeSlice :: Int -> Int -> Vector a -> Vector a Source # basicUnsafeIndexM :: Vector a -> Int -> Box a Source # basicUnsafeCopy :: Mutable Vector s a -> Vector a -> ST s () Source # | |
FromJSON a => FromJSON (Vector a) | |
ToJSON a => ToJSON (Vector a) | |
Data a => Data (Vector a) | |
Defined in Data.Vector Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Vector a -> c (Vector a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Vector a) # toConstr :: Vector a -> Constr # dataTypeOf :: Vector a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Vector a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Vector a)) # gmapT :: (forall b. Data b => b -> b) -> Vector a -> Vector a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r # gmapQ :: (forall d. Data d => d -> u) -> Vector a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Vector a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # | |
Monoid (Vector a) | |
Semigroup (Vector a) | |
IsList (Vector a) | |
Read a => Read (Vector a) | |
Show a => Show (Vector a) | |
NFData a => NFData (Vector a) | |
Defined in Data.Vector | |
Eq a => Eq (Vector a) | |
Ord a => Ord (Vector a) | |
Defined in Data.Vector | |
Serialise a => Serialise (Vector a) | Since: serialise-0.2.0.0 |
type Mutable Vector | |
Defined in Data.Vector | |
type Item (Vector a) | |
Defined in Data.Vector |
Byte units.
Since: si-bytes-0.1
Constructors
B | Bytes Since: si-bytes-0.1 |
Instances
Bounded Size | Since: si-bytes-0.1 |
Enum Size | Since: si-bytes-0.1 |
Generic Size | |
Show Size | Since: si-bytes-0.1 |
NFData Size | Since: si-bytes-0.1 |
Defined in Data.Bytes.Size | |
Eq Size | Since: si-bytes-0.1 |
Ord Size | Since: si-bytes-0.1 |
Hashable Size | Since: si-bytes-0.1 |
Parser Size | Since: si-bytes-0.1 |
TestEquality SSize | Since: si-bytes-0.1 |
Defined in Data.Bytes.Size | |
type Rep Size | Since: si-bytes-0.1 |
Defined in Data.Bytes.Size type Rep Size = D1 ('MetaData "Size" "Data.Bytes.Size" "si-bytes-0.1-97cb24a33de91ba49ee0c56be2863dcf522540262bce46ec251c99d0bda0642a" 'False) (((C1 ('MetaCons "B" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "K" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "M" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "G" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "T" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "P" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "E" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Z" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Y" 'PrefixI 'False) (U1 :: Type -> Type))))) |
class Monad m => MonadThrow (m :: Type -> Type) #
A class for monads in which exceptions may be thrown.
Instances should obey the following law:
throwM e >> x = throwM e
In other words, throwing an exception short-circuits the rest of the monadic computation.
Minimal complete definition
Instances
data ReaderT r (m :: Type -> Type) a #
The reader monad transformer, which adds a read-only environment to the given monad.
The return
function ignores the environment, while >>=
passes
the inherited environment to both subcomputations.
Instances
General-purpose finite sequences.
Bundled Patterns
pattern (:|>) :: Seq a -> a -> Seq a infixl 5 | A bidirectional pattern synonym viewing the rear of a non-empty sequence. Since: containers-0.5.8 |
pattern (:<|) :: a -> Seq a -> Seq a infixr 5 | A bidirectional pattern synonym viewing the front of a non-empty sequence. Since: containers-0.5.8 |
Instances
FromJSON1 Seq | |
ToJSON1 Seq | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> Seq a -> Value Source # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Seq a] -> Value Source # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Seq a -> Encoding Source # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Seq a] -> Encoding Source # | |
MonadFix Seq | Since: containers-0.5.11 |
Defined in Data.Sequence.Internal | |
MonadZip Seq |
|
Foldable Seq | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Seq m -> m # foldMap :: Monoid m => (a -> m) -> Seq a -> m # foldMap' :: Monoid m => (a -> m) -> Seq a -> m # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # elem :: Eq a => a -> Seq a -> Bool # maximum :: Ord a => Seq a -> a # | |
Eq1 Seq | Since: containers-0.5.9 |
Ord1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
Read1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
Show1 Seq | Since: containers-0.5.9 |
Traversable Seq | |
Alternative Seq | Since: containers-0.5.4 |
Applicative Seq | Since: containers-0.5.4 |
Functor Seq | |
Monad Seq | |
MonadPlus Seq | |
UnzipWith Seq | |
Defined in Data.Sequence.Internal Methods unzipWith' :: (x -> (a, b)) -> Seq x -> (Seq a, Seq b) | |
Hashable1 Seq | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
Lift a => Lift (Seq a :: Type) | Since: containers-0.6.6 |
FromJSON a => FromJSON (Seq a) | |
ToJSON a => ToJSON (Seq a) | |
Data a => Data (Seq a) | |
Defined in Data.Sequence.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Seq a -> c (Seq a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Seq a) # dataTypeOf :: Seq a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Seq a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Seq a)) # gmapT :: (forall b. Data b => b -> b) -> Seq a -> Seq a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQ :: (forall d. Data d => d -> u) -> Seq a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Seq a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # | |
a ~ Char => IsString (Seq a) | Since: containers-0.5.7 |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
Monoid (Seq a) | |
Semigroup (Seq a) | Since: containers-0.5.7 |
IsList (Seq a) | |
Read a => Read (Seq a) | |
Show a => Show (Seq a) | |
NFData a => NFData (Seq a) | |
Defined in Data.Sequence.Internal | |
Eq a => Eq (Seq a) | |
Ord a => Ord (Seq a) | |
Hashable v => Hashable (Seq v) | Since: hashable-1.3.4.0 |
Ord a => Stream (Seq a) | Since: megaparsec-9.0.0 |
Defined in Text.Megaparsec.Stream Methods tokenToChunk :: Proxy (Seq a) -> Token (Seq a) -> Tokens (Seq a) Source # tokensToChunk :: Proxy (Seq a) -> [Token (Seq a)] -> Tokens (Seq a) Source # chunkToTokens :: Proxy (Seq a) -> Tokens (Seq a) -> [Token (Seq a)] Source # chunkLength :: Proxy (Seq a) -> Tokens (Seq a) -> Int Source # chunkEmpty :: Proxy (Seq a) -> Tokens (Seq a) -> Bool Source # take1_ :: Seq a -> Maybe (Token (Seq a), Seq a) Source # takeN_ :: Int -> Seq a -> Maybe (Tokens (Seq a), Seq a) Source # takeWhile_ :: (Token (Seq a) -> Bool) -> Seq a -> (Tokens (Seq a), Seq a) Source # | |
Ixed (Seq a) | |
Serialise a => Serialise (Seq a) | Since: serialise-0.2.0.0 |
DecodeTOML a => DecodeTOML (Seq a) | |
Defined in TOML.Decode Methods tomlDecoder :: Decoder (Seq a) Source # | |
type Item (Seq a) | |
Defined in Data.Sequence.Internal | |
type Token (Seq a) | |
Defined in Text.Megaparsec.Stream | |
type Tokens (Seq a) | |
Defined in Text.Megaparsec.Stream | |
type Index (Seq a) | |
Defined in Optics.At.Core | |
type IxKind (Seq a) | |
Defined in Optics.At.Core | |
type IxValue (Seq a) | |
Defined in Optics.At.Core |
A class of types that can be fully evaluated.
Since: deepseq-1.1.0.0
Instances
Type representing filenames/pathnames.
This type doesn't add any guarantees over OsString
.
class Monad m => MonadAsync (m :: Type -> Type) Source #
Represents async effects. API largely follows unliftio's implementation of UnliftIO.Async.
Since: effects-async-0.1
Minimal complete definition
withAsync, withAsyncBound, withAsyncOn, withAsyncWithUnmask, withAsyncOnWithUnmask, wait, poll, waitCatch, cancel, uninterruptibleCancel, cancelWith, race, concurrently, concurrently_, waitAny, waitAnyCatch, waitAnyCancel, waitAnyCatchCancel, waitEither, waitEitherCatch, waitEitherCancel, waitEitherCatchCancel, waitEither_, waitBoth, async, asyncBound, asyncOn, asyncWithUnmask, asyncOnWithUnmask, link, linkOnly, link2, link2Only, pooledMapConcurrentlyN, pooledMapConcurrently, pooledMapConcurrentlyN_, pooledMapConcurrently_
Instances
class MonadCatch m => MonadMask (m :: Type -> Type) #
A class for monads which provide for the ability to account for all possible exit points from a computation, and to mask asynchronous exceptions. Continuation-based monads are invalid instances of this class.
Instances should ensure that, in the following code:
fg = f `finally` g
The action g
is called regardless of what occurs within f
, including
async exceptions. Some monads allow f
to abort the computation via other
effects than throwing an exception. For simplicity, we will consider aborting
and throwing an exception to be two forms of "throwing an error".
If f
and g
both throw an error, the error thrown by fg
depends on which
errors we're talking about. In a monad transformer stack, the deeper layers
override the effects of the inner layers; for example, ExceptT e1 (Except
e2) a
represents a value of type Either e2 (Either e1 a)
, so throwing both
an e1
and an e2
will result in Left e2
. If f
and g
both throw an
error from the same layer, instances should ensure that the error from g
wins.
Effects other than throwing an error are also overridden by the deeper layers.
For example, StateT s Maybe a
represents a value of type s -> Maybe (a,
s)
, so if an error thrown from f
causes this function to return Nothing
,
any changes to the state which f
also performed will be erased. As a
result, g
will see the state as it was before f
. Once g
completes,
f
's error will be rethrown, so g
' state changes will be erased as well.
This is the normal interaction between effects in a monad transformer stack.
By contrast, lifted-base's
version of finally
always discards all of g
's non-IO effects, and g
never sees any of f
's non-IO effects, regardless of the layer ordering and
regardless of whether f
throws an error. This is not the result of
interacting effects, but a consequence of MonadBaseControl
's approach.
Minimal complete definition
Instances
MonadMask IO | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. IO a -> IO a) -> IO b) -> IO b # uninterruptibleMask :: HasCallStack => ((forall a. IO a -> IO a) -> IO b) -> IO b # generalBracket :: HasCallStack => IO a -> (a -> ExitCase b -> IO c) -> (a -> IO b) -> IO (b, c) # | |
e ~ SomeException => MonadMask (Either e) | Since: exceptions-0.8.3 |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. Either e a -> Either e a) -> Either e b) -> Either e b # uninterruptibleMask :: HasCallStack => ((forall a. Either e a -> Either e a) -> Either e b) -> Either e b # generalBracket :: HasCallStack => Either e a -> (a -> ExitCase b -> Either e c) -> (a -> Either e b) -> Either e (b, c) # | |
MonadMask m => MonadMask (LoggingT m) | |
Defined in Control.Monad.Logger Methods mask :: HasCallStack => ((forall a. LoggingT m a -> LoggingT m a) -> LoggingT m b) -> LoggingT m b # uninterruptibleMask :: HasCallStack => ((forall a. LoggingT m a -> LoggingT m a) -> LoggingT m b) -> LoggingT m b # generalBracket :: HasCallStack => LoggingT m a -> (a -> ExitCase b -> LoggingT m c) -> (a -> LoggingT m b) -> LoggingT m (b, c) # | |
MonadMask m => MonadMask (NoLoggingT m) | |
Defined in Control.Monad.Logger Methods mask :: HasCallStack => ((forall a. NoLoggingT m a -> NoLoggingT m a) -> NoLoggingT m b) -> NoLoggingT m b # uninterruptibleMask :: HasCallStack => ((forall a. NoLoggingT m a -> NoLoggingT m a) -> NoLoggingT m b) -> NoLoggingT m b # generalBracket :: HasCallStack => NoLoggingT m a -> (a -> ExitCase b -> NoLoggingT m c) -> (a -> NoLoggingT m b) -> NoLoggingT m (b, c) # | |
MonadMask m => MonadMask (WriterLoggingT m) | |
Defined in Control.Monad.Logger Methods mask :: HasCallStack => ((forall a. WriterLoggingT m a -> WriterLoggingT m a) -> WriterLoggingT m b) -> WriterLoggingT m b # uninterruptibleMask :: HasCallStack => ((forall a. WriterLoggingT m a -> WriterLoggingT m a) -> WriterLoggingT m b) -> WriterLoggingT m b # generalBracket :: HasCallStack => WriterLoggingT m a -> (a -> ExitCase b -> WriterLoggingT m c) -> (a -> WriterLoggingT m b) -> WriterLoggingT m (b, c) # | |
MonadMask m => MonadMask (ResourceT m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods mask :: HasCallStack => ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b # uninterruptibleMask :: HasCallStack => ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b # generalBracket :: HasCallStack => ResourceT m a -> (a -> ExitCase b -> ResourceT m c) -> (a -> ResourceT m b) -> ResourceT m (b, c) # | |
MonadMask m => MonadMask (MaybeT m) | Since: exceptions-0.10.0 |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b # uninterruptibleMask :: HasCallStack => ((forall a. MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b # generalBracket :: HasCallStack => MaybeT m a -> (a -> ExitCase b -> MaybeT m c) -> (a -> MaybeT m b) -> MaybeT m (b, c) # | |
MonadMask m => MonadMask (CharonT env m) Source # | |
Defined in Charon.Runner.CharonT Methods mask :: HasCallStack => ((forall a. CharonT env m a -> CharonT env m a) -> CharonT env m b) -> CharonT env m b # uninterruptibleMask :: HasCallStack => ((forall a. CharonT env m a -> CharonT env m a) -> CharonT env m b) -> CharonT env m b # generalBracket :: HasCallStack => CharonT env m a -> (a -> ExitCase b -> CharonT env m c) -> (a -> CharonT env m b) -> CharonT env m (b, c) # | |
MonadMask m => MonadMask (ExceptT e m) | Since: exceptions-0.9.0 |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b # uninterruptibleMask :: HasCallStack => ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b # generalBracket :: HasCallStack => ExceptT e m a -> (a -> ExitCase b -> ExceptT e m c) -> (a -> ExceptT e m b) -> ExceptT e m (b, c) # | |
MonadMask m => MonadMask (IdentityT m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. IdentityT m a -> IdentityT m a) -> IdentityT m b) -> IdentityT m b # uninterruptibleMask :: HasCallStack => ((forall a. IdentityT m a -> IdentityT m a) -> IdentityT m b) -> IdentityT m b # generalBracket :: HasCallStack => IdentityT m a -> (a -> ExitCase b -> IdentityT m c) -> (a -> IdentityT m b) -> IdentityT m (b, c) # | |
MonadMask m => MonadMask (ReaderT r m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b # uninterruptibleMask :: HasCallStack => ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b # generalBracket :: HasCallStack => ReaderT r m a -> (a -> ExitCase b -> ReaderT r m c) -> (a -> ReaderT r m b) -> ReaderT r m (b, c) # | |
MonadMask m => MonadMask (StateT s m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # uninterruptibleMask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # generalBracket :: HasCallStack => StateT s m a -> (a -> ExitCase b -> StateT s m c) -> (a -> StateT s m b) -> StateT s m (b, c) # | |
MonadMask m => MonadMask (StateT s m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # uninterruptibleMask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # generalBracket :: HasCallStack => StateT s m a -> (a -> ExitCase b -> StateT s m c) -> (a -> StateT s m b) -> StateT s m (b, c) # | |
(MonadMask m, Monoid w) => MonadMask (WriterT w m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b # uninterruptibleMask :: HasCallStack => ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b # generalBracket :: HasCallStack => WriterT w m a -> (a -> ExitCase b -> WriterT w m c) -> (a -> WriterT w m b) -> WriterT w m (b, c) # | |
(MonadMask m, Monoid w) => MonadMask (WriterT w m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b # uninterruptibleMask :: HasCallStack => ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b # generalBracket :: HasCallStack => WriterT w m a -> (a -> ExitCase b -> WriterT w m c) -> (a -> WriterT w m b) -> WriterT w m (b, c) # | |
(MonadMask m, Monoid w) => MonadMask (RWST r w s m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b # uninterruptibleMask :: HasCallStack => ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b # generalBracket :: HasCallStack => RWST r w s m a -> (a -> ExitCase b -> RWST r w s m c) -> (a -> RWST r w s m b) -> RWST r w s m (b, c) # | |
(MonadMask m, Monoid w) => MonadMask (RWST r w s m) | |
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b # uninterruptibleMask :: HasCallStack => ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b # generalBracket :: HasCallStack => RWST r w s m a -> (a -> ExitCase b -> RWST r w s m c) -> (a -> RWST r w s m b) -> RWST r w s m (b, c) # |
class MonadThrow m => MonadCatch (m :: Type -> Type) #
A class for monads which allow exceptions to be caught, in particular
exceptions which were thrown by throwM
.
Instances should obey the following law:
catch (throwM e) f = f e
Note that the ability to catch an exception does not guarantee that we can
deal with all possible exit points from a computation. Some monads, such as
continuation-based stacks, allow for more than just a success/failure
strategy, and therefore catch
cannot be used by those monads to properly
implement a function such as finally
. For more information, see
MonadMask
.
Minimal complete definition
Instances
data ExceptionCS e Source #
Attaches a CallStack
to an arbitrary exception. The Show
instance
uses displayException
i.e. the underlying exceptions' displayException
and pretty-prints the CallStack
due to some libraries (e.g. testing)
defaulting to Show
when printing exceptions.
Since: effects-exceptions-0.1
Constructors
MkExceptionCS e CallStack |
Instances
Path type.
Since: effects-unix-compat-0.1
Constructors
PathTypeFile | Since: effects-unix-compat-0.1 |
PathTypeDirectory | Since: effects-unix-compat-0.1 |
PathTypeSymbolicLink | Since: effects-unix-compat-0.1 |
PathTypeOther | Since: effects-unix-compat-0.1 |
Instances
Bounded PathType | Since: effects-unix-compat-0.1 |
Enum PathType | Since: effects-unix-compat-0.1 |
Defined in Effects.System.PosixCompat | |
Generic PathType | |
Show PathType | Since: effects-unix-compat-0.1 |
NFData PathType | Since: effects-unix-compat-0.1 |
Defined in Effects.System.PosixCompat | |
Eq PathType | Since: effects-unix-compat-0.1 |
Ord PathType | Since: effects-unix-compat-0.1 |
Defined in Effects.System.PosixCompat | |
type Rep PathType | Since: effects-unix-compat-0.1 |
Defined in Effects.System.PosixCompat type Rep PathType = D1 ('MetaData "PathType" "Effects.System.PosixCompat" "effects-unix-compat-0.1-9d56e686bd87cf957ed28aa8665c62fc4afee54f74eb31f0de31da53bf4c3734" 'False) ((C1 ('MetaCons "PathTypeFile" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PathTypeDirectory" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PathTypeSymbolicLink" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PathTypeOther" 'PrefixI 'False) (U1 :: Type -> Type))) |
class Monad m => MonadPathReader (m :: Type -> Type) where Source #
Represents file-system reader effects.
Since: effects-fs-0.1
Minimal complete definition
listDirectory, getDirectoryContents, getCurrentDirectory, getHomeDirectory, getXdgDirectory, getXdgDirectoryList, getAppUserDataDirectory, getUserDocumentsDirectory, getTemporaryDirectory, getFileSize, canonicalizePath, makeAbsolute, makeRelativeToCurrentDirectory, doesPathExist, doesFileExist, doesDirectoryExist, findExecutable, findExecutables, findExecutablesInDirectories, findFileWith, findFilesWith, pathIsSymbolicLink, getSymbolicLinkTarget, getPermissions, getAccessTime, getModificationTime
Methods
listDirectory :: OsPath -> m [OsPath] Source #
Lifted listDirectory
.
Since: effects-fs-0.1
getHomeDirectory :: m OsPath Source #
Lifted getHomeDirectory
.
Since: effects-fs-0.1
getFileSize :: OsPath -> m Integer Source #
Lifted getFileSize
.
Since: effects-fs-0.1
canonicalizePath :: OsPath -> m OsPath Source #
Lifted canonicalizePath
.
Since: effects-fs-0.1
makeAbsolute :: OsPath -> m OsPath Source #
Lifted makeAbsolute
.
Since: effects-fs-0.1
doesPathExist :: OsPath -> m Bool Source #
Lifted doesPathExist
.
Since: effects-fs-0.1
doesFileExist :: OsPath -> m Bool Source #
Lifted doesFileExist
.
Since: effects-fs-0.1
doesDirectoryExist :: OsPath -> m Bool Source #
Lifted doesDirectoryExist
.
Since: effects-fs-0.1
Instances
class Monad m => MonadPathWriter (m :: Type -> Type) where Source #
Represents file-system writer effects.
Since: effects-fs-0.1
Minimal complete definition
createDirectory, createDirectoryIfMissing, removeDirectory, removeDirectoryRecursive, removePathForcibly, renameDirectory, setCurrentDirectory, withCurrentDirectory, removeFile, renameFile, renamePath, copyFile, copyFileWithMetadata, createFileLink, createDirectoryLink, removeDirectoryLink, setPermissions, copyPermissions, setAccessTime, setModificationTime
Methods
createDirectoryIfMissing Source #
Lifted createDirectoryIfMissing
.
Since: effects-fs-0.1
removeDirectoryRecursive :: OsPath -> m () Source #
Lifted removeDirectoryRecursive
.
Since: effects-fs-0.1
removePathForcibly :: OsPath -> m () Source #
Lifted removePathForcibly
.
Since: effects-fs-0.1
renameDirectory :: OsPath -> OsPath -> m () Source #
Lifted renameDirectory
.
Since: effects-fs-0.1
renameFile :: OsPath -> OsPath -> m () Source #
Lifted renameFile
.
Since: effects-fs-0.1
Instances
class Monad m => MonadHandleWriter (m :: Type -> Type) where Source #
Represents handle writer effects.
Since: effects-fs-0.1
Minimal complete definition
openBinaryFile, withBinaryFile, hClose, hFlush, hSetFileSize, hSetBuffering, hSeek, hTell, hSetEcho, hPut, hPutNonBlocking
Methods
openBinaryFile :: OsPath -> IOMode -> m Handle Source #
Lifted openBinaryFileIO
.
Since: effects-fs-0.1
hClose :: Handle -> m () Source #
Lifted hClose
.
Since: effects-fs-0.1
hFlush :: Handle -> m () Source #
Lifted hFlush
.
Since: effects-fs-0.1
hPut :: Handle -> ByteString -> m () Source #
Lifted hPut
.
Since: effects-fs-0.1
Instances
class Monad m => MonadFileWriter (m :: Type -> Type) where Source #
Represents file-system writer effects.
Since: effects-fs-0.1
Methods
writeBinaryFile :: OsPath -> ByteString -> m () Source #
Writes to a file.
Since: effects-fs-0.1
appendBinaryFile :: OsPath -> ByteString -> m () Source #
Appends to a file.
Since: effects-fs-0.1
Instances
MonadFileWriter IO | Since: effects-fs-0.1 |
Defined in Effects.FileSystem.FileWriter Methods writeBinaryFile :: OsPath -> ByteString -> IO () Source # appendBinaryFile :: OsPath -> ByteString -> IO () Source # | |
MonadFileWriter m => MonadFileWriter (CharonT env m) Source # | |
Defined in Charon.Runner.CharonT Methods writeBinaryFile :: OsPath -> ByteString -> CharonT env m () Source # appendBinaryFile :: OsPath -> ByteString -> CharonT env m () Source # | |
MonadFileWriter m => MonadFileWriter (ReaderT env m) | Since: effects-fs-0.1 |
Defined in Effects.FileSystem.FileWriter Methods writeBinaryFile :: OsPath -> ByteString -> ReaderT env m () Source # appendBinaryFile :: OsPath -> ByteString -> ReaderT env m () Source # |
class Monad m => MonadFileReader (m :: Type -> Type) where Source #
Represents file-system reader effects.
Since: effects-fs-0.1
Instances
MonadFileReader IO | Since: effects-fs-0.1 |
Defined in Effects.FileSystem.FileReader Methods readBinaryFile :: OsPath -> IO ByteString Source # | |
MonadFileReader m => MonadFileReader (CharonT env m) Source # | |
Defined in Charon.Runner.CharonT Methods readBinaryFile :: OsPath -> CharonT env m ByteString Source # | |
MonadFileReader m => MonadFileReader (ReaderT e m) | Since: effects-fs-0.1 |
Defined in Effects.FileSystem.FileReader Methods readBinaryFile :: OsPath -> ReaderT e m ByteString Source # |
class Monad m => MonadIORef (m :: Type -> Type) where Source #
IORef
effect.
Since: effects-ioref-0.1
Minimal complete definition
newIORef, readIORef, writeIORef, atomicWriteIORef, modifyIORef', atomicModifyIORef'
Methods
newIORef :: HasCallStack => a -> m (IORef a) Source #
Build a new IORef
.
Since: effects-ioref-0.1
readIORef :: HasCallStack => IORef a -> m a Source #
Read the value of an IORef
.
Since: effects-ioref-0.1
writeIORef :: HasCallStack => IORef a -> a -> m () Source #
Write a new value into an IORef
.
Since: effects-ioref-0.1
modifyIORef' :: HasCallStack => IORef a -> (a -> a) -> m () Source #
Strict version of modifyIORef
.
Since: effects-ioref-0.1
Instances
class Monad m => MonadLogger (m :: Type -> Type) where Source #
A Monad
which has the ability to log messages in some manner.
Minimal complete definition
Nothing
Instances
Constructors
LevelDebug | |
LevelInfo | |
LevelWarn | |
LevelError |
class MonadLogger m => MonadLoggerNS (m :: Type -> Type) where Source #
Adds namespaces to MonadLogger
.
Since: effects-logger-ns-0.1
Methods
getNamespace :: m Namespace Source #
Retrieves the namespace.
Since: effects-logger-ns-0.1
localNamespace :: HasCallStack => (Namespace -> Namespace) -> m a -> m a Source #
Locally modifies the namespace.
Since: effects-logger-ns-0.1
Instances
(MonadHandleWriter m, MonadTime m) => MonadLoggerNS (CharonT (Env m) m) Source # | |
Defined in Charon.Runner.CharonT |
class Monad m => MonadOptparse (m :: Type -> Type) where Source #
Effects for optparse-applicative.
The vast majority of optparse-applicative is not re-exported, as most of the interface is pure. This is merely the functions needed to run a parser.
Since: effects-optparse-0.1
Minimal complete definition
Methods
execParser :: HasCallStack => ParserInfo a -> m a Source #
Run a program description.
Parse command line arguments. Display help text and exit if any parse error occurs.
Since: effects-optparse-0.1
Instances
MonadOptparse IO | Since: effects-optparse-0.1 |
Defined in Effects.Optparse Methods execParser :: HasCallStack => ParserInfo a -> IO a Source # customExecParser :: HasCallStack => ParserPrefs -> ParserInfo a -> IO a Source # handleParseResult :: HasCallStack => ParserResult a -> IO a Source # | |
MonadOptparse m => MonadOptparse (ReaderT env m) | Since: effects-optparse-0.1 |
Defined in Effects.Optparse Methods execParser :: HasCallStack => ParserInfo a -> ReaderT env m a Source # customExecParser :: HasCallStack => ParserPrefs -> ParserInfo a -> ReaderT env m a Source # handleParseResult :: HasCallStack => ParserResult a -> ReaderT env m a Source # |
class Monad m => MonadTerminal (m :: Type -> Type) where Source #
Represents a terminal.
Since: effects-terminal-0.1
Minimal complete definition
putStr, putBinary, getChar, getLine, getContents', getTerminalSize, supportsPretty
Methods
putStr :: String -> m () Source #
Write a character to the standard output device
(same as hPutChar
stdout
).
Since: effects-terminal-0.1
putStrLn :: String -> m () Source #
The same as putStr
, but adds a newline character.
Since: effects-terminal-0.1
Instances
class Monad m => MonadTime (m :: Type -> Type) Source #
Time effect.
Since: effects-time-0.1
Minimal complete definition
Instances
MonadTime IO | Since: effects-time-0.1 |
Defined in Effects.Time | |
MonadTime m => MonadTime (CharonT env m) Source # | |
Defined in Charon.Runner.CharonT Methods getSystemZonedTime :: CharonT env m ZonedTime Source # getMonotonicTime :: CharonT env m Double Source # | |
MonadTime m => MonadTime (ReaderT e m) | Since: effects-time-0.1 |
Defined in Effects.Time Methods getSystemZonedTime :: ReaderT e m ZonedTime Source # getMonotonicTime :: ReaderT e m Double Source # |
class Monad m => MonadPosixCompat (m :: Type -> Type) Source #
Class for unix-compat effects.
Since: effects-unix-compat-0.1
Minimal complete definition
setFileMode, setFdMode, setFileCreationMask, fileAccess, fileExist, getFileStatus, getFdStatus, getSymbolicLinkStatus, createNamedPipe, createDevice, createLink, removeLink, createSymbolicLink, readSymbolicLink, rename, setOwnerAndGroup, setFdOwnerAndGroup, setSymbolicLinkOwnerAndGroup, setFileTimes, touchFile, setFileSize, setFdSize, getPathVar, getFdPathVar
Instances
class Monad m => MonadReader r (m :: Type -> Type) | m -> r where #
See examples in Control.Monad.Reader.
Note, the partially applied function type (->) r
is a simple reader monad.
See the instance
declaration below.
Methods
Retrieves the monad environment.
Arguments
:: (r -> r) | The function to modify the environment. |
-> m a |
|
-> m a |
Executes a computation in a modified environment.
Instances
data NESeq a where infixr 5 Source #
A general-purpose non-empty (by construction) finite sequence type.
Non-emptiness means that:
- Functions that take an
NESeq
can safely operate on it with the assumption that it has at least value. - Functions that return an
NESeq
provide an assurance that the result has at least one value.
Data.Sequence.NonEmpty re-exports the API of Data.Sequence,
faithfully reproducing asymptotics, typeclass constraints, and
semantics. Functions that ensure that input and output maps are both
non-empty (like <|
) return NESeq
, but
functions that might potentially return an empty map (like
tail
) return a Seq
instead.
You can directly construct an NESeq
with the API from
Data.Sequence.NonEmpty; it's more or less the same as constructing
a normal Seq
, except you don't have access to empty
. There
are also a few ways to construct an NESeq
from a Seq
:
- The
nonEmptySeq
smart constructor will convert a
into aSeq
a
, returningMaybe
(NESeq
a)Nothing
if the originalSeq
was empty. - You can use
:<||
,:||>
, andinsertSeqAt
to insert a value into aSeq
to create a guaranteedNESeq
. - You can use the
IsNonEmpty
andIsEmpty
patterns to "pattern match" on aSeq
to reveal it as either containing aNESeq
or an empty sequence. withNonEmpty
offers a continuation-based interface for deconstructing aSeq
and treating it as if it were anNESeq
.
You can convert an NESeq
into a Seq
with toSeq
or
IsNonEmpty
, essentially "obscuring" the
non-empty property from the type.
Bundled Patterns
pattern (:<||) :: a -> Seq a -> NESeq a infixr 5 | O(1). An abstract constructor for an Can be used to match on the head and tail of an |
pattern (:||>) :: Seq a -> a -> NESeq a infixl 5 | O(1). An abstract constructor for an Can be used to match on the init and last of an |
Instances
MonadFix NESeq | |
Defined in Data.Sequence.NonEmpty.Internal | |
MonadZip NESeq | mzipWith = zipWith munzip = unzip |
Foldable NESeq |
|
Defined in Data.Sequence.NonEmpty.Internal Methods fold :: Monoid m => NESeq m -> m # foldMap :: Monoid m => (a -> m) -> NESeq a -> m # foldMap' :: Monoid m => (a -> m) -> NESeq a -> m # foldr :: (a -> b -> b) -> b -> NESeq a -> b # foldr' :: (a -> b -> b) -> b -> NESeq a -> b # foldl :: (b -> a -> b) -> b -> NESeq a -> b # foldl' :: (b -> a -> b) -> b -> NESeq a -> b # foldr1 :: (a -> a -> a) -> NESeq a -> a # foldl1 :: (a -> a -> a) -> NESeq a -> a # elem :: Eq a => a -> NESeq a -> Bool # maximum :: Ord a => NESeq a -> a # minimum :: Ord a => NESeq a -> a # | |
Foldable1 NESeq | |
Defined in Data.Sequence.NonEmpty.Internal Methods fold1 :: Semigroup m => NESeq m -> m # foldMap1 :: Semigroup m => (a -> m) -> NESeq a -> m # foldMap1' :: Semigroup m => (a -> m) -> NESeq a -> m # toNonEmpty :: NESeq a -> NonEmpty a # maximum :: Ord a => NESeq a -> a # minimum :: Ord a => NESeq a -> a # foldrMap1 :: (a -> b) -> (a -> b -> b) -> NESeq a -> b # foldlMap1' :: (a -> b) -> (b -> a -> b) -> NESeq a -> b # foldlMap1 :: (a -> b) -> (b -> a -> b) -> NESeq a -> b # foldrMap1' :: (a -> b) -> (a -> b -> b) -> NESeq a -> b # | |
Eq1 NESeq | |
Ord1 NESeq | |
Defined in Data.Sequence.NonEmpty.Internal | |
Read1 NESeq | |
Defined in Data.Sequence.NonEmpty.Internal | |
Show1 NESeq | |
Traversable NESeq | |
Applicative NESeq | |
Functor NESeq | |
Monad NESeq | |
Comonad NESeq | |
Invariant NESeq | Since: nonempty-containers-0.3.4.4 |
Alt NESeq | |
Apply NESeq | |
Bind NESeq | |
Extend NESeq | |
Traversable1 NESeq | |
LabelOptic "unSubPathData" A_Getter SubPathData SubPathData (NESeq (PathData Natural)) (NESeq (PathData Natural)) | Since: path-size-0.1 |
Defined in PathSize.Data.SubPathData.Internal Methods labelOptic :: Optic A_Getter NoIx SubPathData SubPathData (NESeq (PathData Natural)) (NESeq (PathData Natural)) Source # | |
FromJSON a => FromJSON (NESeq a) | |
ToJSON a => ToJSON (NESeq a) | |
Data a => Data (NESeq a) | |
Defined in Data.Sequence.NonEmpty.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NESeq a -> c (NESeq a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (NESeq a) # toConstr :: NESeq a -> Constr # dataTypeOf :: NESeq a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (NESeq a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NESeq a)) # gmapT :: (forall b. Data b => b -> b) -> NESeq a -> NESeq a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NESeq a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NESeq a -> r # gmapQ :: (forall d. Data d => d -> u) -> NESeq a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NESeq a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NESeq a -> m (NESeq a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NESeq a -> m (NESeq a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NESeq a -> m (NESeq a) # | |
Semigroup (NESeq a) | |
Read a => Read (NESeq a) | |
Show a => Show (NESeq a) | |
NFData a => NFData (NESeq a) | |
Defined in Data.Sequence.NonEmpty.Internal | |
Eq a => Eq (NESeq a) | |
Ord a => Ord (NESeq a) | |
Defined in Data.Sequence.NonEmpty.Internal |
Tag for a getter.
Instances
Tag for a setter.
Instances
Tag for a lens.
Instances
Subtyping relationship between kinds of optics.
An instance of
means that any Is
k l
can be used
as an Optic
k
. For example, we have an Optic
l
instance, but not Is
A_Lens
A_Traversal
.Is
A_Traversal
A_Lens
This class needs instances for all possible combinations of tags.
Minimal complete definition
Instances
type Optic' k (is :: IxList) s a = Optic k is s s a a Source #
Common special case of Optic
where source and target types are equal.
Here, we need only one "big" and one "small" type. For lenses, this means that in the restricted form we cannot do type-changing updates.
type AffineTraversal' s a = Optic' An_AffineTraversal NoIx s a Source #
Type synonym for a type-preserving affine traversal.
type LabelOptic' (name :: Symbol) k s a = LabelOptic name k s s a a Source #
Type synonym for a type-preserving optic as overloaded label.
class LabelOptic (name :: Symbol) k s t a b | name s -> k a, name t -> k b, name s b -> t, name t a -> s where Source #
Support for overloaded labels as optics.
An overloaded label #foo
can be used as an optic if there is an instance
.LabelOptic
"foo" k s t a b
Alternatively, if both s
and t
have a Generic
(GenericLabelOptics
if
explicit-generic-labels
flag is enabled) instance, a total field of s
is
accessible by a label #field
of kind A_Lens
, whereas its constructor by a
label #_Constructor
of kind A_Prism
.
Methods
labelOptic :: Optic k NoIx s t a b Source #
Used to interpret overloaded label syntax. An overloaded label #foo
corresponds to
.labelOptic
@"foo"
Instances
newtype Bytes (s :: Size) n Source #
This is the core type for handling type-safe byte operations. It is
intended to be used as a simple wrapper over some numeric type,
equipped with a Size
tag.
To take full advantage of the API (e.g. normalize
), the underlying
numeric type should implement Semifield
or, ideally, Field
.
Examples
>>>
MkBytes @M 1000
MkBytes 1000
Since: si-bytes-0.1
Constructors
MkBytes n |
Instances
Applicative (Bytes s) | Since: si-bytes-0.1 |
Functor (Bytes s) | Since: si-bytes-0.1 |
Monad (Bytes s) | Since: si-bytes-0.1 |
AGroup n => AGroup (Bytes s n) | Since: si-bytes-0.1 |
AMonoid n => AMonoid (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
ASemigroup n => ASemigroup (Bytes s n) | Since: si-bytes-0.1 |
Normed n => Normed (Bytes s n) | Since: si-bytes-0.1 |
FromInteger n => FromInteger (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal Methods afromInteger :: Integer -> Bytes s n Source # | |
FromRational n => FromRational (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal Methods afromRational :: Rational -> Bytes s n Source # | |
Bounded n => Bounded (Bytes s n) | Since: si-bytes-0.1 |
Generic (Bytes s n) | |
Show n => Show (Bytes s n) | Since: si-bytes-0.1 |
LowerBounded n => LowerBounded (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal Methods lowerBound :: Bytes s n Source # | |
LowerBoundless (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
UpperBounded n => UpperBounded (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal Methods upperBound :: Bytes s n Source # | |
UpperBoundless (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
NFData n => NFData (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
Eq n => Eq (Bytes s n) | Since: si-bytes-0.1 |
Ord n => Ord (Bytes s n) | Since: si-bytes-0.1 |
Hashable n => Hashable (Bytes s n) | Since: si-bytes-0.1 |
(FromInteger n, MGroup n, SingSize s) => Conversion (Bytes s n) | Since: si-bytes-0.1 |
(FromInteger n, MGroup n, Normed n, Ord n, SingSize s) => Normalize (Bytes s n) | Since: si-bytes-0.1 |
Read n => Parser (Bytes s n) | Since: si-bytes-0.1 |
Unwrapper (Bytes s n) | Since: si-bytes-0.1 |
SingSize s => Sized (Bytes s n) | Since: si-bytes-0.1 |
MSemigroup n => MSemiSpace (Bytes s n) n | Since: si-bytes-0.1 |
MGroup n => MSpace (Bytes s n) n | Since: si-bytes-0.1 |
Ring n => Module (Bytes s n) n | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
Semiring n => Semimodule (Bytes s n) n | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
Semifield n => SemivectorSpace (Bytes s n) n | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
Field n => VectorSpace (Bytes s n) n | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal | |
type Converted t (Bytes s n) | |
Defined in Data.Bytes.Internal | |
type Rep (Bytes s n) | Since: si-bytes-0.1 |
Defined in Data.Bytes.Internal type Rep (Bytes s n) = D1 ('MetaData "Bytes" "Data.Bytes.Internal" "si-bytes-0.1-97cb24a33de91ba49ee0c56be2863dcf522540262bce46ec251c99d0bda0642a" 'True) (C1 ('MetaCons "MkBytes" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 n))) | |
type Norm (Bytes s n) | |
Defined in Data.Bytes.Internal | |
type Unwrapped (Bytes s n) | |
Defined in Data.Bytes.Internal | |
type HideSize (Bytes s n) | |
Defined in Data.Bytes.Internal |
A set of values. A set cannot contain duplicate values.
Instances
ToJSON1 HashSet | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> HashSet a -> Value Source # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [HashSet a] -> Value Source # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> HashSet a -> Encoding Source # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [HashSet a] -> Encoding Source # | |
Foldable HashSet | |
Defined in Data.HashSet.Internal Methods fold :: Monoid m => HashSet m -> m # foldMap :: Monoid m => (a -> m) -> HashSet a -> m # foldMap' :: Monoid m => (a -> m) -> HashSet a -> m # foldr :: (a -> b -> b) -> b -> HashSet a -> b # foldr' :: (a -> b -> b) -> b -> HashSet a -> b # foldl :: (b -> a -> b) -> b -> HashSet a -> b # foldl' :: (b -> a -> b) -> b -> HashSet a -> b # foldr1 :: (a -> a -> a) -> HashSet a -> a # foldl1 :: (a -> a -> a) -> HashSet a -> a # elem :: Eq a => a -> HashSet a -> Bool # maximum :: Ord a => HashSet a -> a # minimum :: Ord a => HashSet a -> a # | |
Eq1 HashSet | |
Ord1 HashSet | |
Defined in Data.HashSet.Internal | |
Show1 HashSet | |
NFData1 HashSet | Since: unordered-containers-0.2.14.0 |
Defined in Data.HashSet.Internal | |
Hashable1 HashSet | |
Defined in Data.HashSet.Internal | |
Lift a => Lift (HashSet a :: Type) | Since: unordered-containers-0.2.17.0 |
(Eq a, Hashable a, FromJSON a) => FromJSON (HashSet a) | |
ToJSON a => ToJSON (HashSet a) | |
(Data a, Eq a, Hashable a) => Data (HashSet a) | |
Defined in Data.HashSet.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashSet a -> c (HashSet a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashSet a) # toConstr :: HashSet a -> Constr # dataTypeOf :: HashSet a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashSet a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashSet a)) # gmapT :: (forall b. Data b => b -> b) -> HashSet a -> HashSet a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r # gmapQ :: (forall d. Data d => d -> u) -> HashSet a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HashSet a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # | |
(Hashable a, Eq a) => Monoid (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
(Hashable a, Eq a) => Semigroup (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
(Eq a, Hashable a) => IsList (HashSet a) | |
(Eq a, Hashable a, Read a) => Read (HashSet a) | |
Show a => Show (HashSet a) | |
NFData a => NFData (HashSet a) | |
Defined in Data.HashSet.Internal | |
Eq a => Eq (HashSet a) | Note that, in the presence of hash collisions, equal
In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals. |
Ord a => Ord (HashSet a) | |
Hashable a => Hashable (HashSet a) | |
(Serialise a, Hashable a, Eq a) => Serialise (HashSet a) | Since: serialise-0.2.0.0 |
type Item (HashSet a) | |
Defined in Data.HashSet.Internal |
void :: Functor f => f a -> f () #
discards or ignores the result of evaluation, such
as the return value of an void
valueIO
action.
Examples
Replace the contents of a
with unit:Maybe
Int
>>>
void Nothing
Nothing>>>
void (Just 3)
Just ()
Replace the contents of an
with unit, resulting in an Either
Int
Int
:Either
Int
()
>>>
void (Left 8675309)
Left 8675309>>>
void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>>
void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>>
void (1,2)
(1,())
Discard the result of an IO
action:
>>>
mapM print [1,2]
1 2 [(),()]>>>
void $ mapM print [1,2]
1 2
finally :: (HasCallStack, MonadMask m) => m a -> m b -> m a #
Perform an action with a finalizer action that is run, even if an error occurs.
realToFrac :: (Real a, Fractional b) => a -> b #
General coercion to Fractional
types.
WARNING: This function goes through the Rational
type, which does not have values for NaN
for example.
This means it does not round-trip.
For Double
it also behaves differently with or without -O0:
Prelude> realToFrac nan -- With -O0 -Infinity Prelude> realToFrac nan NaN
fromIntegral :: (Integral a, Num b) => a -> b #
General coercion from Integral
types.
WARNING: This function performs silent truncation if the result type is not at least as big as the argument's type.
($) :: 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 representation-polymorphic in its result type, so that
$
)foo
where $
Truefoo :: Bool -> Int#
is well-typed.
(++) :: [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.
WARNING: This function takes linear time in the number of elements of the first list.
join :: Monad m => m (m a) -> m a #
The join
function is the conventional monad join operator. It
is used to remove one level of monadic structure, projecting its
bound argument into the outer level.
'
' can be understood as the join
bssdo
expression
do bs <- bss bs
Examples
A common use of join
is to run an IO
computation returned from
an STM
transaction, since STM
transactions
can't perform IO
directly. Recall that
atomically
:: STM a -> IO a
is used to run STM
transactions atomically. So, by
specializing the types of atomically
and join
to
atomically
:: STM (IO b) -> IO (IO b)join
:: IO (IO b) -> IO b
we can compose them as
join
.atomically
:: STM (IO b) -> IO b
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) #
Map each element of a structure to an action, evaluate these actions
from left to right, and collect the results. For a version that ignores
the results see traverse_
.
Examples
Basic usage:
In the first two examples we show each evaluated action mapping to the output structure.
>>>
traverse Just [1,2,3,4]
Just [1,2,3,4]
>>>
traverse id [Right 1, Right 2, Right 3, Right 4]
Right [1,2,3,4]
In the next examples, we show that Nothing
and Left
values short
circuit the created structure.
>>>
traverse (const Nothing) [1,2,3,4]
Nothing
>>>
traverse (\x -> if odd x then Just x else Nothing) [1,2,3,4]
Nothing
>>>
traverse id [Right 1, Right 2, Right 3, Right 4, Left 0]
Left 0
filter :: (a -> Bool) -> [a] -> [a] #
\(\mathcal{O}(n)\). filter
, applied to a predicate and a list, returns
the list of those elements that satisfy the predicate; i.e.,
filter p xs = [ x | x <- xs, p x]
>>>
filter odd [1, 2, 3]
[1,3]
const x y
always evaluates to x
, ignoring its second argument.
>>>
const 42 "hello"
42
>>>
map (const 42) [0..3]
[42,42,42,42]
(<$>) :: 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)
vsep :: [Doc ann] -> Doc ann Source #
(
concatenates all documents vsep
xs)xs
above each other. If a
group
undoes the line breaks inserted by vsep
, the documents are
separated with a space
instead.
Using vsep
alone yields
>>>
"prefix" <+> vsep ["text", "to", "lay", "out"]
prefix text to lay out
group
ing a vsep
separates the documents with a space
if it fits the
page (and does nothing otherwise). See the
convenience function for
this use case.sep
The align
function can be used to align the documents under their first
element:
>>>
"prefix" <+> align (vsep ["text", "to", "lay", "out"])
prefix text to lay out
Since group
ing a vsep
is rather common, sep
is a built-in for doing
that.
(</>) :: OsPath -> OsPath -> OsPath #
Combine two paths with a path separator.
If the second path starts with a path separator or a drive letter, then it returns the second.
The intention is that readFile (dir
will access the same file as
</>
file)setCurrentDirectory dir; readFile file
.
Posix: "/directory" </> "file.ext" == "/directory/file.ext" Windows: "/directory" </> "file.ext" == "/directory\\file.ext" "directory" </> "/file.ext" == "/file.ext" Valid x => (takeDirectory x </> takeFileName x) `equalFilePath` x
Combined:
Posix: "/" </> "test" == "/test" Posix: "home" </> "bob" == "home/bob" Posix: "x:" </> "foo" == "x:/foo" Windows: "C:\\foo" </> "bar" == "C:\\foo\\bar" Windows: "home" </> "bob" == "home\\bob"
Not combined:
Posix: "home" </> "/bob" == "/bob" Windows: "home" </> "C:\\bob" == "C:\\bob"
Not combined (tricky):
On Windows, if a filepath starts with a single slash, it is relative to the
root of the current drive. In [1], this is (confusingly) referred to as an
absolute path.
The current behavior of </>
is to never combine these forms.
Windows: "home" </> "/bob" == "/bob" Windows: "home" </> "\\bob" == "\\bob" Windows: "C:\\home" </> "\\bob" == "\\bob"
On Windows, from [1]: "If a file name begins with only a disk designator
but not the backslash after the colon, it is interpreted as a relative path
to the current directory on the drive with the specified letter."
The current behavior of </>
is to never combine these forms.
Windows: "D:\\foo" </> "C:bar" == "C:bar" Windows: "C:\\foo" </> "C:bar" == "C:bar"
error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a #
error
stops execution and displays an error message.
callStack :: HasCallStack => CallStack #
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.
zipWith (,) xs ys == zip xs ys zipWith f [x1,x2,x3..] [y1,y2,y3..] == [f x1 y1, f x2 y2, f x3 y3..]
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:
>>>
let f = undefined
>>>
zipWith f [] undefined
[]
zipWith
is capable of list fusion, but it is restricted to its
first list argument and its resulting list.
bracket :: (HasCallStack, MonadMask m) => m a -> (a -> m c) -> (a -> m b) -> m b #
Generalized abstracted pattern of safe resource acquisition and release
in the face of errors. The first action "acquires" some value, which
is "released" by the second action at the end. The third action "uses"
the value and its result is the result of the bracket
.
If an error is thrown during the use, the release still happens before the error is rethrown.
Note that this is essentially a type-specialized version of
generalBracket
. This function has a more common signature (matching the
signature from Control.Exception), and is often more convenient to use. By
contrast, generalBracket
is more expressive, allowing us to implement
other functions like bracketOnError
.
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]
try :: (HasCallStack, MonadCatch m, Exception e) => m a -> m (Either e a) Source #
Like upstream try
, but will not catch asynchronous exceptions.
Since: effects-exceptions-0.1
catch :: (HasCallStack, MonadCatch m, Exception e) => m a -> (e -> m a) -> m a Source #
Like upstream catch
, but will not catch asynchronous exceptions.
Since: effects-exceptions-0.1
print :: (HasCallStack, MonadTerminal m, Show a) => a -> m () Source #
The print
function outputs a value of any printable type to the
standard output device.
Printable types are those that are instances of class Show
; print
converts values to strings for output using the show
operation and
adds a newline.
For example, a program to print the first 20 integers and their powers of 2 could be written as:
main = print ([(n, 2^n) | n <- [0..19]])
Since: effects-terminal-0.1
undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a #
(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 #
Same as >>=
, but with the arguments interchanged.
when :: Applicative f => Bool -> f () -> f () #
Conditional execution of Applicative
expressions. For example,
when debug (putStrLn "Debugging")
will output the string Debugging
if the Boolean value debug
is True
, and otherwise do nothing.
flip :: (a -> b -> c) -> b -> a -> c #
takes its (first) two arguments in the reverse order of flip
ff
.
>>>
flip (++) "hello" "world"
"worldhello"
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
""
fromMaybe :: a -> Maybe a -> a #
The fromMaybe
function takes a default value and a Maybe
value. If the Maybe
is Nothing
, it returns the default value;
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
(%) :: forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a b. (JoinKinds k l m, AppendIndices is js ks) => Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b infixl 9 Source #
Compose two optics of compatible flavours.
Returns an optic of the appropriate supertype. If either or both optics are indexed, the composition preserves all the indices.
($>) :: Functor f => f a -> b -> f b infixl 4 #
Flipped version of <$
.
Examples
Replace the contents of a
with a constant
Maybe
Int
String
:
>>>
Nothing $> "foo"
Nothing>>>
Just 90210 $> "foo"
Just "foo"
Replace the contents of an
with a constant Either
Int
Int
String
, resulting in an
:Either
Int
String
>>>
Left 8675309 $> "foo"
Left 8675309>>>
Right 8675309 $> "foo"
Right "foo"
Replace each element of a list with a constant String
:
>>>
[1,2,3] $> "foo"
["foo","foo","foo"]
Replace the second element of a pair with a constant String
:
>>>
(1,2) $> "foo"
(1,"foo")
Since: base-4.7.0.0
either :: (a -> c) -> (b -> c) -> Either a b -> c #
Case analysis for the Either
type.
If the value is
, apply the first function to Left
aa
;
if it is
, apply the second function to Right
bb
.
Examples
We create two values of type
, one using the
Either
String
Int
Left
constructor and another using the Right
constructor. Then
we apply "either" the length
function (if we have a String
)
or the "times-two" function (if we have an Int
):
>>>
let s = Left "foo" :: Either String Int
>>>
let n = Right 3 :: Either String Int
>>>
either length (*2) s
3>>>
either length (*2) n
6
traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () #
Map each element of a structure to an Applicative
action, evaluate these
actions from left to right, and ignore the results. For a version that
doesn't ignore the results see traverse
.
traverse_
is just like mapM_
, but generalised to Applicative
actions.
Examples
Basic usage:
>>>
traverse_ print ["Hello", "world", "!"]
"Hello" "world" "!"
for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f () #
for_
is traverse_
with its arguments flipped. For a version
that doesn't ignore the results see for
. This
is forM_
generalised to Applicative
actions.
for_
is just like forM_
, but generalised to Applicative
actions.
Examples
Basic usage:
>>>
for_ [1..4] print
1 2 3 4
sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f () #
Evaluate each action in the structure from left to right, and
ignore the results. For a version that doesn't ignore the results
see sequenceA
.
sequenceA_
is just like sequence_
, but generalised to Applicative
actions.
Examples
Basic usage:
>>>
sequenceA_ [print "Hello", print "world", print "!"]
"Hello" "world" "!"
prettyCallStack :: CallStack -> String #
Pretty print a CallStack
.
Since: base-4.9.0.0
catchAny :: (HasCallStack, MonadCatch m) => m a -> (SomeException -> m a) -> m a Source #
catch
specialized to all synchronous exceptions.
Since: effects-exceptions-0.1
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 #
Left-to-right composition of Kleisli arrows.
'(bs
' can be understood as the >=>
cs) ado
expression
do b <- bs a cs b
unless :: Applicative f => Bool -> f () -> f () #
The reverse of when
.
exitFailure :: (HasCallStack, MonadThrow m) => m a Source #
The computation exitFailure
is equivalent to
exitWith
(
ExitFailure
exitfail)
,
where exitfail is implementation-dependent.
Since: effects-exceptions-0.1
Arguments
:: MonadReader r m | |
=> (r -> a) | The selector function to apply to the environment. |
-> m a |
Retrieves a function of the current environment.
throwM :: (HasCallStack, MonadThrow m, Exception e) => e -> m a Source #
Like throwM
but any thrown asynchronous exceptions will be thrown
synchronously via toSyncException
.
Since: effects-exceptions-0.1
encodeUtf8 :: Text -> ByteString #
Encode text using UTF-8 encoding.
decodeUtf8 :: ByteString -> Either UnicodeException Text Source #
Decodes a ByteString
to UTF-8.
Since: effects-fs-0.1
decodeUtf8Lenient :: ByteString -> Text Source #
Leniently decodes a ByteString
to UTF-8.
Since: effects-fs-0.1
(<.>) :: OsPath -> OsString -> OsPath #
Add an extension, even if there is already one there, equivalent to addExtension
.
"/directory/path" <.> "ext" == "/directory/path.ext" "/directory/path" <.> ".ext" == "/directory/path.ext"
throwString :: (MonadThrow m, HasCallStack) => String -> m a Source #
A convenience function for throwing a user error. This is useful for cases where it would be too high a burden to define your own exception type.
This throws an exception of type StringException
. When GHC
supports it (base 4.9 and GHC 8.0 and onward), it includes a call
stack.
Since: safe-exceptions-0.1.5.0
throwCS :: forall m e a. (Exception e, HasCallStack, MonadThrow m) => e -> m a Source #
Wraps an exception in ExceptionCS
and rethrows. If the e
is
also an ExceptionCS
, the callStacks are merged.
Since: effects-exceptions-0.1
catchCS :: forall m e a. (Exception e, HasCallStack, MonadCatch m) => m a -> (e -> m a) -> m a Source #
Catches both e
and ExceptionCS e
. The given handler is
wrapped in addCS
.
Since: effects-exceptions-0.1
catchAnyCS :: (HasCallStack, MonadCatch m) => m a -> (SomeException -> m a) -> m a Source #
catchCS
specialized to all synchronous exceptions.
Since: effects-exceptions-0.1
tryCS :: forall m e a. (Exception e, MonadCatch m) => m a -> m (Either e a) Source #
Try for catchCS
.
Since: effects-exceptions-0.1
tryAnyCS :: MonadCatch m => m a -> m (Either SomeException a) Source #
tryCS
specialized to SomeException
.
Since: effects-exceptions-0.1
addCS :: (HasCallStack, MonadCatch m) => m a -> m a Source #
Turns any caught exceptions e
into an ExceptionCS e
with
attached CallStack
and rethrows.
Since: effects-exceptions-0.1
displayNoCS :: Exception e => e -> String Source #
Like displayException
, except it has specific logic to skip any
found CallStack
s.
Since: effects-exceptions-0.1
tryAny :: (HasCallStack, MonadCatch m) => m a -> m (Either SomeException a) Source #
try
specialized to catch all synchronous exceptions.
Since: effects-exceptions-0.1
osp :: QuasiQuoter #
encodeFpToOs :: FilePath -> Either EncodingException OsPath Source #
Encodes a FilePath
to an OsPath
. This is a pure version of filepath's
encodeUtf
that returns the EncodingException
in the event of an
error.
Since: effects-fs-0.1
encodeFpToOsThrowM :: (HasCallStack, MonadThrow m) => FilePath -> m OsPath Source #
encodeFpToOs
that throws EncodingException
.
Since: effects-fs-0.1
decodeOsToFpThrowM :: (HasCallStack, MonadThrow m) => OsPath -> m FilePath Source #
decodeOsToFp
that throws EncodingException
.
Since: effects-fs-0.1
decodeOsToFpDisplayEx :: OsPath -> String Source #
getXdgConfig :: (HasCallStack, MonadPathReader m) => OsPath -> m OsPath Source #
Retrieves the XDG config directory e.g. ~/.config
.
Since: effects-fs-0.1
doesSymbolicLinkExist :: (HasCallStack, MonadCatch m, MonadPathReader m) => OsPath -> m Bool Source #
Returns true if the path is a symbolic link. Does not traverse the link.
Since: effects-fs-0.1
readFileUtf8ThrowM :: (HasCallStack, MonadFileReader m, MonadThrow m) => OsPath -> m Text Source #
Decodes a file as UTF-8. Throws UnicodeException
for decode errors.
Since: effects-fs-0.1
Generates a function that takes a Text
and logs a LevelDebug
message. Usage:
$(logDebug) "This is a debug log message"
addNamespace :: MonadLoggerNS m => Text -> m a -> m a Source #
Adds to the namespace.
Since: effects-logger-ns-0.1
levelTrace :: LogLevel Source #
Since: effects-logger-ns-0.1
levelFatal :: LogLevel Source #
Since: effects-logger-ns-0.1
putTextLn :: (HasCallStack, MonadTerminal m) => Text -> m () Source #
preview :: forall k (is :: IxList) s a. Is k An_AffineFold => Optic' k is s a -> s -> Maybe a Source #
Retrieve the value targeted by an AffineFold
.
>>>
let _Right = prism Right $ either (Left . Left) Right
>>>
preview _Right (Right 'x')
Just 'x'
>>>
preview _Right (Left 'y')
Nothing
_1 :: Field1 s t a b => Lens s t a b Source #
Access the 1st field of a tuple (and possibly change its type).
>>>
(1,2) ^. _1
1
>>>
(1,2) & _1 .~ "hello"
("hello",2)
>>>
traverseOf _1 putStrLn ("hello","world")
hello ((),"world")
This can also be used on larger tuples as well:
>>>
(1,2,3,4,5) & _1 %~ (+41)
(42,2,3,4,5)
(.~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t infixr 4 Source #
Infix version of set
.
(^.) :: forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a infixl 8 Source #
Flipped infix version of view
.
prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b Source #
Build a prism from a constructor and a matcher, which must respect the well-formedness laws.
If you want to build a Prism
from the van Laarhoven representation, use
prismVL
from the optics-vl
package.
(%?) :: forall (is :: IxList) (js :: IxList) (ks :: IxList) k k' l m s t u v a b. (AppendIndices is js ks, JoinKinds k A_Prism k', JoinKinds k' l m) => Optic k is s t (Maybe u) (Maybe v) -> Optic l js u v a b -> Optic m ks s t a b infixl 9 Source #
review :: forall k (is :: IxList) t b. Is k A_Review => Optic' k is t b -> b -> t Source #
Retrieve the value targeted by a Review
.
>>>
review _Left "hi"
Left "hi"
iso :: (s -> a) -> (b -> t) -> Iso s t a b Source #
Build an iso from a pair of inverse functions.
If you want to build an Iso
from the van Laarhoven representation, use
isoVL
from the optics-vl
package.
over' :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t Source #
Apply a setter as a modifier, strictly.
TODO DOC: what exactly is the strictness property?
Example:
f :: Int -> (Int, a) -> (Int, a) f k acc | k > 0 = f (k - 1) $over'
_1
(+1) acc | otherwise = acc
runs in constant space, but would result in a space leak if used with over
.
Note that replacing $
with $!
or _1
with
_1'
(which amount to the same thing) doesn't help when
over
is used, because the first coordinate of a pair is never forced.
set' :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t Source #
Apply a setter, strictly.
TODO DOC: what exactly is the strictness property?
(^?) :: forall k s (is :: IxList) a. Is k An_AffineFold => s -> Optic' k is s a -> Maybe a infixl 8 Source #
Flipped infix version of preview
.
_2 :: Field2 s t a b => Lens s t a b Source #
Access the 2nd field of a tuple.
>>>
_2 .~ "hello" $ (1,(),3,4)
(1,"hello",3,4)
>>>
(1,2,3,4) & _2 %~ (*3)
(1,6,3,4)
>>>
traverseOf _2 print (1,2)
2 (1,())
Generate a Prism
for each constructor of a data type. Isos generated when
possible. Reviews are created for constructors with existentially quantified
constructors and GADTs.
e.g.
data FooBarBaz a = Foo Int | Bar a | Baz Int Char makePrisms ''FooBarBaz
will create
_Foo :: Prism' (FooBarBaz a) Int _Bar :: Prism (FooBarBaz a) (FooBarBaz b) a b _Baz :: Prism' (FooBarBaz a) (Int, Char)
makeFieldLabelsWith :: LensRules -> Name -> DecsQ Source #
Build field optics as labels with a custom configuration.
makeFieldLabelsNoPrefix :: Name -> DecsQ Source #
An alias for makeFieldLabels noPrefixFieldLabels
.
noPrefixFieldLabels :: LensRules Source #
Field rules for fields without any prefix. Useful for generation of field
labels when paired with DuplicateRecordFields
language extension so that no
prefixes for field names are necessary.
Since: optics-th-0.2
Arguments
:: (HasCallStack, MonadAsync m, MonadCatch m, MonadPathReader m, MonadPosixCompat m) | |
=> Config | Configuration. |
-> OsPath | OsPath to search. |
-> m (PathSizeResult SubPathData) | The results. |
Given a path, finds the size of all subpaths, recursively.
Since: path-size-0.1
layoutCompact :: Doc ann1 -> SimpleDocStream ann2 Source #
(layoutCompact x)
lays out the document x
without adding any
indentation and without preserving annotations.
Since no 'pretty' printing is involved, this layouter is very
fast. The resulting output contains fewer characters than a prettyprinted
version and can be used for output that is read by other programs.
>>>
let doc = hang 4 (vsep ["lorem", "ipsum", hang 4 (vsep ["dolor", "sit"])])
>>>
doc
lorem ipsum dolor sit
>>>
let putDocCompact = renderIO System.IO.stdout . layoutCompact
>>>
putDocCompact doc
lorem ipsum dolor sit
renderStrict :: SimpleDocStream ann -> Text Source #
(
takes the output renderStrict
sdoc)sdoc
from a rendering function
and transforms it to strict text.
Text
bsToStr :: ByteString -> String Source #
bsToStrLenient :: ByteString -> String Source #
displayExceptiont :: Exception e => e -> Text Source #
decodeOsToFpDisplayExT :: OsPath -> Text Source #
Optics
Path literals
pathCharon :: OsPath Source #
Misc
doesAnyPathExist :: (HasCallStack, MonadCatch m, MonadPathReader m) => OsPath -> m Bool Source #
doesAnyPathNotExist :: (HasCallStack, MonadCatch m, MonadPathReader m) => OsPath -> m Bool Source #
usingReaderT :: b -> ReaderT b m a -> m a Source #