Foundation.Monad

foundation-0.0.30: Alternative prelude with batteries and no dependencies

Safe Haskell | None
Language | Haskell2010

Foundation.Monad

Synopsis

- class Monad m => MonadIO (m :: Type -> Type) where
  - liftIO :: IO a -> m a
- class Monad m => MonadFailure (m :: Type -> Type) where
  - type Failure (m :: Type -> Type)
  - mFail :: Failure m -> m ()
- class Monad m => MonadThrow (m :: Type -> Type) where
  - throw :: Exception e => e -> m a
- class MonadThrow m => MonadCatch (m :: Type -> Type) where
  - catch :: Exception e => m a -> (e -> m a) -> m a
- class MonadCatch m => MonadBracket (m :: Type -> Type) where
  - generalBracket :: m a -> (a -> b -> m ignored1) -> (a -> SomeException -> m ignored2) -> (a -> m b) -> m b
- class MonadTrans (trans :: (Type -> Type) -> Type -> Type) where
  - lift :: Monad m => m a -> trans m a
- newtype Identity a = Identity {
  - runIdentity :: a
  }
- replicateM :: Applicative m => CountOf a -> m a -> m [a]

# Documentation

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:

-     liftIO . return = return

-     liftIO (m >>= f) = liftIO m >>= (liftIO . f)

Methods

liftIO :: IO a -> m a #

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

Expand

    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 ``liftIO``, we would have ended up with this error:

    • 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 ``IO` a` and returns an `(m a)`: ``liftIO``, enabling us to run the program and see the expected results:

    > evalStateT printState "hello"
    "hello"

    > evalStateT printState 3
    3

#### Instances

Instances details

