-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Minimal essentials -- -- A minimal yet powerful library of essentials, only depending on -- base. @package mini @version 1.2.2.1 -- | Representation of a structure mapping unique keys to values. The -- internal structure is an AVL tree. module Mini.Data.Map -- | A map from keys of type k to values of type a. -- -- The internal structure is an AVL tree; a tree that is always -- height-balanced (the absolute value of the level difference between -- the left and right subtrees is at most 1). data Map k a -- | <math> Map difference (matching only on keys) difference :: Ord k => Map k a -> Map k b -> Map k a -- | <math> Left-biased map intersection (matching only on keys) intersection :: Ord k => Map k a -> Map k b -> Map k a -- | <math> Left-biased map union (matching only on keys) union :: Ord k => Map k a -> Map k a -> Map k a -- | <math> The empty map empty :: Map k a -- | <math> From a tail-biased list of (key, value) pairs to -- a map with bins containing the keys and values fromList :: Ord k => [(k, a)] -> Map k a -- | <math> From a key and a value to a map with a single bin singleton :: k -> a -> Map k a -- | <math> From a map to a list of (key, value) pairs in -- key-ascending order toAscList :: Map k a -> [(k, a)] -- | <math> From a map to a list of (key, value) pairs in -- key-descending order toDescList :: Map k a -> [(k, a)] -- | <math> From a left-associative operation on keys and values, a -- starting accumulator and a map to a thing foldlWithKey :: (b -> k -> a -> b) -> b -> Map k a -> b -- | <math> From a right-associative operation on keys and values, a -- starting accumulator and a map to a thing foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b -- | <math> From an operation, a key and a map to the map adjusted by -- applying the operation to the value associated with the key adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a -- | <math> From a key and a map to the map without the key delete :: Ord k => k -> Map k a -> Map k a -- | <math> From a predicate and a map to the map with values -- satisfying the predicate filter :: Ord k => (a -> Bool) -> Map k a -> Map k a -- | <math> From a predicate and a map to the map with keys and -- values satisfying the predicate filterWithKey :: Ord k => (k -> a -> Bool) -> Map k a -> Map k a -- | <math> From a key, a value and a map to the map including a bin -- containing the key and the value insert :: Ord k => k -> a -> Map k a -> Map k a -- | <math> From an operation, a key and a map to the map updated by -- applying the operation to the value associated with the key (setting -- if Just, deleting if Nothing) update :: Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a -- | <math> From a map and another map to whether the former is a -- submap of the latter (matching on keys and values) isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool -- | <math> From a key and a map to the value associated with the key -- in the map lookup :: Ord k => k -> Map k a -> Maybe a -- | <math> From a map to the value associated with the maximum key -- in the map lookupMax :: Map k a -> Maybe a -- | <math> From a map to the value associated with the minimum key -- in the map lookupMin :: Map k a -> Maybe a -- | <math> From a key and a map to whether the key is in the map member :: Ord k => k -> Map k a -> Bool -- | <math> From a map to whether the map is empty null :: Map k a -> Bool -- | <math> From a map to the size of the map size :: Map k a -> Int -- | <math> From a lifting operation on keys and values and a map to -- a lifted map traverseWithKey :: Applicative f => (k -> a -> f b) -> Map k a -> f (Map k b) -- | <math> From a map to whether its internal structure is valid, -- i.e. height-balanced and ordered valid :: Ord k => Map k a -> Bool instance (GHC.Classes.Ord k, GHC.Classes.Ord a) => GHC.Classes.Ord (Mini.Data.Map.Map k a) instance (GHC.Classes.Eq k, GHC.Classes.Eq a) => GHC.Classes.Eq (Mini.Data.Map.Map k a) instance (GHC.Show.Show k, GHC.Show.Show a) => GHC.Show.Show (Mini.Data.Map.Map k a) instance GHC.Base.Functor (Mini.Data.Map.Map k) instance Data.Foldable.Foldable (Mini.Data.Map.Map k) instance Data.Traversable.Traversable (Mini.Data.Map.Map k) instance GHC.Classes.Ord k => GHC.Base.Semigroup (Mini.Data.Map.Map k a) instance GHC.Classes.Ord k => GHC.Base.Monoid (Mini.Data.Map.Map k a) -- | Representation of a structure containing unique elements. The internal -- structure is an AVL tree. module Mini.Data.Set -- | A set containing elements of type a. -- -- The internal structure is an AVL tree; a tree that is always -- height-balanced (the absolute value of the level difference between -- the left and right subtrees is at most 1). data Set a -- | <math> Set difference difference :: Ord a => Set a -> Set a -> Set a -- | <math> Set intersection intersection :: Ord a => Set a -> Set a -> Set a -- | <math> Set union union :: Ord a => Set a -> Set a -> Set a -- | <math> The empty set empty :: Set a -- | <math> From a tail-biased list of elements to a set containing -- the elements fromList :: Ord a => [a] -> Set a -- | <math> From an element to a set with a single element singleton :: a -> Set a -- | <math> From a set to a list of elements in ascending order toAscList :: Set a -> [a] -- | <math> From a set to a list of elements in descending order toDescList :: Set a -> [a] -- | <math> From an element and a set to the set without the element delete :: Ord a => a -> Set a -> Set a -- | <math> From a predicate and a set to the set with elements -- satisfying the predicate filter :: Ord a => (a -> Bool) -> Set a -> Set a -- | <math> From an element and a set to the set including the -- element insert :: Ord a => a -> Set a -> Set a -- | <math> From a set and another set to whether the former is a -- subset of the latter isSubsetOf :: Ord a => Set a -> Set a -> Bool -- | <math> From a set to the maximum element of the set lookupMax :: Set a -> Maybe a -- | <math> From a set to the minimum element of the set lookupMin :: Set a -> Maybe a -- | <math> From an element and a set to whether the element is in -- the set member :: Ord a => a -> Set a -> Bool -- | <math> From a set to whether the set is empty null :: Set a -> Bool -- | <math> From a set to the size of the set size :: Set a -> Int -- | <math> From a set to whether its internal structure is valid, -- i.e. height-balanced and ordered valid :: Ord a => Set a -> Bool instance GHC.Classes.Ord a => GHC.Classes.Ord (Mini.Data.Set.Set a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Mini.Data.Set.Set a) instance GHC.Show.Show a => GHC.Show.Show (Mini.Data.Set.Set a) instance Data.Foldable.Foldable Mini.Data.Set.Set -- | Compose polymorphic record updates with van Laarhoven lenses module Mini.Optics.Lens -- | A reference updating structures from s to t and fields -- from a to b type Lens s t a b = forall f. (Functor f) => (a -> f b) -> (s -> f t) -- | Make a lens from a getter and a setter lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b -- | Fetch the field referenced by a lens from a structure view :: Lens s t a b -> s -> a -- | Update the field referenced by a lens with an operation on a structure over :: Lens s t a b -> (a -> b) -> s -> t -- | Overwrite the field referenced by a lens with a value on a structure set :: Lens s t a b -> b -> s -> t -- | The class of monad transformers module Mini.Transformers.Class -- | Instances should satisfy the following laws: -- --
-- lift . pure = pure ---- --
-- lift (m >>= f) = lift m >>= (lift . f) --class MonadTrans t -- | Lift a computation from the inner monad to the transformer monad lift :: (MonadTrans t, Monad m) => m a -> t m a -- | Extend a monad with the ability to terminate a computation with a -- value module Mini.Transformers.EitherT -- | A terminable transformer with termination e, inner monad -- m, return a newtype EitherT e m a EitherT :: m (Either e a) -> EitherT e m a -- | Unwrap an EitherT computation runEitherT :: EitherT e m a -> m (Either e a) -- | Terminate the computation with a value left :: Monad m => e -> EitherT e m a -- | Run a computation and get its result anticipate :: Monad m => EitherT e m a -> EitherT e m (Either e a) instance GHC.Base.Monad m => GHC.Base.Functor (Mini.Transformers.EitherT.EitherT e m) instance GHC.Base.Monad m => GHC.Base.Applicative (Mini.Transformers.EitherT.EitherT e m) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => GHC.Base.Alternative (Mini.Transformers.EitherT.EitherT e m) instance GHC.Base.Monad m => GHC.Base.Monad (Mini.Transformers.EitherT.EitherT e m) instance Mini.Transformers.Class.MonadTrans (Mini.Transformers.EitherT.EitherT e) -- | Extend a monad with the ability to terminate a computation without a -- value module Mini.Transformers.MaybeT -- | A terminable transformer with inner monad m, return a newtype MaybeT m a MaybeT :: m (Maybe a) -> MaybeT m a -- | Unwrap a MaybeT computation runMaybeT :: MaybeT m a -> m (Maybe a) -- | Terminate the computation without a value nothing :: Monad m => MaybeT m a -- | Run a computation and get its result anticipate :: Monad m => MaybeT m a -> MaybeT m (Maybe a) instance GHC.Base.Monad m => GHC.Base.Functor (Mini.Transformers.MaybeT.MaybeT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Mini.Transformers.MaybeT.MaybeT m) instance GHC.Base.Monad m => GHC.Base.Alternative (Mini.Transformers.MaybeT.MaybeT m) instance GHC.Base.Monad m => GHC.Base.Monad (Mini.Transformers.MaybeT.MaybeT m) instance Mini.Transformers.Class.MonadTrans Mini.Transformers.MaybeT.MaybeT -- | Extend a monad with the ability to parse symbol sequences module Mini.Transformers.ParserT -- | A transformer parsing symbols s, inner monad m, return -- a newtype ParserT s m a ParserT :: ([s] -> m (Either ParseError (a, [s]))) -> ParserT s m a -- | Abstract representation of a parse error data ParseError -- | Unwrap a ParserT computation with a sequence of symbols to -- parse runParserT :: ParserT s m a -> [s] -> m (Either ParseError (a, [s])) -- | Parse symbols satisfying a predicate -- --
-- >>> runParserT (some $ sat isDigit) "123abc"
-- Right ("123","abc")
--
sat :: (Applicative m, Show s) => (s -> Bool) -> ParserT s m s
-- | Parse any symbol
--
--
-- >>> runParserT (item *> item <* item) "bar"
-- Right ('a',"")
--
item :: (Applicative m, Show s) => ParserT s m s
-- | Parse a symbol
--
--
-- >>> runParserT (symbol 'f') "foo"
-- Right ('f',"oo")
--
symbol :: (Applicative m, Show s, Eq s) => s -> ParserT s m s
-- | Parse a sequence of symbols
--
--
-- >>> runParserT (string "foo") "foobar"
-- Right ("foo","bar")
--
string :: (Monad m, Traversable t, Show s, Eq s) => t s -> ParserT s m (t s)
-- | Parse symbols included in a collection
--
--
-- >>> runParserT (oneOf "abc") "bar"
-- Right ('b',"ar")
--
oneOf :: (Applicative m, Foldable t, Show s, Eq s) => t s -> ParserT s m s
-- | Parse symbols excluded from a collection
--
--
-- >>> runParserT (noneOf "abc") "foo"
-- Right ('f',"oo")
--
noneOf :: (Applicative m, Foldable t, Show s, Eq s) => t s -> ParserT s m s
-- | Parse successfully only at end of input
--
-- -- >>> runParserT (string "foobar" *> eof) "foobar" -- Right ((),"") --eof :: (Monad m, Show s) => ParserT s m () -- | Parse zero or more p separated by q via p -- `sepBy` q -- --
-- >>> runParserT (sat isDigit `sepBy` symbol ',') "1,2,3,four"
-- Right ("123",",four")
--
sepBy :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
-- | Parse one or more p separated by q via p
-- `sepBy1` q
--
--
-- >>> runParserT (sat isDigit `sepBy1` symbol ',') "1,2,3,four"
-- Right ("123",",four")
--
sepBy1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
-- | Parse zero or more p separated and ended by q via
-- p `endBy` q
--
--
-- >>> runParserT (sat isDigit `endBy` symbol ',') "1,2,3,four"
-- Right ("123","four")
--
endBy :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
-- | Parse one or more p separated and ended by q via
-- p `endBy1` q
--
--
-- >>> runParserT (sat isDigit `endBy1` symbol ',') "1,2,3,four"
-- Right ("123","four")
--
endBy1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
-- | Parse zero or more p left-chained with op atop
-- a via chainl p op a
--
-- -- >>> runParserT (chainl (read <$> some (sat isDigit)) ((+) <$ item) 10) "2a3b4c" -- Right (9,"c") --chainl :: (Monad m, Eq s) => ParserT s m a -> ParserT s m (a -> a -> a) -> a -> ParserT s m a -- | Parse one or more p left-chained with op via -- chainl1 p op -- --
-- >>> runParserT (chainl1 (read <$> some (sat isDigit)) ((+) <$ item)) "2a3b4c" -- Right (9,"c") --chainl1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m (a -> a -> a) -> ParserT s m a -- | Parse zero or more p right-chained with op atop -- a via chainr p op a -- --
-- >>> runParserT (chainr (read <$> some (sat isDigit)) ((*) <$ item) 10) "2a3b4c" -- Right (24,"c") --chainr :: (Monad m, Eq s) => ParserT s m a -> ParserT s m (a -> a -> a) -> a -> ParserT s m a -- | Parse one or more p right-chained with op via -- chainr1 p op -- --
-- >>> runParserT (chainr1 (read <$> some (sat isDigit)) ((*) <$ item)) "2a3b4c" -- Right (24,"c") --chainr1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m (a -> a -> a) -> ParserT s m a -- | Parse p enclosed by a and b via between -- a b p -- --
-- >>> runParserT (between (symbol '(') (symbol ')') (many $ sat isLetter)) "(yes)"
-- Right ("yes","")
--
between :: Monad m => ParserT s m open -> ParserT s m close -> ParserT s m a -> ParserT s m a
-- | Parse p returning a in case of failure via
-- option a p
--
--
-- >>> runParserT (option "foo" $ string "bar") "baz"
-- Right ("foo","baz")
--
option :: (Monad m, Eq s) => a -> ParserT s m a -> ParserT s m a
-- | Parse p, without consuming input, iff p fails via
-- reject p
--
--
-- >>> runParserT (string "foo" <* reject (sat isLetter)) "foo(bar)"
-- Right ("foo","(bar)")
--
reject :: (Monad m, Show a) => ParserT s m a -> ParserT s m ()
-- | Parse p, without consuming input, iff p succeeds via
-- accept p
--
-- -- >>> runParserT (accept item >>= pure . (== 'a')) "foo" -- Right (False,"foo") --accept :: Monad m => ParserT s m a -> ParserT s m a instance GHC.Base.Monoid Mini.Transformers.ParserT.ParseError instance GHC.Base.Semigroup Mini.Transformers.ParserT.ParseError instance GHC.Base.Monad m => GHC.Base.Functor (Mini.Transformers.ParserT.ParserT s m) instance GHC.Base.Monad m => GHC.Base.Applicative (Mini.Transformers.ParserT.ParserT s m) instance (GHC.Base.Monad m, GHC.Classes.Eq s) => GHC.Base.Alternative (Mini.Transformers.ParserT.ParserT s m) instance GHC.Base.Monad m => GHC.Base.Monad (Mini.Transformers.ParserT.ParserT s m) instance Mini.Transformers.Class.MonadTrans (Mini.Transformers.ParserT.ParserT s) instance (GHC.Base.Monad m, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Mini.Transformers.ParserT.ParserT s m a) instance (GHC.Base.Monad m, GHC.Base.Monoid a) => GHC.Base.Monoid (Mini.Transformers.ParserT.ParserT s m a) instance GHC.Base.Monad m => Control.Monad.Fail.MonadFail (Mini.Transformers.ParserT.ParserT s m) instance GHC.Show.Show Mini.Transformers.ParserT.ParseError -- | Extend a monad with a read-only environment module Mini.Transformers.ReaderT -- | A transformer with read-only r, inner monad m, return -- a newtype ReaderT r m a ReaderT :: (r -> m a) -> ReaderT r m a -- | Unwrap a ReaderT computation with an initial read-only value runReaderT :: ReaderT r m a -> r -> m a -- | Fetch the read-only environment ask :: Monad m => ReaderT r m r -- | Run a computation in a modified environment local :: (r -> r') -> ReaderT r' m a -> ReaderT r m a instance GHC.Base.Monad m => GHC.Base.Functor (Mini.Transformers.ReaderT.ReaderT r m) instance GHC.Base.Monad m => GHC.Base.Applicative (Mini.Transformers.ReaderT.ReaderT r m) instance (GHC.Base.Monad m, GHC.Base.Alternative m) => GHC.Base.Alternative (Mini.Transformers.ReaderT.ReaderT r m) instance GHC.Base.Monad m => GHC.Base.Monad (Mini.Transformers.ReaderT.ReaderT r m) instance Mini.Transformers.Class.MonadTrans (Mini.Transformers.ReaderT.ReaderT r) -- | Extend a monad with a modifiable environment module Mini.Transformers.StateT -- | A transformer with state s, inner monad m, return -- a newtype StateT s m a StateT :: (s -> m (a, s)) -> StateT s m a -- | Unwrap a StateT computation with an initial state runStateT :: StateT s m a -> s -> m (a, s) -- | Fetch the current state get :: Monad m => StateT s m s -- | Update the current state with an operation modify :: Monad m => (s -> s) -> StateT s m () -- | Overwrite the current state with a value put :: Monad m => s -> StateT s m () instance GHC.Base.Monad m => GHC.Base.Functor (Mini.Transformers.StateT.StateT s m) instance GHC.Base.Monad m => GHC.Base.Applicative (Mini.Transformers.StateT.StateT s m) instance (GHC.Base.Monad m, GHC.Base.Alternative m) => GHC.Base.Alternative (Mini.Transformers.StateT.StateT s m) instance GHC.Base.Monad m => GHC.Base.Monad (Mini.Transformers.StateT.StateT s m) instance Mini.Transformers.Class.MonadTrans (Mini.Transformers.StateT.StateT s) -- | Extend a monad with an accumulative write-only environment module Mini.Transformers.WriterT -- | A transformer with monoidal write-only w, inner monad m, -- return a newtype WriterT w m a WriterT :: m (a, w) -> WriterT w m a -- | Unwrap a WriterT computation runWriterT :: WriterT w m a -> m (a, w) -- | Append a value to the write-only environment tell :: Monad m => w -> WriterT w m () instance (GHC.Base.Monad m, GHC.Base.Monoid w) => GHC.Base.Functor (Mini.Transformers.WriterT.WriterT w m) instance (GHC.Base.Monad m, GHC.Base.Monoid w) => GHC.Base.Applicative (Mini.Transformers.WriterT.WriterT w m) instance (GHC.Base.Monad m, GHC.Base.Alternative m, GHC.Base.Monoid w) => GHC.Base.Alternative (Mini.Transformers.WriterT.WriterT w m) instance (GHC.Base.Monad m, GHC.Base.Monoid w) => GHC.Base.Monad (Mini.Transformers.WriterT.WriterT w m) instance GHC.Base.Monoid w => Mini.Transformers.Class.MonadTrans (Mini.Transformers.WriterT.WriterT w)