small-steps-0.1.0.0: Small step semantics
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Iterate.Collect

Synopsis

Documentation

newtype Cont ans x Source #

Constructors

Cont 

Fields

Instances

Instances details
Monad (Cont r) Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

(>>=) :: Cont r a -> (a -> Cont r b) -> Cont r b #

(>>) :: Cont r a -> Cont r b -> Cont r b #

return :: a -> Cont r a #

Functor (Cont ans) Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

fmap :: (a -> b) -> Cont ans a -> Cont ans b #

(<$) :: a -> Cont ans b -> Cont ans a #

Applicative (Cont ans) Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

pure :: a -> Cont ans a #

(<*>) :: Cont ans (a -> b) -> Cont ans a -> Cont ans b #

liftA2 :: (a -> b -> c) -> Cont ans a -> Cont ans b -> Cont ans c #

(*>) :: Cont ans a -> Cont ans b -> Cont ans b #

(<*) :: Cont ans a -> Cont ans b -> Cont ans a #

newtype Collect tuple Source #

Constructors

Collect 

Fields

  • runCollect :: forall ans. ans -> (tuple -> ans -> ans) -> ans
     

Instances

Instances details
Monad Collect Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

(>>=) :: Collect a -> (a -> Collect b) -> Collect b #

(>>) :: Collect a -> Collect b -> Collect b #

return :: a -> Collect a #

Functor Collect Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

fmap :: (a -> b) -> Collect a -> Collect b #

(<$) :: a -> Collect b -> Collect a #

Applicative Collect Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

pure :: a -> Collect a #

(<*>) :: Collect (a -> b) -> Collect a -> Collect b #

liftA2 :: (a -> b -> c) -> Collect a -> Collect b -> Collect c #

(*>) :: Collect a -> Collect b -> Collect b #

(<*) :: Collect a -> Collect b -> Collect a #

Foldable Collect Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

fold :: Monoid m => Collect m -> m #

foldMap :: Monoid m => (a -> m) -> Collect a -> m #

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

foldr :: (a -> b -> b) -> b -> Collect a -> b #

foldr' :: (a -> b -> b) -> b -> Collect a -> b #

foldl :: (b -> a -> b) -> b -> Collect a -> b #

foldl' :: (b -> a -> b) -> b -> Collect a -> b #

foldr1 :: (a -> a -> a) -> Collect a -> a #

foldl1 :: (a -> a -> a) -> Collect a -> a #

toList :: Collect a -> [a] #

null :: Collect a -> Bool #

length :: Collect a -> Int #

elem :: Eq a => a -> Collect a -> Bool #

maximum :: Ord a => Collect a -> a #

minimum :: Ord a => Collect a -> a #

sum :: Num a => Collect a -> a #

product :: Num a => Collect a -> a #

Show t => Show (Collect t) Source #

Even though a (Collect t) is a function, if we can (Show t), we can pick an action that collects all the shown t, and turn them into a big multi-line string.

Instance details

Defined in Control.Iterate.Collect

Methods

showsPrec :: Int -> Collect t -> ShowS #

show :: Collect t -> String #

showList :: [Collect t] -> ShowS #

fixAction :: Collect tuple -> ans -> (tuple -> ans -> ans) -> ans Source #

A (Collect t) is completely agnostic over how ts are beging collected. We can make this abstraction concrete by using fixAction.

mapify :: Ord a => Collect (a, b) -> Map a b Source #

listify :: Collect (a, b) -> [(a, b)] Source #

count :: Collect (a, b) -> Int Source #

one :: t -> Collect t Source #

Here are several ways to add a new t to what is being collected.

The one and none interface are used when we want collections with 0 or 1 elements

front :: t -> Collect t -> Collect t Source #

The front and rear interface can add to either end of the sequence (both in constant time)

rear :: Collect t -> t -> Collect t Source #

when :: Bool -> Collect () Source #

Conditional collecting

takeC :: Int -> Collect t -> [t] Source #

newtype ColPlus tuple Source #

Constructors

ColPlus 

Fields

  • runColPlus :: forall ans. ans -> (tuple -> ans -> ans) -> (ans -> ans -> ans) -> ans
     

Instances

Instances details
Monad ColPlus Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

(>>=) :: ColPlus a -> (a -> ColPlus b) -> ColPlus b #

(>>) :: ColPlus a -> ColPlus b -> ColPlus b #

return :: a -> ColPlus a #

Functor ColPlus Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

fmap :: (a -> b) -> ColPlus a -> ColPlus b #

(<$) :: a -> ColPlus b -> ColPlus a #

Applicative ColPlus Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

pure :: a -> ColPlus a #

(<*>) :: ColPlus (a -> b) -> ColPlus a -> ColPlus b #

liftA2 :: (a -> b -> c) -> ColPlus a -> ColPlus b -> ColPlus c #

(*>) :: ColPlus a -> ColPlus b -> ColPlus b #

(<*) :: ColPlus a -> ColPlus b -> ColPlus a #

Alternative ColPlus Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

empty :: ColPlus a #

(<|>) :: ColPlus a -> ColPlus a -> ColPlus a #

some :: ColPlus a -> ColPlus [a] #

many :: ColPlus a -> ColPlus [a] #

MonadPlus ColPlus Source # 
Instance details

Defined in Control.Iterate.Collect

Methods

mzero :: ColPlus a #

mplus :: ColPlus a -> ColPlus a -> ColPlus a #

runPlus :: Monoid a => ColPlus t -> a -> (t -> a -> a) -> a Source #