MonadIO IO | Since: base-4.9.0.0
Instance details Defined in Control.Monad.IO.Class Methods liftIO :: IO a -> IO a #
MonadIO m => MonadIO (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods liftIO :: IO a -> ResourceT m a #
MonadIO m => MonadIO (ExceptT e m) # |
Instance details Defined in Foundation.Monad.Except Methods liftIO :: IO a -> ExceptT e m a #
MonadIO m => MonadIO (ReaderT r m) # |
Instance details Defined in Foundation.Monad.Reader Methods liftIO :: IO a -> ReaderT r m a #
(Functor m, MonadIO m) => MonadIO (StateT s m) # |
Instance details Defined in Foundation.Monad.State Methods liftIO :: IO a -> StateT s m a #
MonadIO m => MonadIO (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Methods liftIO :: IO a -> Conduit i o m a #

class Monad m => MonadFailure (m :: Type -> Type) where #

Monad that can represent failure

Similar to MonadFail but with a parametrized Failure linked to the Monad

Associated Types

type Failure (m :: Type -> Type) #

The associated type with the MonadFailure, representing what failure can be encoded in this monad

Methods

mFail :: Failure m -> m () #

Raise a Failure through a monad.

#### Instances

Instances details

MonadFailure Maybe |
Instance details Defined in Basement.Monad Associated Types
type Failure Maybe |
Instance details Defined in Basement.Monad type Failure Maybe = ()
Methods mFail :: Failure Maybe -> Maybe () #
MonadFailure (Either a) |
Instance details Defined in Basement.Monad Associated Types
type Failure (Either a) |
Instance details Defined in Basement.Monad type Failure (Either a) = a
Methods mFail :: Failure (Either a) -> Either a () #
Monad m => MonadFailure (ExceptT e m) # |
Instance details Defined in Foundation.Monad.Except Associated Types
type Failure (ExceptT e m) |
Instance details Defined in Foundation.Monad.Except type Failure (ExceptT e m) = e
Methods mFail :: Failure (ExceptT e m) -> ExceptT e m () #
MonadFailure m => MonadFailure (ReaderT r m) # |
Instance details Defined in Foundation.Monad.Reader Associated Types
type Failure (ReaderT r m) |
Instance details Defined in Foundation.Monad.Reader type Failure (ReaderT r m) = Failure m
Methods mFail :: Failure (ReaderT r m) -> ReaderT r m () #
(Functor m, MonadFailure m) => MonadFailure (StateT s m) # |
Instance details Defined in Foundation.Monad.State Associated Types
type Failure (StateT s m) |
Instance details Defined in Foundation.Monad.State type Failure (StateT s m) = Failure m
Methods mFail :: Failure (StateT s m) -> StateT s m () #
MonadFailure m => MonadFailure (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Associated Types
type Failure (Conduit i o m) |
Instance details Defined in Foundation.Conduit.Internal type Failure (Conduit i o m) = Failure m
Methods mFail :: Failure (Conduit i o m) -> Conduit i o m () #
Monad state => MonadFailure (Builder collection mutCollection step state err) |
Instance details Defined in Basement.MutableBuilder Associated Types
type Failure (Builder collection mutCollection step state err) |
Instance details Defined in Basement.MutableBuilder type Failure (Builder collection mutCollection step state err) = err
Methods mFail :: Failure (Builder collection mutCollection step state err) -> Builder collection mutCollection step state err () #

class Monad m => MonadThrow (m :: Type -> Type) where #

Monad that can throw exception

Methods

throw :: Exception e => e -> m a #

Throw immediatity an exception. Only a `MonadCatch` monad will be able to catch the exception using `catch`

#### Instances

Instances details

MonadThrow IO # |
Instance details Defined in Foundation.Monad.Exception Methods throw :: Exception e => e -> IO a #
MonadThrow m => MonadThrow (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods throw :: Exception e => e -> ResourceT m a #
MonadThrow m => MonadThrow (ReaderT r m) # |
Instance details Defined in Foundation.Monad.Reader Methods throw :: Exception e => e -> ReaderT r m a #
(Functor m, MonadThrow m) => MonadThrow (StateT s m) # |
Instance details Defined in Foundation.Monad.State Methods throw :: Exception e => e -> StateT s m a #
MonadThrow m => MonadThrow (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Methods throw :: Exception e => e -> Conduit i o m a #

class MonadThrow m => MonadCatch (m :: Type -> Type) where #

Monad that can catch exception

Methods

catch :: Exception e => m a -> (e -> m a) -> m a #

#### Instances

Instances details

MonadCatch IO # |
Instance details Defined in Foundation.Monad.Exception Methods catch :: Exception e => IO a -> (e -> IO a) -> IO a #
MonadCatch m => MonadCatch (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods catch :: Exception e => ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a #
MonadCatch m => MonadCatch (ReaderT r m) # |
Instance details Defined in Foundation.Monad.Reader Methods catch :: Exception e => ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a #
(Functor m, MonadCatch m) => MonadCatch (StateT s m) # |
Instance details Defined in Foundation.Monad.State Methods catch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a #
MonadCatch m => MonadCatch (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Methods catch :: Exception e => Conduit i o m a -> (e -> Conduit i o m a) -> Conduit i o m a #

class MonadCatch m => MonadBracket (m :: Type -> Type) where #

Monad that can ensure cleanup actions are performed even in the case of exceptions, both synchronous and asynchronous. This usually excludes continuation-based monads.

Methods

generalBracket #

Arguments

:: m a | acquire some resource
-> (a -> b -> m ignored1) | cleanup, no exception thrown
-> (a -> SomeException -> m ignored2) | cleanup, some exception thrown. The exception will be rethrown
-> (a -> m b) | inner action to perform with the resource
-> m b |

A generalized version of the standard bracket function which allows distinguishing different exit cases.

#### Instances

Instances details

MonadBracket IO # |
Instance details Defined in Foundation.Monad.Exception Methods generalBracket :: IO a -> (a -> b -> IO ignored1) -> (a -> SomeException -> IO ignored2) -> (a -> IO b) -> IO b #
MonadBracket m => MonadBracket (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods generalBracket :: ResourceT m a -> (a -> b -> ResourceT m ignored1) -> (a -> SomeException -> ResourceT m ignored2) -> (a -> ResourceT m b) -> ResourceT m b #
MonadBracket m => MonadBracket (ReaderT r m) # |
Instance details Defined in Foundation.Monad.Reader Methods generalBracket :: ReaderT r m a -> (a -> b -> ReaderT r m ignored1) -> (a -> SomeException -> ReaderT r m ignored2) -> (a -> ReaderT r m b) -> ReaderT r m b #

class MonadTrans (trans :: (Type -> Type) -> Type -> Type) where #

Basic Transformer class

Methods

lift :: Monad m => m a -> trans m a #

Lift a computation from an inner monad to the current transformer monad

#### Instances

Instances details

MonadTrans ResourceT # |
Instance details Defined in Foundation.Conduit.Internal Methods lift :: Monad m => m a -> ResourceT m a #
MonadTrans (ExceptT e) # |
Instance details Defined in Foundation.Monad.Except Methods lift :: Monad m => m a -> ExceptT e m a #
MonadTrans (ReaderT r) # |
Instance details Defined in Foundation.Monad.Reader Methods lift :: Monad m => m a -> ReaderT r m a #
MonadTrans (StateT s) # |
Instance details Defined in Foundation.Monad.State Methods lift :: Monad m => m a -> StateT s m a #
MonadTrans (Conduit i o) # |
Instance details Defined in Foundation.Conduit.Internal Methods lift :: Monad m => m a -> Conduit i o m a #

newtype Identity a #

Identity functor and monad. (a non-strict monad)

#### Examples

Expand

    >>> fmap (+1) (Identity 0)
    Identity 1

    >>> Identity [1, 2, 3] <> Identity [4, 5, 6]
    Identity [1,2,3,4,5,6]

    >>> do
          x <- Identity 10
          y <- Identity (x + 5)
          pure (x + y)
    Identity 25

@since base-4.8.0.0

Constructors

Identity |
Fields runIdentity :: a

#### Instances

Instances details

MonadZip Identity | Since: base-4.8.0.0
Instance details Defined in Control.Monad.Zip Methods mzip :: Identity a -> Identity b -> Identity (a, b) # mzipWith :: (a -> b -> c) -> Identity a -> Identity b -> Identity c # munzip :: Identity (a, b) -> (Identity a, Identity b) #
Foldable1 Identity | Since: base-4.18.0.0
Instance details Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Identity m -> m # foldMap1 :: Semigroup m => (a -> m) -> Identity a -> m # foldMap1' :: Semigroup m => (a -> m) -> Identity a -> m # toNonEmpty :: Identity a -> NonEmpty a # maximum :: Ord a => Identity a -> a # minimum :: Ord a => Identity a -> a # head :: Identity a -> a # last :: Identity a -> a # foldrMap1 :: (a -> b) -> (a -> b -> b) -> Identity a -> b # foldlMap1' :: (a -> b) -> (b -> a -> b) -> Identity a -> b # foldlMap1 :: (a -> b) -> (b -> a -> b) -> Identity a -> b # foldrMap1' :: (a -> b) -> (a -> b -> b) -> Identity a -> b #
Eq1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool #
Ord1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering #
Read1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a] #
Show1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Identity a] -> ShowS #
Applicative Identity | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods pure :: a -> Identity a # (<*>) :: Identity (a -> b) -> Identity a -> Identity b # liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c # (*>) :: Identity a -> Identity b -> Identity b # (<*) :: Identity a -> Identity b -> Identity a #
Functor Identity | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods fmap :: (a -> b) -> Identity a -> Identity b # (<$) :: a -> Identity b -> Identity a #
Monad Identity | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods (>>=) :: Identity a -> (a -> Identity b) -> Identity b # (>>) :: Identity a -> Identity b -> Identity b # return :: a -> Identity a #
MonadFix Identity | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods mfix :: (a -> Identity a) -> Identity a #
Foldable Identity | @since base-4.8.0.0
Instance details Defined in GHC.Internal.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 # toList :: Identity a -> [a] # null :: Identity a -> Bool # length :: Identity a -> Int # elem :: Eq a => a -> Identity a -> Bool # maximum :: Ord a => Identity a -> a # minimum :: Ord a => Identity a -> a # sum :: Num a => Identity a -> a # product :: Num a => Identity a -> a #
Traversable Identity | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) # sequenceA :: Applicative f => Identity (f a) -> f (Identity a) # mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) # sequence :: Monad m => Identity (m a) -> m (Identity a) #
Generic1 Identity |
Instance details Defined in GHC.Internal.Data.Functor.Identity Associated Types
type Rep1 Identity | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity type Rep1 Identity = D1 ('MetaData "Identity" "GHC.Internal.Data.Functor.Identity" "ghc-internal" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
Methods from1 :: Identity a -> Rep1 Identity a # to1 :: Rep1 Identity a -> Identity a #
Monoid a => Monoid (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods mempty :: Identity a # mappend :: Identity a -> Identity a -> Identity a # mconcat :: [Identity a] -> Identity a #
Semigroup a => Semigroup (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods (<>) :: Identity a -> Identity a -> Identity a # sconcat :: NonEmpty (Identity a) -> Identity a # stimes :: Integral b => b -> Identity a -> Identity a #
Bits a => Bits (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods (.&.) :: Identity a -> Identity a -> Identity a # (.|.) :: Identity a -> Identity a -> Identity a # xor :: Identity a -> Identity a -> Identity a # complement :: Identity a -> Identity a # shift :: Identity a -> Int -> Identity a # rotate :: Identity a -> Int -> Identity a # zeroBits :: Identity a # bit :: Int -> Identity a # setBit :: Identity a -> Int -> Identity a # clearBit :: Identity a -> Int -> Identity a # complementBit :: Identity a -> Int -> Identity a # testBit :: Identity a -> Int -> Bool # bitSizeMaybe :: Identity a -> Maybe Int # bitSize :: Identity a -> Int # isSigned :: Identity a -> Bool # shiftL :: Identity a -> Int -> Identity a # unsafeShiftL :: Identity a -> Int -> Identity a # shiftR :: Identity a -> Int -> Identity a # unsafeShiftR :: Identity a -> Int -> Identity a # rotateL :: Identity a -> Int -> Identity a # rotateR :: Identity a -> Int -> Identity a # popCount :: Identity a -> Int #
FiniteBits a => FiniteBits (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods finiteBitSize :: Identity a -> Int # countLeadingZeros :: Identity a -> Int # countTrailingZeros :: Identity a -> Int #
Data a => Data (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Identity a -> c (Identity a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Identity a) # toConstr :: Identity a -> Constr # dataTypeOf :: Identity a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Identity a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Identity a)) # gmapT :: (forall b. Data b => b -> b) -> Identity a -> Identity a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r # gmapQ :: (forall d. Data d => d -> u) -> Identity a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Identity a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) #
IsString a => IsString (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.String Methods fromString :: String -> Identity a #
Bounded a => Bounded (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods minBound :: Identity a # maxBound :: Identity a #
Enum a => Enum (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods succ :: Identity a -> Identity a # pred :: Identity a -> Identity a # toEnum :: Int -> Identity a # fromEnum :: Identity a -> Int # enumFrom :: Identity a -> [Identity a] # enumFromThen :: Identity a -> Identity a -> [Identity a] # enumFromTo :: Identity a -> Identity a -> [Identity a] # enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] #
Floating a => Floating (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods pi :: Identity a # exp :: Identity a -> Identity a # log :: Identity a -> Identity a # sqrt :: Identity a -> Identity a # (**) :: Identity a -> Identity a -> Identity a # logBase :: Identity a -> Identity a -> Identity a # sin :: Identity a -> Identity a # cos :: Identity a -> Identity a # tan :: Identity a -> Identity a # asin :: Identity a -> Identity a # acos :: Identity a -> Identity a # atan :: Identity a -> Identity a # sinh :: Identity a -> Identity a # cosh :: Identity a -> Identity a # tanh :: Identity a -> Identity a # asinh :: Identity a -> Identity a # acosh :: Identity a -> Identity a # atanh :: Identity a -> Identity a # log1p :: Identity a -> Identity a # expm1 :: Identity a -> Identity a # log1pexp :: Identity a -> Identity a # log1mexp :: Identity a -> Identity a #
RealFloat a => RealFloat (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods floatRadix :: Identity a -> Integer # floatDigits :: Identity a -> Int # floatRange :: Identity a -> (Int, Int) # decodeFloat :: Identity a -> (Integer, Int) # encodeFloat :: Integer -> Int -> Identity a # exponent :: Identity a -> Int # significand :: Identity a -> Identity a # scaleFloat :: Int -> Identity a -> Identity a # isNaN :: Identity a -> Bool # isInfinite :: Identity a -> Bool # isDenormalized :: Identity a -> Bool # isNegativeZero :: Identity a -> Bool # isIEEE :: Identity a -> Bool # atan2 :: Identity a -> Identity a -> Identity a #
Storable a => Storable (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods sizeOf :: Identity a -> Int # alignment :: Identity a -> Int # peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) # pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () # peekByteOff :: Ptr b -> Int -> IO (Identity a) # pokeByteOff :: Ptr b -> Int -> Identity a -> IO () # peek :: Ptr (Identity a) -> IO (Identity a) # poke :: Ptr (Identity a) -> Identity a -> IO () #
Generic (Identity a) |
Instance details Defined in GHC.Internal.Data.Functor.Identity Associated Types
type Rep (Identity a) | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity type Rep (Identity a) = D1 ('MetaData "Identity" "GHC.Internal.Data.Functor.Identity" "ghc-internal" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
Methods from :: Identity a -> Rep (Identity a) x # to :: Rep (Identity a) x -> Identity a #
Ix a => Ix (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods range :: (Identity a, Identity a) -> [Identity a] # index :: (Identity a, Identity a) -> Identity a -> Int # unsafeIndex :: (Identity a, Identity a) -> Identity a -> Int # inRange :: (Identity a, Identity a) -> Identity a -> Bool # rangeSize :: (Identity a, Identity a) -> Int # unsafeRangeSize :: (Identity a, Identity a) -> Int #
Num a => Num (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods (+) :: Identity a -> Identity a -> Identity a # (-) :: Identity a -> Identity a -> Identity a # (*) :: Identity a -> Identity a -> Identity a # negate :: Identity a -> Identity a # abs :: Identity a -> Identity a # signum :: Identity a -> Identity a # fromInteger :: Integer -> Identity a #
Read a => Read (Identity a) | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods readsPrec :: Int -> ReadS (Identity a) # readList :: ReadS [Identity a] # readPrec :: ReadPrec (Identity a) # readListPrec :: ReadPrec [Identity a] #
Fractional a => Fractional (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods (/) :: Identity a -> Identity a -> Identity a # recip :: Identity a -> Identity a # fromRational :: Rational -> Identity a #
Integral a => Integral (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods quot :: Identity a -> Identity a -> Identity a # rem :: Identity a -> Identity a -> Identity a # div :: Identity a -> Identity a -> Identity a # mod :: Identity a -> Identity a -> Identity a # quotRem :: Identity a -> Identity a -> (Identity a, Identity a) # divMod :: Identity a -> Identity a -> (Identity a, Identity a) # toInteger :: Identity a -> Integer #
Real a => Real (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods toRational :: Identity a -> Rational #
RealFrac a => RealFrac (Identity a) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods properFraction :: Integral b => Identity a -> (b, Identity a) # truncate :: Integral b => Identity a -> b # round :: Integral b => Identity a -> b # ceiling :: Integral b => Identity a -> b # floor :: Integral b => Identity a -> b #
Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods showsPrec :: Int -> Identity a -> ShowS # show :: Identity a -> String # showList :: [Identity a] -> ShowS #
Eq a => Eq (Identity a) | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods (==) :: Identity a -> Identity a -> Bool # (/=) :: Identity a -> Identity a -> Bool #
Ord a => Ord (Identity a) | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity Methods compare :: Identity a -> Identity a -> Ordering # (<) :: Identity a -> Identity a -> Bool # (<=) :: Identity a -> Identity a -> Bool # (>) :: Identity a -> Identity a -> Bool # (>=) :: Identity a -> Identity a -> Bool # max :: Identity a -> Identity a -> Identity a # min :: Identity a -> Identity a -> Identity a #
type Rep1 Identity | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity type Rep1 Identity = D1 ('MetaData "Identity" "GHC.Internal.Data.Functor.Identity" "ghc-internal" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep (Identity a) | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Functor.Identity type Rep (Identity a) = D1 ('MetaData "Identity" "GHC.Internal.Data.Functor.Identity" "ghc-internal" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

replicateM :: Applicative m => CountOf a -> m a -> m [a] #

``replicateM` n act` performs the action `n` times, gathering the results.