monus-weighted-search-0.2.0.0: Efficient search weighted by an ordered monoid with monus.
Copyright(c) Donnacha Oisín Kidney 2021
Maintainermail@doisinkidney.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Heap.List

Description

A simple re-implementation of the list monad transformer, for use by the heap monad.

Synopsis

Type Definition

newtype ListT m a Source #

A list monad transformer, "done right".

Constructors

ListT 

Fields

Instances

Instances details
MonadTrans ListT Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

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

MonadWriter w m => MonadWriter w (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

writer :: (a, w) -> ListT m a #

tell :: w -> ListT m () #

listen :: ListT m a -> ListT m (a, w) #

pass :: ListT m (a, w -> w) -> ListT m a #

MonadState s m => MonadState s (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

get :: ListT m s #

put :: s -> ListT m () #

state :: (s -> (a, s)) -> ListT m a #

MonadReader r m => MonadReader r (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

ask :: ListT m r #

local :: (r -> r) -> ListT m a -> ListT m a #

reader :: (r -> a) -> ListT m a #

MonadError e m => MonadError e (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

throwError :: e -> ListT m a #

catchError :: ListT m a -> (e -> ListT m a) -> ListT m a #

Monad m => Monad (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

(>>=) :: ListT m a -> (a -> ListT m b) -> ListT m b #

(>>) :: ListT m a -> ListT m b -> ListT m b #

return :: a -> ListT m a #

Functor m => Functor (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

fmap :: (a -> b) -> ListT m a -> ListT m b #

(<$) :: a -> ListT m b -> ListT m a #

Monad m => Applicative (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

pure :: a -> ListT m a #

(<*>) :: ListT m (a -> b) -> ListT m a -> ListT m b #

liftA2 :: (a -> b -> c) -> ListT m a -> ListT m b -> ListT m c #

(*>) :: ListT m a -> ListT m b -> ListT m b #

(<*) :: ListT m a -> ListT m b -> ListT m a #

Foldable m => Foldable (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

fold :: Monoid m0 => ListT m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> ListT m a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> ListT m a -> m0 #

foldr :: (a -> b -> b) -> b -> ListT m a -> b #

foldr' :: (a -> b -> b) -> b -> ListT m a -> b #

foldl :: (b -> a -> b) -> b -> ListT m a -> b #

foldl' :: (b -> a -> b) -> b -> ListT m a -> b #

foldr1 :: (a -> a -> a) -> ListT m a -> a #

foldl1 :: (a -> a -> a) -> ListT m a -> a #

toList :: ListT m a -> [a] #

null :: ListT m a -> Bool #

length :: ListT m a -> Int #

elem :: Eq a => a -> ListT m a -> Bool #

maximum :: Ord a => ListT m a -> a #

minimum :: Ord a => ListT m a -> a #

sum :: Num a => ListT m a -> a #

product :: Num a => ListT m a -> a #

Traversable m => Traversable (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

traverse :: Applicative f => (a -> f b) -> ListT m a -> f (ListT m b) #

sequenceA :: Applicative f => ListT m (f a) -> f (ListT m a) #

mapM :: Monad m0 => (a -> m0 b) -> ListT m a -> m0 (ListT m b) #

sequence :: Monad m0 => ListT m (m0 a) -> m0 (ListT m a) #

Arbitrary1 m => Arbitrary1 (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

liftArbitrary :: Gen a -> Gen (ListT m a) #

liftShrink :: (a -> [a]) -> ListT m a -> [ListT m a] #

Monad m => Alternative (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

empty :: ListT m a #

(<|>) :: ListT m a -> ListT m a -> ListT m a #

some :: ListT m a -> ListT m [a] #

many :: ListT m a -> ListT m [a] #

Monad m => MonadPlus (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

mzero :: ListT m a #

mplus :: ListT m a -> ListT m a -> ListT m a #

MonadCont m => MonadCont (ListT m) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

callCC :: ((a -> ListT m b) -> ListT m a) -> ListT m a #

m ~ Identity => IsList (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Associated Types

type Item (ListT m a) #

Methods

fromList :: [Item (ListT m a)] -> ListT m a #

fromListN :: Int -> [Item (ListT m a)] -> ListT m a #

toList :: ListT m a -> [Item (ListT m a)] #

(forall x. Eq x => Eq (m x), Eq a) => Eq (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

(==) :: ListT m a -> ListT m a -> Bool #

(/=) :: ListT m a -> ListT m a -> Bool #

(forall x. Data x => Data (m x), Typeable m, Data a) => Data (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ListT m a -> c (ListT m a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ListT m a) #

toConstr :: ListT m a -> Constr #

dataTypeOf :: ListT m a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ListT m a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ListT m a)) #

gmapT :: (forall b. Data b => b -> b) -> ListT m a -> ListT m a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ListT m a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ListT m a -> r #

gmapQ :: (forall d. Data d => d -> u) -> ListT m a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ListT m a -> u #

gmapM :: Monad m0 => (forall d. Data d => d -> m0 d) -> ListT m a -> m0 (ListT m a) #

gmapMp :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> ListT m a -> m0 (ListT m a) #

gmapMo :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> ListT m a -> m0 (ListT m a) #

(forall x. Ord x => Ord (m x), Eq (ListT m a), Ord a) => Ord (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

compare :: ListT m a -> ListT m a -> Ordering #

(<) :: ListT m a -> ListT m a -> Bool #

(<=) :: ListT m a -> ListT m a -> Bool #

(>) :: ListT m a -> ListT m a -> Bool #

(>=) :: ListT m a -> ListT m a -> Bool #

max :: ListT m a -> ListT m a -> ListT m a #

min :: ListT m a -> ListT m a -> ListT m a #

(forall x. Read x => Read (m x), Read a) => Read (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

(forall x. Show x => Show (m x), Show a) => Show (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

showsPrec :: Int -> ListT m a -> ShowS #

show :: ListT m a -> String #

showList :: [ListT m a] -> ShowS #

Generic (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Associated Types

type Rep (ListT m a) :: Type -> Type #

Methods

from :: ListT m a -> Rep (ListT m a) x #

to :: Rep (ListT m a) x -> ListT m a #

Monad m => Semigroup (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

(<>) :: ListT m a -> ListT m a -> ListT m a #

sconcat :: NonEmpty (ListT m a) -> ListT m a #

stimes :: Integral b => b -> ListT m a -> ListT m a #

Monad m => Monoid (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

mempty :: ListT m a #

mappend :: ListT m a -> ListT m a -> ListT m a #

mconcat :: [ListT m a] -> ListT m a #

(Arbitrary1 m, Arbitrary a) => Arbitrary (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

arbitrary :: Gen (ListT m a) #

shrink :: ListT m a -> [ListT m a] #

(forall x. NFData x => NFData (m x), NFData a) => NFData (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

rnf :: ListT m a -> () #

type Rep (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

type Rep (ListT m a) = D1 ('MetaData "ListT" "Control.Monad.Heap.List" "monus-weighted-search-0.2.0.0-inplace" 'True) (C1 ('MetaCons "ListT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runListT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (ListCons a (ListT m a))))))
type Item (ListT m a) Source # 
Instance details

Defined in Control.Monad.Heap.List

type Item (ListT m a) = a

data ListCons a b Source #

The list constructor.

Constructors

Nil 
a :- !b infixr 5 

Instances

Instances details
Arbitrary2 ListCons Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

liftArbitrary2 :: Gen a -> Gen b -> Gen (ListCons a b) #

liftShrink2 :: (a -> [a]) -> (b -> [b]) -> ListCons a b -> [ListCons a b] #

Bitraversable ListCons Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> ListCons a b -> f (ListCons c d) #

Bifoldable ListCons Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

bifold :: Monoid m => ListCons m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> ListCons a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> ListCons a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> ListCons a b -> c #

Bifunctor ListCons Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

bimap :: (a -> b) -> (c -> d) -> ListCons a c -> ListCons b d #

first :: (a -> b) -> ListCons a c -> ListCons b c #

second :: (b -> c) -> ListCons a b -> ListCons a c #

Functor (ListCons a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

fmap :: (a0 -> b) -> ListCons a a0 -> ListCons a b #

(<$) :: a0 -> ListCons a b -> ListCons a a0 #

Foldable (ListCons a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

fold :: Monoid m => ListCons a m -> m #

foldMap :: Monoid m => (a0 -> m) -> ListCons a a0 -> m #

foldMap' :: Monoid m => (a0 -> m) -> ListCons a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> ListCons a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> ListCons a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> ListCons a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> ListCons a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> ListCons a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> ListCons a a0 -> a0 #

toList :: ListCons a a0 -> [a0] #

null :: ListCons a a0 -> Bool #

length :: ListCons a a0 -> Int #

elem :: Eq a0 => a0 -> ListCons a a0 -> Bool #

maximum :: Ord a0 => ListCons a a0 -> a0 #

minimum :: Ord a0 => ListCons a a0 -> a0 #

sum :: Num a0 => ListCons a a0 -> a0 #

product :: Num a0 => ListCons a a0 -> a0 #

Traversable (ListCons a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

traverse :: Applicative f => (a0 -> f b) -> ListCons a a0 -> f (ListCons a b) #

sequenceA :: Applicative f => ListCons a (f a0) -> f (ListCons a a0) #

mapM :: Monad m => (a0 -> m b) -> ListCons a a0 -> m (ListCons a b) #

sequence :: Monad m => ListCons a (m a0) -> m (ListCons a a0) #

Arbitrary a => Arbitrary1 (ListCons a) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

liftArbitrary :: Gen a0 -> Gen (ListCons a a0) #

liftShrink :: (a0 -> [a0]) -> ListCons a a0 -> [ListCons a a0] #

Generic1 (ListCons a :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Heap.List

Associated Types

type Rep1 (ListCons a) :: k -> Type #

Methods

from1 :: forall (a0 :: k). ListCons a a0 -> Rep1 (ListCons a) a0 #

to1 :: forall (a0 :: k). Rep1 (ListCons a) a0 -> ListCons a a0 #

(Eq a, Eq b) => Eq (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

(==) :: ListCons a b -> ListCons a b -> Bool #

(/=) :: ListCons a b -> ListCons a b -> Bool #

(Data a, Data b) => Data (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> ListCons a b -> c (ListCons a b) #

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ListCons a b) #

toConstr :: ListCons a b -> Constr #

dataTypeOf :: ListCons a b -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ListCons a b)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ListCons a b)) #

gmapT :: (forall b0. Data b0 => b0 -> b0) -> ListCons a b -> ListCons a b #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ListCons a b -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ListCons a b -> r #

gmapQ :: (forall d. Data d => d -> u) -> ListCons a b -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ListCons a b -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ListCons a b -> m (ListCons a b) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ListCons a b -> m (ListCons a b) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ListCons a b -> m (ListCons a b) #

(Ord a, Ord b) => Ord (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

compare :: ListCons a b -> ListCons a b -> Ordering #

(<) :: ListCons a b -> ListCons a b -> Bool #

(<=) :: ListCons a b -> ListCons a b -> Bool #

(>) :: ListCons a b -> ListCons a b -> Bool #

(>=) :: ListCons a b -> ListCons a b -> Bool #

max :: ListCons a b -> ListCons a b -> ListCons a b #

min :: ListCons a b -> ListCons a b -> ListCons a b #

(Read a, Read b) => Read (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

(Show a, Show b) => Show (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

showsPrec :: Int -> ListCons a b -> ShowS #

show :: ListCons a b -> String #

showList :: [ListCons a b] -> ShowS #

Generic (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

Associated Types

type Rep (ListCons a b) :: Type -> Type #

Methods

from :: ListCons a b -> Rep (ListCons a b) x #

to :: Rep (ListCons a b) x -> ListCons a b #

(Arbitrary a, Arbitrary b) => Arbitrary (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

arbitrary :: Gen (ListCons a b) #

shrink :: ListCons a b -> [ListCons a b] #

(NFData a, NFData b) => NFData (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

Methods

rnf :: ListCons a b -> () #

type Rep1 (ListCons a :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Heap.List

type Rep1 (ListCons a :: Type -> Type) = D1 ('MetaData "ListCons" "Control.Monad.Heap.List" "monus-weighted-search-0.2.0.0-inplace" 'False) (C1 ('MetaCons "Nil" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons ":-" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))
type Rep (ListCons a b) Source # 
Instance details

Defined in Control.Monad.Heap.List

type Rep (ListCons a b) = D1 ('MetaData "ListCons" "Control.Monad.Heap.List" "monus-weighted-search-0.2.0.0-inplace" 'False) (C1 ('MetaCons "Nil" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons ":-" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 b)))

Building the list

unfoldrM :: Functor m => (b -> m (Maybe (a, b))) -> b -> ListT m a Source #

Unfold, monadically, a list from a seed.

cons :: Applicative m => a -> ListT m a -> ListT m a Source #

fromListT :: Applicative m => [a] -> ListT m a Source #

Running the list

toListT :: Monad m => ListT m a -> m [a] Source #

Flatten all of the effects in the list and collect the results.

foldListT :: ((ListCons a (ListT m a) -> c) -> m (ListCons a (ListT m a)) -> b) -> (a -> b -> c) -> c -> ListT m a -> b Source #

Transforming lists

catMaybesT :: Monad m => (a -> Maybe b) -> ListT m a -> ListT m b Source #

Filter the list. An analogue of mapMaybe on lists.

listMmap :: Functor m => (m (ListCons a (ListT n b)) -> n (ListCons b (ListT n b))) -> ListT m a -> ListT n b Source #

Apply a function to every effect layered in the list transformer.

scanl1M :: Functor m => (a -> a -> a) -> ListT m a -> ListT m a Source #