| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unison.Prelude
Synopsis
- module Control.Applicative
- module Control.Monad
- module Control.Monad.IO.Class
- module Control.Monad.Trans
- module Data.Bifunctor
- module Data.Coerce
- module Data.Either
- module Data.Functor
- module Data.Functor.Identity
- module Data.Int
- module Data.Word
- module Debug.Trace
- class Generic1 (f :: k -> Type)
- data Void
- class Generic a
- sortOn :: Ord b => (a -> b) -> [a] -> [a]
- (>>>) :: forall {k} cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c
- class IsString a where
- fromString :: String -> a
- toList :: Foldable t => t a -> [a]
- foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
- fold :: (Foldable t, Monoid m) => t m -> m
- class Typeable (a :: k)
- data Text
- type HasCallStack = ?callStack :: CallStack
- data SomeException
- isJust :: Maybe a -> Bool
- isNothing :: Maybe a -> Bool
- fromMaybe :: a -> Maybe a -> a
- maybeToList :: Maybe a -> [a]
- listToMaybe :: [a] -> Maybe a
- catMaybes :: [Maybe a] -> [a]
- mapMaybe :: Filterable f => (a -> Maybe b) -> f a -> f b
- foldl1' :: HasCallStack => (a -> a -> a) -> [a] -> a
- (&) :: a -> (a -> b) -> b
- readMaybe :: Read a => String -> Maybe a
- class From source target where
- from :: source -> target
- traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- class (Typeable e, Show e) => Exception e
- data IOException
- try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a)
- for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
- data ByteString
- data Map k a
- data Set a
- data Seq a
- mapLeft :: (a -> c) -> Either a b -> Either c b
- maybeToRight :: b -> Maybe a -> Either b a
- newtype MaybeT (m :: Type -> Type) a = MaybeT {}
- mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]
- whenM :: Monad m => m Bool -> m () -> m ()
- unlessM :: Monad m => m Bool -> m () -> m ()
- ifM :: Monad m => m Bool -> m a -> m a -> m a
- headMay :: [a] -> Maybe a
- lastMay :: [a] -> Maybe a
- atMay :: [a] -> Int -> Maybe a
- readMay :: Read a => String -> Maybe a
- encodeUtf8 :: Text -> ByteString
- decodeUtf8 :: ByteString -> Text
- class MonadIO m => MonadUnliftIO (m :: Type -> Type) where
- withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b
- askRunInIO :: MonadUnliftIO m => m (m a -> IO a)
- askUnliftIO :: MonadUnliftIO m => m (UnliftIO m)
- withUnliftIO :: MonadUnliftIO m => (UnliftIO m -> IO a) -> m a
- class TryFrom source target where
- tryFrom :: source -> Either (TryFromException source target) target
- data TryFromException source target = TryFromException source (Maybe SomeException)
- into :: forall target source. From source target => source -> target
- tryInto :: forall target source. TryFrom source target => source -> Either (TryFromException source target) target
- wither :: (Witherable t, Applicative f) => (a -> f (Maybe b)) -> t a -> f (t b)
- filterA :: (Witherable t, Applicative f) => (a -> f Bool) -> t a -> f (t a)
- witherMap :: (Witherable t, Applicative m) => (t b -> r) -> (a -> m (Maybe b)) -> t a -> m r
- forMaybe :: (Witherable t, Applicative f) => t a -> (a -> f (Maybe b)) -> f (t b)
- readUtf8 :: FilePath -> IO Text
- safeReadUtf8 :: FilePath -> IO (Either IOException Text)
- safeReadUtf8StdIn :: IO (Either IOException Text)
- writeUtf8 :: FilePath -> Text -> IO ()
- prependUtf8 :: FilePath -> Text -> IO ()
- uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e
- reportBug :: String -> String -> String
- tShow :: Show a => a -> Text
- wundefined :: HasCallStack => a
- onFalse :: Applicative m => m () -> Bool -> m ()
- onFalseM :: Monad m => m () -> m Bool -> m ()
- onTrue :: Applicative m => m () -> Bool -> m ()
- onTrueM :: Monad m => m () -> m Bool -> m ()
- onNothing :: Applicative m => m a -> Maybe a -> m a
- onNothingM :: Monad m => m a -> m (Maybe a) -> m a
- whenNothing :: Applicative m => Maybe a -> m a -> m a
- whenNothingM :: Monad m => m (Maybe a) -> m a -> m a
- whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
- whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m ()
- eitherToMaybe :: Either a b -> Maybe b
- maybeToEither :: a -> Maybe b -> Either a b
- eitherToThese :: Either a b -> These a b
- altSum :: (Alternative f, Foldable t) => t (f a) -> f a
- altMap :: (Alternative f, Foldable t) => (a -> f b) -> t a -> f b
- hoistMaybe :: forall (m :: Type -> Type) a. Applicative m => Maybe a -> MaybeT m a
- onLeft :: Applicative m => (a -> m b) -> Either a b -> m b
- onLeftM :: Monad m => (a -> m b) -> m (Either a b) -> m b
- whenLeft :: Applicative m => Either a b -> (a -> m b) -> m b
- whenLeftM :: Monad m => m (Either a b) -> (a -> m b) -> m b
- throwEitherM :: forall e m a. (MonadIO m, Exception e) => m (Either e a) -> m a
- throwEitherMWith :: forall e e' m a. (MonadIO m, Exception e') => (e -> e') -> m (Either e a) -> m a
- throwExceptT :: (MonadIO m, Exception e) => ExceptT e m a -> m a
- throwExceptTWith :: (MonadIO m, Exception e') => (e -> e') -> ExceptT e m a -> m a
- (^.) :: s -> Getting a s a -> a
- (.~) :: ASetter s t a b -> b -> s -> t
- (%~) :: ASetter s t a b -> (a -> b) -> s -> t
- view :: MonadReader s m => Getting a s a -> m a
- set :: ASetter s t a b -> b -> s -> t
- over :: ASetter s t a b -> (a -> b) -> s -> t
Documentation
module Control.Applicative
module Control.Monad
module Control.Monad.IO.Class
module Control.Monad.Trans
module Data.Bifunctor
module Data.Coerce
module Data.Either
module Data.Functor
module Data.Functor.Identity
module Data.Int
module Data.Word
module Debug.Trace
class Generic1 (f :: k -> Type) #
Representable types of kind * -> * (or kind k -> *, when PolyKinds
is enabled).
This class is derivable in GHC with the DeriveGeneric flag on.
A Generic1 instance must satisfy the following laws:
from1.to1≡idto1.from1≡id
Instances
Uninhabited data type
Since: base-4.8.0.0
Instances
| Semigroup Void | Since: base-4.9.0.0 |
| Exception Void | Since: base-4.8.0.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # backtraceDesired :: Void -> Bool # | |
| Generic Void | |
| Read Void | Reading a Since: base-4.8.0.0 |
| Show Void | Since: base-4.8.0.0 |
| Eq Void | Since: base-4.8.0.0 |
| Ord Void | Since: base-4.8.0.0 |
| Hashable Void | |
Defined in Data.Hashable.Class | |
| 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.
|
Defined in Prettyprinter.Internal | |
| FoldableWithIndex Void (Proxy :: Type -> Type) | |
Defined in WithIndex | |
| FoldableWithIndex Void (U1 :: Type -> Type) | |
| FoldableWithIndex Void (V1 :: Type -> Type) | |
| FunctorWithIndex Void (Proxy :: Type -> Type) | |
| FunctorWithIndex Void (U1 :: Type -> Type) | |
| FunctorWithIndex Void (V1 :: Type -> Type) | |
| TraversableWithIndex Void (Proxy :: Type -> Type) | |
| TraversableWithIndex Void (U1 :: Type -> Type) | |
| TraversableWithIndex Void (V1 :: Type -> Type) | |
| FilterableWithIndex Void (Proxy :: Type -> Type) | |
| WitherableWithIndex Void (Proxy :: Type -> Type) | |
| FoldableWithIndex Void (Const e :: Type -> Type) | |
Defined in WithIndex | |
| FoldableWithIndex Void (Constant e :: Type -> Type) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => (Void -> a -> m) -> Constant e a -> m # ifoldMap' :: Monoid m => (Void -> a -> m) -> Constant e a -> m # ifoldr :: (Void -> a -> b -> b) -> b -> Constant e a -> b # ifoldl :: (Void -> b -> a -> b) -> b -> Constant e a -> b # ifoldr' :: (Void -> a -> b -> b) -> b -> Constant e a -> b # ifoldl' :: (Void -> b -> a -> b) -> b -> Constant e a -> b # | |
| FunctorWithIndex Void (Const e :: Type -> Type) | |
| FunctorWithIndex Void (Constant e :: Type -> Type) | |
| TraversableWithIndex Void (Const e :: Type -> Type) | |
| TraversableWithIndex Void (Constant e :: Type -> Type) | |
| FoldableWithIndex Void (K1 i c :: Type -> Type) | |
Defined in WithIndex | |
| FunctorWithIndex Void (K1 i c :: Type -> Type) | |
| TraversableWithIndex Void (K1 i c :: Type -> Type) | |
| type Rep Void | Since: base-4.8.0.0 |
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≡idto.from≡id
Instances
| Generic ShortByteString | |||||
Defined in Data.ByteString.Short.Internal Associated Types
Methods from :: ShortByteString -> Rep ShortByteString x # to :: Rep ShortByteString x -> ShortByteString # | |||||
| Generic Void | |||||
| Generic Fingerprint | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic Associativity | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic DecidedStrictness | |||||
Defined in GHC.Internal.Generics Associated Types
Methods from :: DecidedStrictness -> Rep DecidedStrictness x # to :: Rep DecidedStrictness x -> DecidedStrictness # | |||||
| Generic Fixity | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic SourceStrictness | |||||
Defined in GHC.Internal.Generics Associated Types
Methods from :: SourceStrictness -> Rep SourceStrictness x # to :: Rep SourceStrictness x -> SourceStrictness # | |||||
| Generic SourceUnpackedness | |||||
Defined in GHC.Internal.Generics Associated Types
Methods from :: SourceUnpackedness -> Rep SourceUnpackedness x # to :: Rep SourceUnpackedness x -> SourceUnpackedness # | |||||
| Generic ExitCode | |||||
Defined in GHC.Internal.IO.Exception Associated Types
| |||||
| Generic SrcLoc | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic GCDetails | |||||
Defined in GHC.Internal.Stats Associated Types
| |||||
| Generic RTSStats | |||||
Defined in GHC.Internal.Stats Associated Types
| |||||
| Generic GeneralCategory | |||||
Defined in GHC.Internal.Generics Associated Types
Methods from :: GeneralCategory -> Rep GeneralCategory x # to :: Rep GeneralCategory x -> GeneralCategory # | |||||
| Generic Ordering | |||||
Defined in GHC.Internal.Generics | |||||
| Generic OsChar | |||||
Defined in System.OsString.Internal.Types Associated Types
| |||||
| Generic OsString | |||||
Defined in System.OsString.Internal.Types Associated Types
| |||||
| Generic PosixChar | |||||
Defined in System.OsString.Internal.Types Associated Types
| |||||
| Generic PosixString | |||||
Defined in System.OsString.Internal.Types Associated Types
| |||||
| Generic WindowsChar | |||||
Defined in System.OsString.Internal.Types Associated Types
| |||||
| Generic WindowsString | |||||
Defined in System.OsString.Internal.Types Associated Types
| |||||
| Generic ColorOptions | |||||
Defined in Text.Pretty.Simple.Internal.Color Associated Types
| |||||
| Generic Style | |||||
Defined in Text.Pretty.Simple.Internal.Color Associated Types
| |||||
| Generic Expr | |||||
Defined in Text.Pretty.Simple.Internal.Expr Associated Types
| |||||
| Generic CheckColorTty | |||||
Defined in Text.Pretty.Simple.Internal.Printer Associated Types
| |||||
| Generic OutputOptions | |||||
Defined in Text.Pretty.Simple.Internal.Printer Associated Types
| |||||
| Generic StringOutputStyle | |||||
Defined in Text.Pretty.Simple.Internal.Printer Associated Types
Methods from :: StringOutputStyle -> Rep StringOutputStyle x # to :: Rep StringOutputStyle x -> StringOutputStyle # | |||||
| Generic ConstructorInfo | |||||
Defined in Language.Haskell.TH.Datatype Associated Types
Methods from :: ConstructorInfo -> Rep ConstructorInfo x # to :: Rep ConstructorInfo x -> ConstructorInfo # | |||||
| Generic ConstructorVariant | |||||
Defined in Language.Haskell.TH.Datatype Associated Types
Methods from :: ConstructorVariant -> Rep ConstructorVariant x # to :: Rep ConstructorVariant x -> ConstructorVariant # | |||||
| Generic DatatypeInfo | |||||
Defined in Language.Haskell.TH.Datatype Associated Types
| |||||
| Generic DatatypeVariant | |||||
Defined in Language.Haskell.TH.Datatype Associated Types
Methods from :: DatatypeVariant -> Rep DatatypeVariant x # to :: Rep DatatypeVariant x -> DatatypeVariant # | |||||
| Generic FieldStrictness | |||||
Defined in Language.Haskell.TH.Datatype Associated Types
Methods from :: FieldStrictness -> Rep FieldStrictness x # to :: Rep FieldStrictness x -> FieldStrictness # | |||||
| Generic Strictness | |||||
Defined in Language.Haskell.TH.Datatype Associated Types
| |||||
| Generic Unpackedness | |||||
Defined in Language.Haskell.TH.Datatype Associated Types
| |||||
| Generic ConcException | |||||
Defined in UnliftIO.Internals.Async Associated Types
| |||||
| Generic () | |||||
| Generic Bool | |||||
Defined in GHC.Internal.Generics | |||||
| Generic (Complex a) | |||||
Defined in Data.Complex Associated Types
| |||||
| Generic (First a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Generic (Last a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Generic (Max a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Generic (Min a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Generic (WrappedMonoid m) | |||||
Defined in Data.Semigroup Associated Types
Methods from :: WrappedMonoid m -> Rep (WrappedMonoid m) x # to :: Rep (WrappedMonoid m) x -> WrappedMonoid m # | |||||
| Generic (SCC vertex) | |||||
Defined in Data.Graph Associated Types
| |||||
| Generic (Digit a) | |||||
Defined in Data.Sequence.Internal Associated Types
| |||||
| Generic (Elem a) | |||||
Defined in Data.Sequence.Internal Associated Types
| |||||
| Generic (FingerTree a) | |||||
Defined in Data.Sequence.Internal Associated Types
| |||||
| Generic (Node a) | |||||
Defined in Data.Sequence.Internal Associated Types
| |||||
| Generic (ViewL a) | |||||
Defined in Data.Sequence.Internal Associated Types
| |||||
| Generic (ViewR a) | |||||
Defined in Data.Sequence.Internal Associated Types
| |||||
| Generic (Tree a) | |||||
Defined in Data.Tree Associated Types
| |||||
| Generic (NonEmpty a) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Identity a) | |||||
Defined in GHC.Internal.Data.Functor.Identity Associated Types
| |||||
| Generic (Down a) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (ZipList a) | |||||
Defined in GHC.Internal.Functor.ZipList Associated Types
| |||||
| Generic (Par1 p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (CommaSeparated a) | |||||
Defined in Text.Pretty.Simple.Internal.Expr Associated Types
Methods from :: CommaSeparated a -> Rep (CommaSeparated a) x # to :: Rep (CommaSeparated a) x -> CommaSeparated a # | |||||
| Generic (Doc ann) | |||||
Defined in Prettyprinter.Internal Associated Types
| |||||
| Generic (SimpleDocStream ann) | |||||
Defined in Prettyprinter.Internal Associated Types
Methods from :: SimpleDocStream ann -> Rep (SimpleDocStream ann) x # to :: Rep (SimpleDocStream ann) x -> SimpleDocStream ann # | |||||
| Generic (Maybe a) | |||||
Defined in Data.Strict.Maybe Associated Types
| |||||
| Generic (Maybe a) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Solo a) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic [a] | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (WrappedMonad m a) | |||||
Defined in Control.Applicative Associated Types
Methods from :: WrappedMonad m a -> Rep (WrappedMonad m a) x # to :: Rep (WrappedMonad m a) x -> WrappedMonad m a # | |||||
| Generic (Arg a b) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Generic (Cofree f a) | |||||
Defined in Control.Comonad.Cofree Associated Types
| |||||
| Generic (Free f a) | |||||
Defined in Control.Monad.Free Associated Types
| |||||
| Generic (Either a b) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Proxy t) | |||||
Defined in GHC.Internal.Generics | |||||
| Generic (U1 p) | |||||
Defined in GHC.Internal.Generics | |||||
| Generic (V1 p) | |||||
| Generic (Either a b) | |||||
Defined in Data.Strict.Either Associated Types
| |||||
| Generic (These a b) | |||||
Defined in Data.Strict.These Associated Types
| |||||
| Generic (Pair a b) | |||||
Defined in Data.Strict.Tuple Associated Types
| |||||
| Generic (These a b) | |||||
Defined in Data.These Associated Types
| |||||
| Generic (Lift f a) | |||||
Defined in Control.Applicative.Lift Associated Types
| |||||
| Generic (MaybeT m a) | |||||
Defined in Control.Monad.Trans.Maybe Associated Types
| |||||
| Generic (a, b) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (WrappedArrow a b c) | |||||
Defined in Control.Applicative Associated Types
Methods from :: WrappedArrow a b c -> Rep (WrappedArrow a b c) x # to :: Rep (WrappedArrow a b c) x -> WrappedArrow a b c # | |||||
| Generic (Fix p a) | |||||
Defined in Data.Bifunctor.Fix Associated Types
| |||||
| Generic (Join p a) | |||||
Defined in Data.Bifunctor.Join Associated Types
| |||||
| Generic (CofreeF f a b) | |||||
Defined in Control.Comonad.Trans.Cofree Associated Types
| |||||
| Generic (FreeF f a b) | |||||
Defined in Control.Monad.Trans.Free Associated Types
| |||||
| Generic (Kleisli m a b) | |||||
Defined in GHC.Internal.Control.Arrow Associated Types
| |||||
| Generic (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Associated Types
| |||||
| Generic (Rec1 f p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (URec (Ptr ()) p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (URec Char p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (URec Double p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (URec Float p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (URec Int p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (URec Word p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Tagged s b) | |||||
Defined in Data.Tagged Associated Types
| |||||
| Generic (These1 f g a) | |||||
Defined in Data.Functor.These Associated Types
| |||||
| Generic (Backwards f a) | |||||
Defined in Control.Applicative.Backwards Associated Types
| |||||
| Generic (AccumT w m a) | |||||
Defined in Control.Monad.Trans.Accum Associated Types
| |||||
| Generic (ExceptT e m a) | |||||
Defined in Control.Monad.Trans.Except Associated Types
| |||||
| Generic (IdentityT f a) | |||||
Defined in Control.Monad.Trans.Identity Associated Types
| |||||
| Generic (ReaderT r m a) | |||||
Defined in Control.Monad.Trans.Reader Associated Types
| |||||
| Generic (SelectT r m a) | |||||
Defined in Control.Monad.Trans.Select Associated Types
| |||||
| Generic (StateT s m a) | |||||
Defined in Control.Monad.Trans.State.Lazy Associated Types
| |||||
| Generic (StateT s m a) | |||||
Defined in Control.Monad.Trans.State.Strict Associated Types
| |||||
| Generic (WriterT w m a) | |||||
Defined in Control.Monad.Trans.Writer.CPS Associated Types
| |||||
| Generic (WriterT w m a) | |||||
Defined in Control.Monad.Trans.Writer.Lazy Associated Types
| |||||
| Generic (WriterT w m a) | |||||
Defined in Control.Monad.Trans.Writer.Strict Associated Types
| |||||
| Generic (Constant a b) | |||||
Defined in Data.Functor.Constant Associated Types
| |||||
| Generic (Reverse f a) | |||||
Defined in Data.Functor.Reverse Associated Types
| |||||
| Generic (a, b, c) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Product f g a) | |||||
Defined in Data.Functor.Product Associated Types
| |||||
| Generic (Sum f g a) | |||||
Defined in Data.Functor.Sum Associated Types
| |||||
| Generic ((f :*: g) p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic ((f :+: g) p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (K1 i c p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (ContT r m a) | |||||
Defined in Control.Monad.Trans.Cont Associated Types
| |||||
| Generic (a, b, c, d) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Compose f g a) | |||||
Defined in Data.Functor.Compose Associated Types
| |||||
| Generic (Clown f a b) | |||||
Defined in Data.Bifunctor.Clown Associated Types
| |||||
| Generic (Flip p a b) | |||||
Defined in Data.Bifunctor.Flip Associated Types
| |||||
| Generic (Joker g a b) | |||||
Defined in Data.Bifunctor.Joker Associated Types
| |||||
| Generic (WrappedBifunctor p a b) | |||||
Defined in Data.Bifunctor.Wrapped Associated Types
Methods from :: WrappedBifunctor p a b -> Rep (WrappedBifunctor p a b) x # to :: Rep (WrappedBifunctor p a b) x -> WrappedBifunctor p a b # | |||||
| Generic ((f :.: g) p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (M1 i c f p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (RWST r w s m a) | |||||
Defined in Control.Monad.Trans.RWS.CPS Associated Types
| |||||
| Generic (RWST r w s m a) | |||||
Defined in Control.Monad.Trans.RWS.Lazy Associated Types
| |||||
| Generic (RWST r w s m a) | |||||
Defined in Control.Monad.Trans.RWS.Strict Associated Types
| |||||
| Generic (a, b, c, d, e) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Product f g a b) | |||||
Defined in Data.Bifunctor.Product Associated Types
| |||||
| Generic (Sum p q a b) | |||||
Defined in Data.Bifunctor.Sum Associated Types
| |||||
| Generic (a, b, c, d, e, f) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Tannen f p a b) | |||||
Defined in Data.Bifunctor.Tannen Associated Types
| |||||
| Generic (a, b, c, d, e, f, g) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (Biff p f g a b) | |||||
Defined in Data.Bifunctor.Biff Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h, i) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h, i, j) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h, i, j, k) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h, i, j, k, l) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h, i, j, k, l, m) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
sortOn :: Ord b => (a -> b) -> [a] -> [a] #
Sort a list by comparing the results of a key function applied to each
element. is equivalent to sortOn f, but has the
performance advantage of only evaluating sortBy (comparing f)f once for each element in the
input list. This is called the decorate-sort-undecorate paradigm, or
Schwartzian transform.
Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.
The argument must be finite.
Examples
>>>sortOn fst [(2, "world"), (4, "!"), (1, "Hello")][(1,"Hello"),(2,"world"),(4,"!")]
>>>sortOn length ["jim", "creed", "pam", "michael", "dwight", "kevin"]["jim","pam","creed","kevin","dwight","michael"]
Performance notes
This function minimises the projections performed, by materialising the projections in an intermediate list.
For trivial projections, you should prefer using sortBy with
comparing, for example:
>>>sortBy (comparing fst) [(3, 1), (2, 2), (1, 3)][(1,3),(2,2),(3,1)]
Or, for the exact same API as sortOn, you can use `sortBy . comparing`:
>>>(sortBy . comparing) fst [(3, 1), (2, 2), (1, 3)][(1,3),(2,2),(3,1)]
Since: base-4.8.0.0
(>>>) :: forall {k} cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c infixr 1 #
Left-to-right composition
IsString is used in combination with the -XOverloadedStrings
language extension to convert the literals to different string types.
For example, if you use the text package, you can say
{-# LANGUAGE OverloadedStrings #-}
myText = "hello world" :: Text
Internally, the extension will convert this to the equivalent of
myText = fromString @Text ("hello world" :: String)
Note: You can use fromString in normal code as well,
but the usual performance/memory efficiency problems with String apply.
Methods
fromString :: String -> a #
Instances
| IsString Builder | |
Defined in Data.ByteString.Builder Methods fromString :: String -> Builder # | |
| 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 Text | Performs replacement on invalid scalar values:
|
Defined in Data.Text Methods fromString :: String -> Text # | |
| IsString Builder | Performs replacement on invalid scalar values:
|
Defined in Data.Text.Internal.Builder Methods fromString :: String -> Builder # | |
| IsString Text | Performs replacement on invalid scalar values:
|
Defined in Data.Text.Lazy Methods fromString :: String -> Text # | |
| a ~ Char => IsString (Seq a) | Since: containers-0.5.7 |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
| IsString a => IsString (Identity a) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.String Methods fromString :: String -> Identity a # | |
| (IsString a, Hashable a) => IsString (Hashed a) | |
Defined in Data.Hashable.Class Methods fromString :: String -> Hashed 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 GHC.Internal.Data.String Methods fromString :: String -> [a] # | |
| IsString a => IsString (Const a b) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.String Methods fromString :: String -> Const a b # | |
| IsString a => IsString (Tagged s a) | |
Defined in Data.Tagged Methods fromString :: String -> Tagged s a # | |
toList :: Foldable t => t a -> [a] #
List of elements of a structure, from left to right. If the entire list is intended to be reduced via a fold, just fold the structure directly bypassing the list.
Examples
Basic usage:
>>>toList Nothing[]
>>>toList (Just 42)[42]
>>>toList (Left "foo")[]
>>>toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8)))[5,17,12,8]
For lists, toList is the identity:
>>>toList [1, 2, 3][1,2,3]
Since: base-4.8.0.0
foldl' :: Foldable t => (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
fold :: (Foldable t, Monoid m) => t m -> m #
Given a structure with elements whose type is a Monoid, combine them
via the monoid's ( operator. This fold is right-associative and
lazy in the accumulator. When you need a strict left-associative fold,
use <>)foldMap' instead, with id as the map.
Examples
Basic usage:
>>>fold [[1, 2, 3], [4, 5], [6], []][1,2,3,4,5,6]
>>>fold $ Node (Leaf (Sum 1)) (Sum 3) (Leaf (Sum 5))Sum {getSum = 9}
Folds of unbounded structures do not terminate when the monoid's
( operator is strict:<>)
>>>fold (repeat Nothing)* Hangs forever *
Lazy corecursive folds of unbounded structures are fine:
>>>take 12 $ fold $ map (\i -> [i..i+2]) [0..][0,1,2,1,2,3,2,3,4,3,4,5]>>>sum $ take 4000000 $ fold $ map (\i -> [i..i+2]) [0..]2666668666666
The class Typeable allows a concrete representation of a type to
be calculated.
Minimal complete definition
typeRep#
A space efficient, packed, unboxed Unicode text type.
Instances
| PrintfArg Text | Since: text-1.2.2.0 |
Defined in Data.Text | |
| Binary Text | Since: text-1.2.1.0 |
| NFData Text | |
| Monoid Text | |
| Semigroup Text | Beware: Since: text-1.2.2.0 |
| Data Text | This instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction. This instance was created by copying the updated behavior of
The original discussion is archived here: could we get a Data instance for Data.Text.Text? The followup discussion that changed the behavior of |
Defined in Data.Text Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Text -> c Text # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Text # dataTypeOf :: Text -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Text) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Text) # gmapT :: (forall b. Data b => b -> b) -> Text -> Text # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Text -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Text -> r # gmapQ :: (forall d. Data d => d -> u) -> Text -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Text -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Text -> m Text # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Text -> m Text # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Text -> m Text # | |
| IsString Text | Performs replacement on invalid scalar values:
|
Defined in Data.Text Methods fromString :: String -> Text # | |
| IsList Text | Performs replacement on invalid scalar values:
Since: text-1.2.0.0 |
| Read Text | |
| Show Text | |
| Eq Text | |
| Ord Text | |
| Hashable Text | |
Defined in Data.Hashable.Class | |
| Ixed Text | |
Defined in Control.Lens.At | |
| AsEmpty Text | |
Defined in Control.Lens.Empty | |
| Reversing Text | |
Defined in Control.Lens.Internal.Iso | |
| Prefixed Text | |
| Suffixed Text | |
| IsText Text | |
| Pretty Text | Automatically converts all newlines to
Note that
Manually use |
Defined in Prettyprinter.Internal | |
| Lift Text | Since: text-1.2.4.0 |
| From Text Text | Uses |
Defined in Witch.Instances | |
| From Text Utf16BL | Converts via |
Defined in Witch.Instances | |
| From Text Utf16BS | Uses |
Defined in Witch.Instances | |
| From Text Utf16LL | Converts via |
Defined in Witch.Instances | |
| From Text Utf16LS | Uses |
Defined in Witch.Instances | |
| From Text Utf32BL | Converts via |
Defined in Witch.Instances | |
| From Text Utf32BS | Uses |
Defined in Witch.Instances | |
| From Text Utf32LL | Converts via |
Defined in Witch.Instances | |
| From Text Utf32LS | Uses |
Defined in Witch.Instances | |
| From Text Utf8L | Converts via |
Defined in Witch.Instances | |
| From Text Utf8S | Uses |
Defined in Witch.Instances | |
| From Text String | Uses |
Defined in Witch.Instances | |
| From Text Text | Uses |
Defined in Witch.Instances | |
| From Latin1L Text | Converts via |
Defined in Witch.Instances | |
| From Latin1S Text | Uses |
Defined in Witch.Instances | |
| From String Text | Uses |
Defined in Witch.Instances | |
| TryFrom Text Latin1L | Converts via |
Defined in Witch.Instances | |
| TryFrom Text Latin1S | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16BL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16BS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf16LL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16LS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf32BL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32BS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf32LL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32LS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf8L Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf8S Text | Uses |
Defined in Witch.Instances | |
| Cons Text Text Char Char | |
| Snoc Text Text Char Char | |
| (a ~ Char, b ~ Char) => Each Text Text a b |
|
| type Item Text | |
| type Index Text | |
Defined in Control.Lens.At | |
| type IxValue Text | |
Defined in Control.Lens.At | |
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 | This drops any attached Since: base-3.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # backtraceDesired :: SomeException -> Bool # | |
| Show SomeException | Since: ghc-internal-3.0 |
Defined in GHC.Internal.Exception.Type Methods showsPrec :: Int -> SomeException -> ShowS # show :: SomeException -> String # showList :: [SomeException] -> ShowS # | |
| AsAllocationLimitExceeded SomeException | |
Defined in Control.Exception.Lens | |
| AsArithException SomeException | |
Defined in Control.Exception.Lens Methods | |
| AsArrayException SomeException | |
Defined in Control.Exception.Lens Methods | |
| AsAssertionFailed SomeException | |
Defined in Control.Exception.Lens | |
| AsAsyncException SomeException | |
Defined in Control.Exception.Lens Methods | |
| AsBlockedIndefinitelyOnMVar SomeException | |
Defined in Control.Exception.Lens | |
| AsBlockedIndefinitelyOnSTM SomeException | |
Defined in Control.Exception.Lens | |
| AsCompactionFailed SomeException | |
Defined in Control.Exception.Lens | |
| AsDeadlock SomeException | |
Defined in Control.Exception.Lens | |
| AsErrorCall SomeException | |
Defined in Control.Exception.Lens | |
| AsHandlingException SomeException | |
Defined in Control.Exception.Lens | |
| AsIOException SomeException | |
Defined in Control.Exception.Lens Methods | |
| AsNestedAtomically SomeException | |
Defined in Control.Exception.Lens Methods __NestedAtomically :: Prism' SomeException NestedAtomically # | |
| AsNoMethodError SomeException | |
Defined in Control.Exception.Lens | |
| AsNonTermination SomeException | |
Defined in Control.Exception.Lens Methods __NonTermination :: Prism' SomeException NonTermination # _NonTermination :: Prism' SomeException () # | |
| AsPatternMatchFail SomeException | |
Defined in Control.Exception.Lens | |
| AsRecConError SomeException | |
Defined in Control.Exception.Lens Methods | |
| AsRecSelError SomeException | |
Defined in Control.Exception.Lens Methods | |
| AsRecUpdError SomeException | |
Defined in Control.Exception.Lens Methods | |
| AsTypeError SomeException | |
Defined in Control.Exception.Lens | |
| AsDynamic SomeException | |
Defined in Data.Dynamic.Lens Methods _Dynamic :: Typeable a => Prism' SomeException a # | |
| AsExitCode SomeException | |
Defined in System.Exit.Lens Methods | |
| Handleable SomeException IO Handler | |
| Typeable m => Handleable SomeException m (Handler m) | |
Defined in Control.Lens.Internal.Exception | |
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 GHC.Internal.Text.Read ( readMaybe )>>>fromMaybe 0 (readMaybe "5")5>>>fromMaybe 0 (readMaybe "")0
maybeToList :: Maybe a -> [a] #
The maybeToList function returns an empty list when given
Nothing or a singleton list when given Just.
Examples
Basic usage:
>>>maybeToList (Just 7)[7]
>>>maybeToList Nothing[]
One can use maybeToList to avoid pattern matching when combined
with a function that (safely) works on lists:
>>>import GHC.Internal.Text.Read ( readMaybe )>>>sum $ maybeToList (readMaybe "3")3>>>sum $ maybeToList (readMaybe "")0
listToMaybe :: [a] -> Maybe a #
The listToMaybe function returns Nothing on an empty list
or where Just aa is the first element of the list.
Examples
Basic usage:
>>>listToMaybe []Nothing
>>>listToMaybe [9]Just 9
>>>listToMaybe [1,2,3]Just 1
Composing maybeToList with listToMaybe should be the identity
on singleton/empty lists:
>>>maybeToList $ listToMaybe [5][5]>>>maybeToList $ listToMaybe [][]
But not on lists with more than one element:
>>>maybeToList $ listToMaybe [1,2,3][1]
catMaybes :: [Maybe a] -> [a] #
The catMaybes function takes a list of Maybes and returns
a list of all the Just values.
Examples
Basic usage:
>>>catMaybes [Just 1, Nothing, Just 3][1,3]
When constructing a list of Maybe values, catMaybes can be used
to return all of the "success" results (if the list is the result
of a map, then mapMaybe would be more appropriate):
>>>import GHC.Internal.Text.Read ( readMaybe )>>>[readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ][Just 1,Nothing,Just 3]>>>catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ][1,3]
mapMaybe :: Filterable f => (a -> Maybe b) -> f a -> f b #
Like mapMaybe.
foldl1' :: HasCallStack => (a -> a -> a) -> [a] -> a #
A strict version of foldl1.
(&) :: a -> (a -> b) -> b infixl 1 #
& is a reverse application operator. This provides notational
convenience. Its precedence is one higher than that of the forward
application operator $, which allows & to be nested in $.
This is a version of , where flip idid is specialized from a -> a to (a -> b) -> (a -> b)
which by the associativity of (->) is (a -> b) -> a -> b.
flipping this yields a -> (a -> b) -> b which is the type signature of &
Examples
>>>5 & (+1) & show"6"
>>>sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)3.1406380562059946
Since: base-4.8.0.0
readMaybe :: Read a => String -> Maybe a #
Parse a string using the Read instance.
Succeeds if there is exactly one valid result.
>>>readMaybe "123" :: Maybe IntJust 123
>>>readMaybe "hello" :: Maybe IntNothing
Since: base-4.6.0.0
class From source target where #
This type class is for converting values from some source type into
some other target type. The constraint means that
you can convert from a value of type From source targetsource into a value of type
target.
This type class is for conversions that always succeed. If your conversion
sometimes fails, consider implementing TryFrom instead.
Minimal complete definition
Nothing
Methods
This method implements the conversion of a value between types. At call
sites you may prefer to use into instead.
-- Avoid this: from (x :: s) -- Prefer this (using [@TypeApplications@](https://downloads.haskell.org/ghc/9.6.1/docs/users_guide/exts/type_applications.html) language extension): from @s x
The default implementation of this method simply calls coerce,
which works for types that have the same runtime representation. This
means that for newtypes you do not need to implement this method at
all. For example:
>>>newtype Name = Name String>>>instance From Name String>>>instance From String Name
Instances
| From Pico DiffTime | Uses |
Defined in Witch.Instances | |
| From Pico NominalDiffTime | Uses |
Defined in Witch.Instances Methods from :: Pico -> NominalDiffTime # | |
| From ByteString ByteString | Uses |
Defined in Witch.Instances Methods from :: ByteString -> ByteString # | |
| From ByteString ShortByteString | Uses |
Defined in Witch.Instances Methods from :: ByteString -> ShortByteString # | |
| From ByteString ByteString | Uses |
Defined in Witch.Instances Methods from :: ByteString -> ByteString # | |
| From ShortByteString ByteString | Uses |
Defined in Witch.Instances Methods from :: ShortByteString -> ByteString # | |
| From Int16 Int32 | Uses |
Defined in Witch.Instances | |
| From Int16 Int64 | Uses |
Defined in Witch.Instances | |
| From Int16 Integer | Uses |
Defined in Witch.Instances | |
| From Int16 Double | Uses |
Defined in Witch.Instances | |
| From Int16 Float | Uses |
Defined in Witch.Instances | |
| From Int16 Int | Uses |
Defined in Witch.Instances | |
| From Int32 Int64 | Uses |
Defined in Witch.Instances | |
| From Int32 Integer | Uses |
Defined in Witch.Instances | |
| From Int32 Double | Uses |
Defined in Witch.Instances | |
| From Int64 Integer | Uses |
Defined in Witch.Instances | |
| From Int8 Int16 | Uses |
Defined in Witch.Instances | |
| From Int8 Int32 | Uses |
Defined in Witch.Instances | |
| From Int8 Int64 | Uses |
Defined in Witch.Instances | |
| From Int8 Integer | Uses |
Defined in Witch.Instances | |
| From Int8 Double | Uses |
Defined in Witch.Instances | |
| From Int8 Float | Uses |
Defined in Witch.Instances | |
| From Int8 Int | Uses |
Defined in Witch.Instances | |
| From Rational UniversalTime | Uses |
Defined in Witch.Instances Methods from :: Rational -> UniversalTime # | |
| From Rational TimeOfDay | Uses |
Defined in Witch.Instances | |
| From Rational Double | Uses |
Defined in Witch.Instances | |
| From Rational Float | Uses |
Defined in Witch.Instances | |
| From Word16 Int32 | Uses |
Defined in Witch.Instances | |
| From Word16 Int64 | Uses |
Defined in Witch.Instances | |
| From Word16 Word32 | Uses |
Defined in Witch.Instances | |
| From Word16 Word64 | Uses |
Defined in Witch.Instances | |
| From Word16 Integer | Uses |
Defined in Witch.Instances | |
| From Word16 Natural | Uses |
Defined in Witch.Instances | |
| From Word16 Double | Uses |
Defined in Witch.Instances | |
| From Word16 Float | Uses |
Defined in Witch.Instances | |
| From Word16 Int | Uses |
Defined in Witch.Instances | |
| From Word16 Word | Uses |
Defined in Witch.Instances | |
| From Word32 Int64 | Uses |
Defined in Witch.Instances | |
| From Word32 Word64 | Uses |
Defined in Witch.Instances | |
| From Word32 Integer | Uses |
Defined in Witch.Instances | |
| From Word32 Natural | Uses |
Defined in Witch.Instances | |
| From Word32 Double | Uses |
Defined in Witch.Instances | |
| From Word64 Integer | Uses |
Defined in Witch.Instances | |
| From Word64 Natural | Uses |
Defined in Witch.Instances | |
| From Word8 Int16 | Uses |
Defined in Witch.Instances | |
| From Word8 Int32 | Uses |
Defined in Witch.Instances | |
| From Word8 Int64 | Uses |
Defined in Witch.Instances | |
| From Word8 Word16 | Uses |
Defined in Witch.Instances | |
| From Word8 Word32 | Uses |
Defined in Witch.Instances | |
| From Word8 Word64 | Uses |
Defined in Witch.Instances | |
| From Word8 Integer | Uses |
Defined in Witch.Instances | |
| From Word8 Natural | Uses |
Defined in Witch.Instances | |
| From Word8 Double | Uses |
Defined in Witch.Instances | |
| From Word8 Float | Uses |
Defined in Witch.Instances | |
| From Word8 Int | Uses |
Defined in Witch.Instances | |
| From Word8 Word | Uses |
Defined in Witch.Instances | |
| From Text Text | Uses |
Defined in Witch.Instances | |
| From Text Utf16BL | Converts via |
Defined in Witch.Instances | |
| From Text Utf16BS | Uses |
Defined in Witch.Instances | |
| From Text Utf16LL | Converts via |
Defined in Witch.Instances | |
| From Text Utf16LS | Uses |
Defined in Witch.Instances | |
| From Text Utf32BL | Converts via |
Defined in Witch.Instances | |
| From Text Utf32BS | Uses |
Defined in Witch.Instances | |
| From Text Utf32LL | Converts via |
Defined in Witch.Instances | |
| From Text Utf32LS | Uses |
Defined in Witch.Instances | |
| From Text Utf8L | Converts via |
Defined in Witch.Instances | |
| From Text Utf8S | Uses |
Defined in Witch.Instances | |
| From Text String | Uses |
Defined in Witch.Instances | |
| From Text Text | Uses |
Defined in Witch.Instances | |
| From Text Utf16BL | Uses |
Defined in Witch.Instances | |
| From Text Utf16BS | Converts via |
Defined in Witch.Instances | |
| From Text Utf16LL | Uses |
Defined in Witch.Instances | |
| From Text Utf16LS | Converts via |
Defined in Witch.Instances | |
| From Text Utf32BL | Uses |
Defined in Witch.Instances | |
| From Text Utf32BS | Converts via |
Defined in Witch.Instances | |
| From Text Utf32LL | Uses |
Defined in Witch.Instances | |
| From Text Utf32LS | Converts via |
Defined in Witch.Instances | |
| From Text Utf8L | Uses |
Defined in Witch.Instances | |
| From Text Utf8S | Converts via |
Defined in Witch.Instances | |
| From Text String | Uses |
Defined in Witch.Instances | |
| From CalendarDiffDays CalendarDiffTime | Uses |
Defined in Witch.Instances Methods | |
| From Day DayOfWeek | Uses |
Defined in Witch.Instances | |
| From Day Integer | Uses |
Defined in Witch.Instances | |
| From DiffTime Pico | Uses |
Defined in Witch.Instances | |
| From DiffTime TimeOfDay | Uses |
Defined in Witch.Instances | |
| From NominalDiffTime Pico | Uses |
Defined in Witch.Instances Methods from :: NominalDiffTime -> Pico # | |
| From NominalDiffTime CalendarDiffTime | Uses |
Defined in Witch.Instances Methods from :: NominalDiffTime -> CalendarDiffTime # | |
| From POSIXTime UTCTime | Uses |
Defined in Witch.Instances | |
| From SystemTime AbsoluteTime | Uses |
Defined in Witch.Instances Methods from :: SystemTime -> AbsoluteTime # | |
| From SystemTime POSIXTime | Uses |
Defined in Witch.Instances Methods from :: SystemTime -> POSIXTime # | |
| From SystemTime UTCTime | Uses |
Defined in Witch.Instances Methods from :: SystemTime -> UTCTime # | |
| From UTCTime POSIXTime | Uses |
Defined in Witch.Instances | |
| From UTCTime SystemTime | Uses |
Defined in Witch.Instances Methods from :: UTCTime -> SystemTime # | |
| From UniversalTime Rational | Uses |
Defined in Witch.Instances Methods from :: UniversalTime -> Rational # | |
| From TimeOfDay Rational | Uses |
Defined in Witch.Instances | |
| From TimeOfDay DiffTime | Uses |
Defined in Witch.Instances | |
| From ZonedTime UTCTime | Uses |
Defined in Witch.Instances | |
| From Latin1L Text | Converts via |
Defined in Witch.Instances | |
| From Latin1L Text | Uses |
Defined in Witch.Instances | |
| From Latin1L String | Converts via |
Defined in Witch.Instances | |
| From Latin1S Text | Uses |
Defined in Witch.Instances | |
| From Latin1S Text | Converts via |
Defined in Witch.Instances | |
| From Latin1S String | Converts via |
Defined in Witch.Instances | |
| From Integer Day | Uses |
Defined in Witch.Instances | |
| From Natural Integer | Uses |
Defined in Witch.Instances | |
| From String Text | Uses |
Defined in Witch.Instances | |
| From String Text | Uses |
Defined in Witch.Instances | |
| From String Utf16BL | Converts via |
Defined in Witch.Instances | |
| From String Utf16BS | Converts via |
Defined in Witch.Instances | |
| From String Utf16LL | Converts via |
Defined in Witch.Instances | |
| From String Utf16LS | Converts via |
Defined in Witch.Instances | |
| From String Utf32BL | Converts via |
Defined in Witch.Instances | |
| From String Utf32BS | Converts via |
Defined in Witch.Instances | |
| From String Utf32LL | Converts via |
Defined in Witch.Instances | |
| From String Utf32LS | Converts via |
Defined in Witch.Instances | |
| From String Utf8L | Converts via |
Defined in Witch.Instances | |
| From String Utf8S | Converts via |
Defined in Witch.Instances | |
| From Double Float | Uses |
Defined in Witch.Instances | |
| From Float Double | Uses |
Defined in Witch.Instances | |
| From Int Int64 | Uses |
Defined in Witch.Instances | |
| From Int Integer | Uses |
Defined in Witch.Instances | |
| From Word Word64 | Uses |
Defined in Witch.Instances | |
| From Word Integer | Uses |
Defined in Witch.Instances | |
| From Word Natural | Uses |
Defined in Witch.Instances | |
| From a a | Uses |
Defined in Witch.Instances | |
| From ByteString [Word8] | Uses |
Defined in Witch.Instances Methods from :: ByteString -> [Word8] # | |
| From ByteString [Word8] | Uses |
Defined in Witch.Instances Methods from :: ByteString -> [Word8] # | |
| From ShortByteString [Word8] | Uses |
Defined in Witch.Instances Methods from :: ShortByteString -> [Word8] # | |
| From IntSet [Int] | Uses |
Defined in Witch.Instances | |
| Num a => From a (Complex a) | Uses |
Defined in Witch.Instances | |
| Integral a => From a (Ratio a) | Uses |
Defined in Witch.Instances | |
| (Generic s, Generic t, GFrom (Rep s) (Rep t)) => From s (Generically t) | See the |
Defined in Witch.Generic Methods from :: s -> Generically t # | |
| HasResolution a => From Integer (Fixed a) | Uses |
Defined in Witch.Instances | |
| From a (Tagged t a) | Uses |
Defined in Witch.Instances | |
| From [Word8] ByteString | Uses |
Defined in Witch.Instances Methods from :: [Word8] -> ByteString # | |
| From [Word8] ByteString | Uses |
Defined in Witch.Instances Methods from :: [Word8] -> ByteString # | |
| From [Word8] ShortByteString | Uses |
Defined in Witch.Instances Methods from :: [Word8] -> ShortByteString # | |
| From [Int] IntSet | Uses |
Defined in Witch.Instances | |
| From (IntMap v) [(Int, v)] | Uses |
Defined in Witch.Instances | |
| From (Seq a) [a] | Uses |
Defined in Witch.Instances | |
| From (Set a) [a] | Uses |
Defined in Witch.Instances | |
| From (NonEmpty a) [a] | Uses |
Defined in Witch.Instances | |
| From [(Int, v)] (IntMap v) | Uses |
Defined in Witch.Instances | |
| From [a] (Seq a) | Uses |
Defined in Witch.Instances | |
| Ord a => From [a] (Set a) | Uses |
Defined in Witch.Instances | |
| Ord k => From [(k, v)] (Map k v) | Uses |
Defined in Witch.Instances | |
| HasResolution a => From (Fixed a) Rational | Uses |
Defined in Witch.Instances | |
| From (Map k v) [(k, v)] | Uses |
Defined in Witch.Instances | |
| From (TryFromException source oldTarget) (TryFromException source newTarget) | Uses |
Defined in Witch.Instances Methods from :: TryFromException source oldTarget -> TryFromException source newTarget # | |
| From (Tagged t a) a | Uses |
Defined in Witch.Instances | |
| From (Tagged t a) (Tagged u a) | Uses |
Defined in Witch.Instances | |
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] print1 2 3 4
class (Typeable e, Show e) => Exception e #
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 MyExceptionThe 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 = frontendExceptionFromExceptionWe 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
Instances
| Exception Timeout | Since: base-4.7.0.0 |
Defined in System.Timeout Methods toException :: Timeout -> SomeException # fromException :: SomeException -> Maybe Timeout # displayException :: Timeout -> String # backtraceDesired :: Timeout -> Bool # | |
| Exception SizeOverflowException | |
Defined in Data.ByteString.Internal.Type | |
| Exception Timeout | |
Defined in System.Time.Extra Methods toException :: Timeout -> SomeException # fromException :: SomeException -> Maybe Timeout # displayException :: Timeout -> String # backtraceDesired :: Timeout -> Bool # | |
| Exception Void | Since: base-4.8.0.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # backtraceDesired :: Void -> Bool # | |
| Exception ArithException | Since: base-4.0.0.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: ArithException -> SomeException # fromException :: SomeException -> Maybe ArithException # displayException :: ArithException -> String # backtraceDesired :: ArithException -> Bool # | |
| Exception SomeException | This drops any attached Since: base-3.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # backtraceDesired :: SomeException -> Bool # | |
| Exception AllocationLimitExceeded | Since: base-4.8.0.0 |
Defined in GHC.Internal.IO.Exception | |
| Exception ArrayException | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: ArrayException -> SomeException # fromException :: SomeException -> Maybe ArrayException # displayException :: ArrayException -> String # backtraceDesired :: ArrayException -> Bool # | |
| Exception AssertionFailed | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: AssertionFailed -> SomeException # fromException :: SomeException -> Maybe AssertionFailed # displayException :: AssertionFailed -> String # backtraceDesired :: AssertionFailed -> Bool # | |
| Exception AsyncException | Since: base-4.7.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: AsyncException -> SomeException # fromException :: SomeException -> Maybe AsyncException # displayException :: AsyncException -> String # backtraceDesired :: AsyncException -> Bool # | |
| Exception BlockedIndefinitelyOnMVar | Since: base-4.1.0.0 |
| Exception BlockedIndefinitelyOnSTM | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception | |
| Exception CompactionFailed | Since: base-4.10.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: CompactionFailed -> SomeException # fromException :: SomeException -> Maybe CompactionFailed # | |
| Exception Deadlock | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: Deadlock -> SomeException # fromException :: SomeException -> Maybe Deadlock # displayException :: Deadlock -> String # backtraceDesired :: Deadlock -> Bool # | |
| Exception ExitCode | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: ExitCode -> SomeException # fromException :: SomeException -> Maybe ExitCode # displayException :: ExitCode -> String # backtraceDesired :: ExitCode -> Bool # | |
| Exception FixIOException | Since: base-4.11.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: FixIOException -> SomeException # fromException :: SomeException -> Maybe FixIOException # displayException :: FixIOException -> String # backtraceDesired :: FixIOException -> Bool # | |
| Exception IOException | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # backtraceDesired :: IOException -> Bool # | |
| Exception SomeAsyncException | Since: base-4.7.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: SomeAsyncException -> SomeException # fromException :: SomeException -> Maybe SomeAsyncException # | |
| Exception HandlingException | |
Defined in Control.Lens.Internal.Exception Methods toException :: HandlingException -> SomeException # fromException :: SomeException -> Maybe HandlingException # | |
| Exception UnicodeException | |
Defined in Data.Text.Encoding.Error Methods toException :: UnicodeException -> SomeException # fromException :: SomeException -> Maybe UnicodeException # | |
| Exception StringException | Since: unliftio-0.1.0.0 |
Defined in UnliftIO.Exception Methods toException :: StringException -> SomeException # fromException :: SomeException -> Maybe StringException # displayException :: StringException -> String # backtraceDesired :: StringException -> Bool # | |
| Exception ConcException | |
Defined in UnliftIO.Internals.Async Methods toException :: ConcException -> SomeException # fromException :: SomeException -> Maybe ConcException # displayException :: ConcException -> String # backtraceDesired :: ConcException -> Bool # | |
| Exception a => Exception (ExceptionWithContext a) | |
Defined in GHC.Internal.Exception.Type Methods toException :: ExceptionWithContext a -> SomeException # fromException :: SomeException -> Maybe (ExceptionWithContext a) # displayException :: ExceptionWithContext a -> String # backtraceDesired :: ExceptionWithContext a -> Bool # | |
| Exception e => Exception (NoBacktrace e) | |
Defined in GHC.Internal.Exception.Type Methods toException :: NoBacktrace e -> SomeException # fromException :: SomeException -> Maybe (NoBacktrace e) # displayException :: NoBacktrace e -> String # backtraceDesired :: NoBacktrace e -> Bool # | |
| Typeable a => Exception (FieldException a) | |
Defined in Data.Data.Lens Methods toException :: FieldException a -> SomeException # fromException :: SomeException -> Maybe (FieldException a) # displayException :: FieldException a -> String # backtraceDesired :: FieldException a -> Bool # | |
| (Show source, Typeable source, Typeable target) => Exception (TryFromException source target) | |
Defined in Witch.TryFromException Methods toException :: TryFromException source target -> SomeException # fromException :: SomeException -> Maybe (TryFromException source target) # displayException :: TryFromException source target -> String # backtraceDesired :: TryFromException source target -> Bool # | |
| (Reifies s (SomeException -> Maybe a), Typeable a, Typeable s, Typeable m) => Exception (Handling a s m) | |
Defined in Control.Lens.Internal.Exception Methods toException :: Handling a s m -> SomeException # fromException :: SomeException -> Maybe (Handling a s m) # displayException :: Handling a s m -> String # backtraceDesired :: Handling a s m -> Bool # | |
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.Internal.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # backtraceDesired :: IOException -> Bool # | |
| Show IOException | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods showsPrec :: Int -> IOException -> ShowS # show :: IOException -> String # showList :: [IOException] -> ShowS # | |
| Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception | |
| AsIOException IOException | |
Defined in Control.Exception.Lens Methods | |
| MonadError IOException IO | |
Defined in Control.Monad.Error.Class | |
try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a) #
for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) #
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
| NFData ByteString | |||||
Defined in Data.ByteString.Internal.Type Methods rnf :: ByteString -> () # | |||||
| Monoid ByteString | |||||
Defined in Data.ByteString.Internal.Type Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |||||
| Semigroup ByteString | |||||
Defined in Data.ByteString.Internal.Type Methods (<>) :: ByteString -> ByteString -> ByteString # sconcat :: NonEmpty ByteString -> ByteString # stimes :: Integral b => b -> ByteString -> ByteString # | |||||
| Data ByteString | |||||
Defined in Data.ByteString.Internal.Type Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString -> c ByteString # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString # toConstr :: ByteString -> Constr # dataTypeOf :: ByteString -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteString) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString) # gmapT :: (forall b. Data b => b -> b) -> ByteString -> ByteString # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r # gmapQ :: (forall d. Data d => d -> u) -> ByteString -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString # | |||||
| IsString ByteString | Beware: | ||||
Defined in Data.ByteString.Internal.Type Methods fromString :: String -> ByteString # | |||||
| IsList ByteString | Since: bytestring-0.10.12.0 | ||||
Defined in Data.ByteString.Internal.Type Associated Types
Methods fromList :: [Item ByteString] -> ByteString # fromListN :: Int -> [Item ByteString] -> ByteString # toList :: ByteString -> [Item ByteString] # | |||||
| Read ByteString | |||||
Defined in Data.ByteString.Internal.Type Methods readsPrec :: Int -> ReadS ByteString # readList :: ReadS [ByteString] # readPrec :: ReadPrec ByteString # readListPrec :: ReadPrec [ByteString] # | |||||
| Show ByteString | |||||
Defined in Data.ByteString.Internal.Type Methods showsPrec :: Int -> ByteString -> ShowS # show :: ByteString -> String # showList :: [ByteString] -> ShowS # | |||||
| Eq ByteString | |||||
Defined in Data.ByteString.Internal.Type | |||||
| Ord ByteString | |||||
Defined in Data.ByteString.Internal.Type Methods compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString # | |||||
| Hashable ByteString | |||||
Defined in Data.Hashable.Class | |||||
| Ixed ByteString | |||||
Defined in Control.Lens.At Methods ix :: Index ByteString -> Traversal' ByteString (IxValue ByteString) # | |||||
| AsEmpty ByteString | |||||
Defined in Control.Lens.Empty Methods _Empty :: Prism' ByteString () # | |||||
| Reversing ByteString | |||||
Defined in Control.Lens.Internal.Iso Methods reversing :: ByteString -> ByteString # | |||||
| Prefixed ByteString | |||||
Defined in Control.Lens.Prism Methods | |||||
| Suffixed ByteString | |||||
Defined in Control.Lens.Prism Methods | |||||
| IsByteString ByteString | |||||
Defined in Data.ByteString.Lens Methods packedBytes :: Iso' [Word8] ByteString # packedChars :: Iso' String ByteString # | |||||
| Lift ByteString | Since: bytestring-0.11.2.0 | ||||
Defined in Data.ByteString.Internal.Type Methods lift :: Quote m => ByteString -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ByteString -> Code m ByteString # | |||||
| From ByteString ByteString | Uses | ||||
Defined in Witch.Instances Methods from :: ByteString -> ByteString # | |||||
| From ByteString ShortByteString | Uses | ||||
Defined in Witch.Instances Methods from :: ByteString -> ShortByteString # | |||||
| From ByteString ByteString | Uses | ||||
Defined in Witch.Instances Methods from :: ByteString -> ByteString # | |||||
| From ShortByteString ByteString | Uses | ||||
Defined in Witch.Instances Methods from :: ShortByteString -> ByteString # | |||||
| From Text Utf16BS | Uses | ||||
Defined in Witch.Instances | |||||
| From Text Utf16LS | Uses | ||||
Defined in Witch.Instances | |||||
| From Text Utf32BS | Uses | ||||
Defined in Witch.Instances | |||||
| From Text Utf32LS | Uses | ||||
Defined in Witch.Instances | |||||
| From Text Utf8S | Uses | ||||
Defined in Witch.Instances | |||||
| From Text Utf16BS | Converts via | ||||
Defined in Witch.Instances | |||||
| From Text Utf16LS | Converts via | ||||
Defined in Witch.Instances | |||||
| From Text Utf32BS | Converts via | ||||
Defined in Witch.Instances | |||||
| From Text Utf32LS | Converts via | ||||
Defined in Witch.Instances | |||||
| From Text Utf8S | Converts via | ||||
Defined in Witch.Instances | |||||
| From Latin1S Text | Uses | ||||
Defined in Witch.Instances | |||||
| From Latin1S Text | Converts via | ||||
Defined in Witch.Instances | |||||
| From Latin1S String | Converts via | ||||
Defined in Witch.Instances | |||||
| From String Utf16BS | Converts via | ||||
Defined in Witch.Instances | |||||
| From String Utf16LS | Converts via | ||||
Defined in Witch.Instances | |||||
| From String Utf32BS | Converts via | ||||
Defined in Witch.Instances | |||||
| From String Utf32LS | Converts via | ||||
Defined in Witch.Instances | |||||
| From String Utf8S | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Text Latin1S | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Text Latin1S | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf16BS Text | Uses | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf16BS Text | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf16BS String | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf16LS Text | Uses | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf16LS Text | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf16LS String | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf32BS Text | Uses | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf32BS Text | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf32BS String | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf32LS Text | Uses | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf32LS Text | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf32LS String | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf8S Text | Uses | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf8S Text | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom Utf8S String | Converts via | ||||
Defined in Witch.Instances | |||||
| TryFrom String Latin1S | |||||
Defined in Witch.Instances | |||||
| Cons ByteString ByteString Word8 Word8 | |||||
Defined in Control.Lens.Cons Methods _Cons :: Prism ByteString ByteString (Word8, ByteString) (Word8, ByteString) # | |||||
| Snoc ByteString ByteString Word8 Word8 | |||||
Defined in Control.Lens.Cons Methods _Snoc :: Prism ByteString ByteString (ByteString, Word8) (ByteString, Word8) # | |||||
| (a ~ Word8, b ~ Word8) => Each ByteString ByteString a b |
| ||||
Defined in Control.Lens.Each Methods each :: Traversal ByteString ByteString a b # | |||||
| From ByteString [Word8] | Uses | ||||
Defined in Witch.Instances Methods from :: ByteString -> [Word8] # | |||||
| From [Word8] ByteString | Uses | ||||
Defined in Witch.Instances Methods from :: [Word8] -> ByteString # | |||||
| type Item ByteString | |||||
Defined in Data.ByteString.Internal.Type | |||||
| type Index ByteString | |||||
Defined in Control.Lens.At | |||||
| type IxValue ByteString | |||||
Defined in Control.Lens.At | |||||
A Map from keys k to values a.
The Semigroup operation for Map is union, which prefers
values from the left operand. If m1 maps a key k to a value
a1, and m2 maps the same key to a different value a2, then
their union m1 <> m2 maps k to a1.
Instances
| Bifoldable Map | Since: containers-0.6.3.1 |
| Eq2 Map | Since: containers-0.5.9 |
| Ord2 Map | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
| Show2 Map | Since: containers-0.5.9 |
| Hashable2 Map | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| FoldableWithIndex k (Map k) | |
| FunctorWithIndex k (Map k) | |
| TraversableWithIndex k (Map k) | |
| Ord k => TraverseMax k (Map k) | |
Defined in Control.Lens.Traversal Methods traverseMax :: IndexedTraversal' k (Map k v) v # | |
| Ord k => TraverseMin k (Map k) | |
Defined in Control.Lens.Traversal Methods traverseMin :: IndexedTraversal' k (Map k v) v # | |
| FilterableWithIndex k (Map k) | |
| WitherableWithIndex k (Map k) | |
| (Lift k, Lift a) => Lift (Map k a :: Type) | Since: containers-0.6.6 |
| Eq k => Eq1 (Map k) | Since: containers-0.5.9 |
| Ord k => Ord1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
| (Ord k, Read k) => Read1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
| Show k => Show1 (Map k) | Since: containers-0.5.9 |
| Functor (Map k) | |
| 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 # | |
| Traversable (Map k) | Traverses in order of increasing key. |
| Hashable k => Hashable1 (Map k) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Filterable (Map k) | |
| Witherable (Map k) | |
Defined in Witherable Methods wither :: Applicative f => (a -> f (Maybe b)) -> Map k a -> f (Map k b) # witherM :: Monad m => (a -> m (Maybe b)) -> Map k a -> m (Map k b) # filterA :: Applicative f => (a -> f Bool) -> Map k a -> f (Map k a) # witherMap :: Applicative m => (Map k b -> r) -> (a -> m (Maybe b)) -> Map k a -> m r # | |
| Ord k => From [(k, v)] (Map k v) | Uses |
Defined in Witch.Instances | |
| (NFData k, NFData a) => NFData (Map k a) | |
Defined in Data.Map.Internal | |
| Ord k => Monoid (Map k v) | |
| Ord k => Semigroup (Map k v) | |
| (Data k, Data a, Ord k) => Data (Map k a) | |
Defined in Data.Map.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Map k a -> c (Map k a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Map k a) # toConstr :: Map k a -> Constr # dataTypeOf :: Map k a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Map k a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k a)) # gmapT :: (forall b. Data b => b -> b) -> Map k a -> Map k a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQ :: (forall d. Data d => d -> u) -> Map k a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Map k a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # | |
| Ord k => IsList (Map k v) | Since: containers-0.5.6.2 |
| (Ord k, Read k, Read e) => Read (Map k e) | |
| (Show k, Show a) => Show (Map k a) | |
| (Eq k, Eq a) => Eq (Map k a) | |
| (Ord k, Ord v) => Ord (Map k v) | |
| (Hashable k, Hashable v) => Hashable (Map k v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Ord k => At (Map k a) | |
| Ord k => Ixed (Map k a) | |
Defined in Control.Lens.At | |
| AsEmpty (Map k a) | |
Defined in Control.Lens.Empty | |
| Ord k => Wrapped (Map k a) | |
| (t ~ Map k' a', Ord k) => Rewrapped (Map k a) t | |
Defined in Control.Lens.Wrapped | |
| From (Map k v) [(k, v)] | Uses |
Defined in Witch.Instances | |
| c ~ d => Each (Map c a) (Map d b) a b |
|
| type Item (Map k v) | |
Defined in Data.Map.Internal | |
| type Index (Map k a) | |
Defined in Control.Lens.At | |
| type IxValue (Map k a) | |
Defined in Control.Lens.At | |
| type Unwrapped (Map k a) | |
Defined in Control.Lens.Wrapped | |
A set of values a.
Instances
| Eq1 Set | Since: containers-0.5.9 |
| Ord1 Set | Since: containers-0.5.9 |
Defined in Data.Set.Internal | |
| Show1 Set | Since: containers-0.5.9 |
| 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 # | |
| Hashable1 Set | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Lift a => Lift (Set a :: Type) | Since: containers-0.6.6 |
| NFData a => NFData (Set a) | |
Defined in Data.Set.Internal | |
| Ord a => Monoid (Set a) | |
| Ord a => Semigroup (Set a) | Since: containers-0.5.7 |
| (Data a, Ord a) => Data (Set a) | |
Defined in Data.Set.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Set a -> c (Set a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Set a) # dataTypeOf :: Set a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Set a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set a)) # gmapT :: (forall b. Data b => b -> b) -> Set a -> Set a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQ :: (forall d. Data d => d -> u) -> Set a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Set a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # | |
| Ord a => IsList (Set a) | Since: containers-0.5.6.2 |
| (Read a, Ord a) => Read (Set a) | |
| Show a => Show (Set a) | |
| Eq a => Eq (Set a) | |
| Ord a => Ord (Set a) | |
| Hashable v => Hashable (Set v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Ord k => At (Set k) | |
| Ord a => Contains (Set a) | |
| Ord k => Ixed (Set k) | |
Defined in Control.Lens.At | |
| AsEmpty (Set a) | |
Defined in Control.Lens.Empty | |
| Ord a => Wrapped (Set a) | |
| (t ~ Set a', Ord a) => Rewrapped (Set a) t | |
Defined in Control.Lens.Wrapped | |
| From (Set a) [a] | Uses |
Defined in Witch.Instances | |
| Ord a => From [a] (Set a) | Uses |
Defined in Witch.Instances | |
| type Item (Set a) | |
Defined in Data.Set.Internal | |
| type Index (Set a) | |
Defined in Control.Lens.At | |
| type IxValue (Set k) | |
Defined in Control.Lens.At | |
| type Unwrapped (Set a) | |
Defined in Control.Lens.Wrapped | |
General-purpose finite sequences.
Instances
| MonadZip Seq |
Since: containers-0.5.10.1 |
| 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 |
| UnzipWith Seq | |
Defined in Data.Sequence.Internal Methods unzipWith' :: (x -> (a, b)) -> Seq x -> (Seq a, Seq b) | |
| Alternative Seq | Since: containers-0.5.4 |
| Applicative Seq | Since: containers-0.5.4 |
| Functor Seq | |
| Monad Seq | |
| MonadPlus Seq | |
| MonadFix Seq | Since: containers-0.5.11 |
Defined in Data.Sequence.Internal | |
| 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 # | |
| Traversable Seq | |
| Hashable1 Seq | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Filterable Seq | |
| Witherable Seq | |
Defined in Witherable | |
| FoldableWithIndex Int Seq | |
| FunctorWithIndex Int Seq | The position in the |
| TraversableWithIndex Int Seq | |
| FilterableWithIndex Int Seq | |
| WitherableWithIndex Int Seq | |
| Lift a => Lift (Seq a :: Type) | Since: containers-0.6.6 |
| NFData a => NFData (Seq a) | |
Defined in Data.Sequence.Internal | |
| Monoid (Seq a) | |
| Semigroup (Seq a) | Since: containers-0.5.7 |
| 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 # | |
| IsList (Seq a) | |
| Read a => Read (Seq a) | |
| Show a => Show (Seq a) | |
| Eq a => Eq (Seq a) | |
| Ord a => Ord (Seq a) | |
| Hashable v => Hashable (Seq v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Ixed (Seq a) | |
Defined in Control.Lens.At | |
| AsEmpty (Seq a) | |
Defined in Control.Lens.Empty | |
| Reversing (Seq a) | |
Defined in Control.Lens.Internal.Iso | |
| Wrapped (Seq a) | |
| t ~ Seq a' => Rewrapped (Seq a) t | |
Defined in Control.Lens.Wrapped | |
| From (Seq a) [a] | Uses |
Defined in Witch.Instances | |
| From [a] (Seq a) | Uses |
Defined in Witch.Instances | |
| Cons (Seq a) (Seq b) a b | |
| Snoc (Seq a) (Seq b) a b | |
| Each (Seq a) (Seq b) a b |
|
| type Item (Seq a) | |
Defined in Data.Sequence.Internal | |
| type Index (Seq a) | |
Defined in Control.Lens.At | |
| type IxValue (Seq a) | |
Defined in Control.Lens.At | |
| type Unwrapped (Seq a) | |
Defined in Control.Lens.Wrapped | |
mapLeft :: (a -> c) -> Either a b -> Either c b #
The mapLeft function takes a function and applies it to an Either value
iff the value takes the form .Left _
Using Data.Bifunctor:
mapLeft = first
Using Control.Arrow:
mapLeft= (left)
Using Control.Lens:
mapLeft = over _Left
>>>mapLeft (*2) (Left 4)Left 8
>>>mapLeft (*2) (Right "hello")Right "hello"
maybeToRight :: b -> Maybe a -> Either b a #
newtype MaybeT (m :: Type -> Type) a #
The parameterizable maybe monad, obtained by composing an arbitrary
monad with the Maybe monad.
Computations are actions that may produce a value or exit.
The return function yields a computation that produces that
value, while >>= sequences two subcomputations, exiting if either
computation does.
Instances
| MonadTrans MaybeT | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| MonadRWS r w s m => MonadRWS r w s (MaybeT m) | |||||
Defined in Control.Monad.RWS.Class | |||||
| Functor m => Generic1 (MaybeT m :: Type -> Type) | |||||
Defined in Control.Monad.Trans.Maybe Associated Types
| |||||
| MonadAccum w m => MonadAccum w (MaybeT m) | The accumulated value 'survives' an error: even if the computation fails to deliver a result, we still have an accumulated value. Since: mtl-2.3 | ||||
| MonadError e m => MonadError e (MaybeT m) | |||||
Defined in Control.Monad.Error.Class | |||||
| MonadReader r m => MonadReader r (MaybeT m) | |||||
| MonadSelect r m => MonadSelect r (MaybeT m) | 'Extends' the possibilities considered by Since: mtl-2.3 | ||||
Defined in Control.Monad.Select | |||||
| MonadState s m => MonadState s (MaybeT m) | |||||
| MonadWriter w m => MonadWriter w (MaybeT m) | |||||
| MonadIO m => MonadIO (MaybeT m) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| MonadZip m => MonadZip (MaybeT m) | |||||
| Eq1 m => Eq1 (MaybeT m) | |||||
| Ord1 m => Ord1 (MaybeT m) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| Read1 m => Read1 (MaybeT m) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| Show1 m => Show1 (MaybeT m) | |||||
| Contravariant m => Contravariant (MaybeT m) | |||||
| (Functor m, Monad m) => Alternative (MaybeT m) | |||||
| (Functor m, Monad m) => Applicative (MaybeT m) | |||||
| Functor m => Functor (MaybeT m) | |||||
| Monad m => Monad (MaybeT m) | |||||
| Monad m => MonadPlus (MaybeT m) | |||||
| Monad m => MonadFail (MaybeT m) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| MonadFix m => MonadFix (MaybeT m) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| 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 # | |||||
| Traversable f => Traversable (MaybeT f) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| MonadCont m => MonadCont (MaybeT m) | |||||
| PrimMonad m => PrimMonad (MaybeT m) | |||||
| Functor f => Filterable (MaybeT f) | |||||
| Traversable t => Witherable (MaybeT t) | |||||
Defined in Witherable Methods wither :: Applicative f => (a -> f (Maybe b)) -> MaybeT t a -> f (MaybeT t b) # witherM :: Monad m => (a -> m (Maybe b)) -> MaybeT t a -> m (MaybeT t b) # filterA :: Applicative f => (a -> f Bool) -> MaybeT t a -> f (MaybeT t a) # witherMap :: Applicative m => (MaybeT t b -> r) -> (a -> m (Maybe b)) -> MaybeT t a -> m r # | |||||
| Zoom m n s t => Zoom (MaybeT m) (MaybeT n) s t | |||||
| Generic (MaybeT m a) | |||||
Defined in Control.Monad.Trans.Maybe Associated Types
| |||||
| (Read1 m, Read a) => Read (MaybeT m a) | |||||
| (Show1 m, Show a) => Show (MaybeT m a) | |||||
| (Eq1 m, Eq a) => Eq (MaybeT m a) | |||||
| (Ord1 m, Ord a) => Ord (MaybeT m a) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| Wrapped (MaybeT m a) | |||||
| t ~ MaybeT n b => Rewrapped (MaybeT m a) t | |||||
Defined in Control.Lens.Wrapped | |||||
| type Rep1 (MaybeT m :: Type -> Type) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| type Zoomed (MaybeT m) | |||||
Defined in Control.Lens.Zoom | |||||
| type PrimState (MaybeT m) | |||||
Defined in Control.Monad.Primitive | |||||
| type Rep (MaybeT m a) | |||||
Defined in Control.Monad.Trans.Maybe | |||||
| type Unwrapped (MaybeT m a) | |||||
Defined in Control.Lens.Wrapped | |||||
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] #
A version of mapMaybe that works with a monadic predicate.
encodeUtf8 :: Text -> ByteString #
Encode text using UTF-8 encoding.
decodeUtf8 :: ByteString -> Text #
Decode a ByteString containing UTF-8 encoded text that is known
to be valid.
If the input contains any invalid UTF-8 data, an exception will be
thrown that cannot be caught in pure code. For more control over
the handling of invalid data, use decodeUtf8' or
decodeUtf8With.
This is a partial function: it checks that input is a well-formed UTF-8 sequence and copies buffer or throws an error otherwise.
class MonadIO m => MonadUnliftIO (m :: Type -> Type) where #
Monads which allow their actions to be run in IO.
While MonadIO allows an IO action to be lifted into another
monad, this class captures the opposite concept: allowing you to
capture the monadic context. Note that, in order to meet the laws
given below, the intuition is that a monad must have no monadic
state, but may have monadic context. This essentially limits
MonadUnliftIO to ReaderT and IdentityT transformers on top of
IO.
Laws. For any function run provided by withRunInIO, it must meet the
monad transformer laws as reformulated for MonadUnliftIO:
run . return = return
run (m >>= f) = run m >>= run . f
Instances of MonadUnliftIO must also satisfy the following laws:
- Identity law
withRunInIO (\run -> run m) = m- Inverse law
withRunInIO (\_ -> m) = liftIO m
As an example of an invalid instance, a naive implementation of
MonadUnliftIO (StateT s m) might be
withRunInIO inner =
StateT $ \s ->
withRunInIO $ \run ->
inner (run . flip evalStateT s)
This breaks the identity law because the inner run m would throw away
any state changes in m.
Since: unliftio-core-0.1.0.0
Methods
withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b #
Convenience function for capturing the monadic context and running an IO
action with a runner function. The runner function is used to run a monadic
action m in IO.
Since: unliftio-core-0.1.0.0
Instances
| MonadUnliftIO IO | |
Defined in Control.Monad.IO.Unlift | |
| MonadUnliftIO m => MonadUnliftIO (IdentityT m) | |
Defined in Control.Monad.IO.Unlift | |
| MonadUnliftIO m => MonadUnliftIO (ReaderT r m) | |
Defined in Control.Monad.IO.Unlift | |
askRunInIO :: MonadUnliftIO m => m (m a -> IO a) #
Same as askUnliftIO, but returns a monomorphic function
instead of a polymorphic newtype wrapper. If you only need to apply
the transformation on one concrete type, this function can be more
convenient.
Since: unliftio-core-0.1.0.0
askUnliftIO :: MonadUnliftIO m => m (UnliftIO m) #
Capture the current monadic context, providing the ability to
run monadic actions in IO.
See UnliftIO for an explanation of why we need a helper
datatype here.
Prior to version 0.2.0.0 of this library, this was a method in the
MonadUnliftIO type class. It was moved out due to
https://github.com/fpco/unliftio/issues/55.
Since: unliftio-core-0.1.0.0
withUnliftIO :: MonadUnliftIO m => (UnliftIO m -> IO a) -> m a #
Convenience function for capturing the monadic context and running
an IO action. The UnliftIO newtype wrapper is rarely needed, so
prefer withRunInIO to this function.
Since: unliftio-core-0.1.0.0
class TryFrom source target where #
This type class is for converting values from some source type into
some other target type. The constraint means
that you may be able to convert from a value of type TryFrom source targetsource into a value
of type target, but that conversion may fail at runtime.
This type class is for conversions that can sometimes fail. If your
conversion always succeeds, consider implementing From instead.
Methods
tryFrom :: source -> Either (TryFromException source target) target #
This method implements the conversion of a value between types. At call
sites you may want to use tryInto instead.
-- Avoid this: tryFrom (x :: s) -- Prefer this: tryFrom @s
Consider using maybeTryFrom or eitherTryFrom to implement this
method.
Instances
| TryFrom Int16 Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int16 Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int16 Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Int16 Word64 | Uses |
Defined in Witch.Instances | |
| TryFrom Int16 Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int16 Natural | Uses |
Defined in Witch.Instances | |
| TryFrom Int16 Word | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Word64 | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Natural | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Float | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Int | Uses |
Defined in Witch.Instances | |
| TryFrom Int32 Word | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Int32 | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Word64 | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Natural | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Double | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Float | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Int | Uses |
Defined in Witch.Instances | |
| TryFrom Int64 Word | Uses |
Defined in Witch.Instances | |
| TryFrom Int8 Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int8 Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Int8 Word64 | Uses |
Defined in Witch.Instances | |
| TryFrom Int8 Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int8 Natural | Uses |
Defined in Witch.Instances | |
| TryFrom Int8 Word | Uses |
Defined in Witch.Instances | |
| TryFrom Word16 Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Word16 Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word16 Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Int32 | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Float | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Int | Uses |
Defined in Witch.Instances | |
| TryFrom Word32 Word | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Int32 | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Int64 | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Double | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Float | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Int | Uses |
Defined in Witch.Instances | |
| TryFrom Word64 Word | Uses |
Defined in Witch.Instances | |
| TryFrom Word8 Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Text Latin1L | Converts via |
Defined in Witch.Instances | |
| TryFrom Text Latin1S | Converts via |
Defined in Witch.Instances | |
| TryFrom Text Latin1L | Converts via |
Defined in Witch.Instances | |
| TryFrom Text Latin1S | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16BL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16BL Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf16BL String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16BS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf16BS Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16BS String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16LL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16LL Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf16LL String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16LS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf16LS Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf16LS String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32BL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32BL Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf32BL String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32BS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf32BS Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32BS String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32LL Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32LL Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf32LL String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32LS Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf32LS Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf32LS String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf8L Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf8L Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf8L String | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf8S Text | Uses |
Defined in Witch.Instances | |
| TryFrom Utf8S Text | Converts via |
Defined in Witch.Instances | |
| TryFrom Utf8S String | Converts via |
Defined in Witch.Instances | |
| TryFrom Integer Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Int32 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Int64 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Word64 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Natural | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Double | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Float | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Int | Uses |
Defined in Witch.Instances | |
| TryFrom Integer Word | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Int32 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Int64 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Word64 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Double | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Float | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Int | Uses |
Defined in Witch.Instances | |
| TryFrom Natural Word | Uses |
Defined in Witch.Instances | |
| TryFrom String Latin1L | |
Defined in Witch.Instances | |
| TryFrom String Latin1S | |
Defined in Witch.Instances | |
| TryFrom Double Int16 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Int32 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Int64 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Int8 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Rational | Uses |
Defined in Witch.Instances | |
| TryFrom Double Word16 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Word32 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Word64 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Word8 | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Integer | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Natural | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Int | Converts via |
Defined in Witch.Instances | |
| TryFrom Double Word | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Int16 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Int32 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Int64 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Int8 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Rational | Uses |
Defined in Witch.Instances | |
| TryFrom Float Word16 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Word32 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Word64 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Word8 | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Integer | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Natural | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Int | Converts via |
Defined in Witch.Instances | |
| TryFrom Float Word | Converts via |
Defined in Witch.Instances | |
| TryFrom Int Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int Int32 | Uses |
Defined in Witch.Instances | |
| TryFrom Int Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Int Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Int Word64 | Uses |
Defined in Witch.Instances | |
| TryFrom Int Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Int Natural | Uses |
Defined in Witch.Instances | |
| TryFrom Int Double | Uses |
Defined in Witch.Instances | |
| TryFrom Int Float | Uses |
Defined in Witch.Instances | |
| TryFrom Int Word | Uses |
Defined in Witch.Instances | |
| TryFrom Word Int16 | Uses |
Defined in Witch.Instances | |
| TryFrom Word Int32 | Uses |
Defined in Witch.Instances | |
| TryFrom Word Int64 | Uses |
Defined in Witch.Instances | |
| TryFrom Word Int8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word Word16 | Uses |
Defined in Witch.Instances | |
| TryFrom Word Word32 | Uses |
Defined in Witch.Instances | |
| TryFrom Word Word8 | Uses |
Defined in Witch.Instances | |
| TryFrom Word Double | Uses |
Defined in Witch.Instances | |
| TryFrom Word Float | Uses |
Defined in Witch.Instances | |
| TryFrom Word Int | Uses |
Defined in Witch.Instances | |
| HasResolution a => TryFrom Rational (Fixed a) | Uses |
Defined in Witch.Instances | |
| (Eq a, Num a) => TryFrom (Complex a) a | Uses |
Defined in Witch.Instances | |
| (Eq a, Num a) => TryFrom (Ratio a) a | Uses |
Defined in Witch.Instances | |
| TryFrom [a] (NonEmpty a) | Uses |
Defined in Witch.Instances | |
| HasResolution a => TryFrom (Fixed a) Integer | Converts via |
Defined in Witch.Instances | |
| (HasResolution s, HasResolution t) => TryFrom (Fixed s) (Fixed t) | Converts via |
Defined in Witch.Instances | |
data TryFromException source target #
This exception is thrown when a TryFrom conversion fails. It has the
original source value that caused the failure and it knows the target
type it was trying to convert into. It also has an optional
SomeException for communicating what went wrong while
converting.
Constructors
| TryFromException source (Maybe SomeException) |
Instances
| (Show source, Typeable source, Typeable target) => Exception (TryFromException source target) | |
Defined in Witch.TryFromException Methods toException :: TryFromException source target -> SomeException # fromException :: SomeException -> Maybe (TryFromException source target) # displayException :: TryFromException source target -> String # backtraceDesired :: TryFromException source target -> Bool # | |
| (Show source, Typeable source, Typeable target) => Show (TryFromException source target) | |
Defined in Witch.TryFromException Methods showsPrec :: Int -> TryFromException source target -> ShowS # show :: TryFromException source target -> String # showList :: [TryFromException source target] -> ShowS # | |
| From (TryFromException source oldTarget) (TryFromException source newTarget) | Uses |
Defined in Witch.Instances Methods from :: TryFromException source oldTarget -> TryFromException source newTarget # | |
into :: forall target source. From source target => source -> target #
This is the same as from except that the type variables are in the
opposite order.
-- Avoid this: from x :: t -- Prefer this: into @t x
tryInto :: forall target source. TryFrom source target => source -> Either (TryFromException source target) target #
This is the same as tryFrom except that the type variables are
in the opposite order.
-- Avoid this: tryFrom x :: Either (TryFromException s t) t -- Prefer this: tryInto @t x
wither :: (Witherable t, Applicative f) => (a -> f (Maybe b)) -> t a -> f (t b) #
filterA :: (Witherable t, Applicative f) => (a -> f Bool) -> t a -> f (t a) #
witherMap :: (Witherable t, Applicative m) => (t b -> r) -> (a -> m (Maybe b)) -> t a -> m r #
forMaybe :: (Witherable t, Applicative f) => t a -> (a -> f (Maybe b)) -> f (t b) #
readUtf8 :: FilePath -> IO Text Source #
Strictly read an entire file decoding UTF8. Converts rn -> n on windows.
safeReadUtf8 :: FilePath -> IO (Either IOException Text) Source #
Strictly read from a handle, decoding UTF8, or failing if not valid UTF8 Converts rn -> n on windows.
safeReadUtf8StdIn :: IO (Either IOException Text) Source #
Strictly read from stdin, decoding UTF8. Converts rn -> n on windows.
writeUtf8 :: FilePath -> Text -> IO () Source #
Write a file strictly assuming UTF8 Converts n -> rn on windows.
prependUtf8 :: FilePath -> Text -> IO () Source #
Atomically prepend some text to a file, creating the file if it doesn't already exist
wundefined :: HasCallStack => a Source #
Warning: You left this wundefined.
Bool control flow
onFalse :: Applicative m => m () -> Bool -> m () Source #
condition & onFalse do shortCircuit
onTrue :: Applicative m => m () -> Bool -> m () Source #
condition & onTrue do shortCircuit
Maybe control flow
onNothing :: Applicative m => m a -> Maybe a -> m a Source #
E.g.
@
onNothing (throwIO MissingPerson) $ mayThing
@
onNothingM :: Monad m => m a -> m (Maybe a) -> m a Source #
whenNothing :: Applicative m => Maybe a -> m a -> m a Source #
E.g. maybePerson whenNothing throwIO MissingPerson
whenNothingM :: Monad m => m (Maybe a) -> m a -> m a Source #
whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m () Source #
eitherToMaybe :: Either a b -> Maybe b #
maybeToEither :: a -> Maybe b -> Either a b #
eitherToThese :: Either a b -> These a b Source #
altMap :: (Alternative f, Foldable t) => (a -> f b) -> t a -> f b Source #
Like foldMap but for Alternative.
hoistMaybe :: forall (m :: Type -> Type) a. Applicative m => Maybe a -> MaybeT m a Source #
Can be removed when we upgrade transformers to a more recent version.
Either control flow
onLeft :: Applicative m => (a -> m b) -> Either a b -> m b Source #
whenLeft :: Applicative m => Either a b -> (a -> m b) -> m b Source #
throwEitherMWith :: forall e e' m a. (MonadIO m, Exception e') => (e -> e') -> m (Either e a) -> m a Source #
Basic lensy stuff we use all over
(^.) :: s -> Getting a s a -> a infixl 8 #
View the value pointed to by a Getter or Lens or the
result of folding over all the results of a Fold or
Traversal that points at a monoidal values.
This is the same operation as view with the arguments flipped.
The fixity and semantics are such that subsequent field accesses can be
performed with (.).
>>>(a,b)^._2b
>>>("hello","world")^._2"world"
>>>import Data.Complex>>>((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979
(^.) :: s ->Getters a -> a (^.) ::Monoidm => s ->Folds m -> m (^.) :: s ->Iso's a -> a (^.) :: s ->Lens's a -> a (^.) ::Monoidm => s ->Traversal's m -> m
(.~) :: ASetter s t a b -> b -> s -> t infixr 4 #
Replace the target of a Lens or all of the targets of a Setter
or Traversal with a constant value.
This is an infix version of set, provided for consistency with (.=).
f<$a ≡mapped.~f$a
>>>(a,b,c,d) & _4 .~ e(a,b,c,e)
>>>(42,"world") & _1 .~ "hello"("hello","world")
>>>(a,b) & both .~ c(c,c)
(.~) ::Setters t a b -> b -> s -> t (.~) ::Isos t a b -> b -> s -> t (.~) ::Lenss t a b -> b -> s -> t (.~) ::Traversals t a b -> b -> s -> t
(%~) :: ASetter s t a b -> (a -> b) -> s -> t infixr 4 #
Modifies the target of a Lens or all of the targets of a Setter or
Traversal with a user supplied function.
This is an infix version of over.
fmapf ≡mapped%~ffmapDefaultf ≡traverse%~f
>>>(a,b,c) & _3 %~ f(a,b,f c)
>>>(a,b) & both %~ f(f a,f b)
>>>_2 %~ length $ (1,"hello")(1,5)
>>>traverse %~ f $ [a,b,c][f a,f b,f c]
>>>traverse %~ even $ [1,2,3][False,True,False]
>>>traverse.traverse %~ length $ [["hello","world"],["!!!"]][[5,5],[3]]
(%~) ::Setters t a b -> (a -> b) -> s -> t (%~) ::Isos t a b -> (a -> b) -> s -> t (%~) ::Lenss t a b -> (a -> b) -> s -> t (%~) ::Traversals t a b -> (a -> b) -> s -> t
view :: MonadReader s m => Getting a s a -> m a #
View the value pointed to by a Getter, Iso or
Lens or the result of folding over all the results of a
Fold or Traversal that points
at a monoidal value.
view.to≡id
>>>view (to f) af a
>>>view _2 (1,"hello")"hello"
>>>view (to succ) 56
>>>view (_2._1) ("hello",("world","!!!"))"world"
As view is commonly used to access the target of a Getter or obtain a monoidal summary of the targets of a Fold,
It may be useful to think of it as having one of these more restricted signatures:
view::Getters a -> s -> aview::Monoidm =>Folds m -> s -> mview::Iso's a -> s -> aview::Lens's a -> s -> aview::Monoidm =>Traversal's m -> s -> m
In a more general setting, such as when working with a Monad transformer stack you can use:
view::MonadReaders m =>Getters a -> m aview:: (MonadReaders m,Monoida) =>Folds a -> m aview::MonadReaders m =>Iso's a -> m aview::MonadReaders m =>Lens's a -> m aview:: (MonadReaders m,Monoida) =>Traversal's a -> m a
set :: ASetter s t a b -> b -> s -> t #
Replace the target of a Lens or all of the targets of a Setter
or Traversal with a constant value.
(<$) ≡setmapped
>>>set _2 "hello" (1,())(1,"hello")
>>>set mapped () [1,2,3,4][(),(),(),()]
Note: Attempting to set a Fold or Getter will fail at compile time with an
relatively nice error message.
set::Setters t a b -> b -> s -> tset::Isos t a b -> b -> s -> tset::Lenss t a b -> b -> s -> tset::Traversals t a b -> b -> s -> t
over :: ASetter s t a b -> (a -> b) -> s -> t #
Modify the target of a Lens or all the targets of a Setter or Traversal
with a function.
fmap≡overmappedfmapDefault≡overtraversesets.over≡idover.sets≡id
Given any valid Setter l, you can also rely on the law:
overl f.overl g =overl (f.g)
e.g.
>>>over mapped f (over mapped g [a,b,c]) == over mapped (f . g) [a,b,c]True
Another way to view over is to say that it transforms a Setter into a
"semantic editor combinator".
>>>over mapped f (Just a)Just (f a)
>>>over mapped (*10) [1,2,3][10,20,30]
>>>over _1 f (a,b)(f a,b)
>>>over _1 show (10,20)("10",20)
over::Setters t a b -> (a -> b) -> s -> tover::ASetters t a b -> (a -> b) -> s -> t