folds-0.7.8: Beautiful Folding
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Fold.L

Synopsis
  • data L a b = forall r. L (r -> b) (r -> a -> r) r
  • unfoldL :: (s -> (b, a -> s)) -> s -> L a b

Documentation

data L a b Source #

A Moore Machine

Constructors

forall r. L (r -> b) (r -> a -> r) r 

Instances

Instances details
Profunctor L Source # 
Instance details

Defined in Data.Fold.L

Methods

dimap :: (a -> b) -> (c -> d) -> L b c -> L a d #

lmap :: (a -> b) -> L b c -> L a c #

rmap :: (b -> c) -> L a b -> L a c #

(#.) :: forall a b c q. Coercible c b => q b c -> L a b -> L a c #

(.#) :: forall a b c q. Coercible b a => L b c -> q a b -> L a c #

Costrong L Source # 
Instance details

Defined in Data.Fold.L

Methods

unfirst :: L (a, d) (b, d) -> L a b #

unsecond :: L (d, a) (d, b) -> L a b #

Corepresentable L Source # 
Instance details

Defined in Data.Fold.L

Associated Types

type Corep L :: Type -> Type #

Methods

cotabulate :: (Corep L d -> c) -> L d c #

Choice L Source # 
Instance details

Defined in Data.Fold.L

Methods

left' :: L a b -> L (Either a c) (Either b c) #

right' :: L a b -> L (Either c a) (Either c b) #

Closed L Source # 
Instance details

Defined in Data.Fold.L

Methods

closed :: L a b -> L (x -> a) (x -> b) #

Folding L Source #

efficient prefix, leaky postfix

Instance details

Defined in Data.Fold.L

Methods

prefix :: Foldable t => t a -> L a b -> L a b Source #

prefixOf :: Fold s a -> s -> L a b -> L a b Source #

postfix :: Foldable t => L a b -> t a -> L a b Source #

postfixOf :: Fold s a -> L a b -> s -> L a b Source #

run :: Foldable t => t a -> L a b -> b Source #

runOf :: Fold s a -> s -> L a b -> b Source #

filtering :: (a -> Bool) -> L a b -> L a b Source #

Scan L Source # 
Instance details

Defined in Data.Fold.L

Methods

prefix1 :: a -> L a b -> L a b Source #

postfix1 :: L a b -> a -> L a b Source #

run1 :: a -> L a b -> b Source #

interspersing :: a -> L a b -> L a b Source #

AsL' L Source #

We can convert from a lazy left folding to a strict left folding.

Instance details

Defined in Data.Fold

Methods

asL' :: L a b -> L' a b Source #

AsL1' L Source # 
Instance details

Defined in Data.Fold

Methods

asL1' :: L a b -> L1' a b Source #

AsRM L Source #

We can convert from a lazy left folding to a right or monoidal fold

Instance details

Defined in Data.Fold

Methods

asM :: L a b -> M a b Source #

asR :: L a b -> R a b Source #

AsRM1 L Source # 
Instance details

Defined in Data.Fold

Methods

asM1 :: L a b -> M1 a b Source #

asR1 :: L a b -> R1 a b Source #

Cosieve L [] Source #
>>> cosieve (L id (+) 0) [1,2,3]
6
Instance details

Defined in Data.Fold.L

Methods

cosieve :: L a b -> [a] -> b #

Monad (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

(>>=) :: L a a0 -> (a0 -> L a b) -> L a b #

(>>) :: L a a0 -> L a b -> L a b #

return :: a0 -> L a a0 #

Functor (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

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

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

MonadFix (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

mfix :: (a0 -> L a a0) -> L a a0 #

Applicative (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

pure :: a0 -> L a a0 #

(<*>) :: L a (a0 -> b) -> L a a0 -> L a b #

liftA2 :: (a0 -> b -> c) -> L a a0 -> L a b -> L a c #

(*>) :: L a a0 -> L a b -> L a b #

(<*) :: L a a0 -> L a b -> L a a0 #

Distributive (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

distribute :: Functor f => f (L a a0) -> L a (f a0) #

collect :: Functor f => (a0 -> L a b) -> f a0 -> L a (f b) #

distributeM :: Monad m => m (L a a0) -> L a (m a0) #

collectM :: Monad m => (a0 -> L a b) -> m a0 -> L a (m b) #

Representable (L a) Source # 
Instance details

Defined in Data.Fold.L

Associated Types

type Rep (L a) #

Methods

tabulate :: (Rep (L a) -> a0) -> L a a0 #

index :: L a a0 -> Rep (L a) -> a0 #

MonadZip (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

mzip :: L a a0 -> L a b -> L a (a0, b) #

mzipWith :: (a0 -> b -> c) -> L a a0 -> L a b -> L a c #

munzip :: L a (a0, b) -> (L a a0, L a b) #

Comonad (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

extract :: L a a0 -> a0 #

duplicate :: L a a0 -> L a (L a a0) #

extend :: (L a a0 -> b) -> L a a0 -> L a b #

ComonadApply (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

(<@>) :: L a (a0 -> b) -> L a a0 -> L a b #

(@>) :: L a a0 -> L a b -> L a b #

(<@) :: L a a0 -> L a b -> L a a0 #

Apply (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

(<.>) :: L a (a0 -> b) -> L a a0 -> L a b #

(.>) :: L a a0 -> L a b -> L a b #

(<.) :: L a a0 -> L a b -> L a a0 #

liftF2 :: (a0 -> b -> c) -> L a a0 -> L a b -> L a c #

Bind (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

(>>-) :: L a a0 -> (a0 -> L a b) -> L a b #

join :: L a (L a a0) -> L a a0 #

Extend (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

duplicated :: L a a0 -> L a (L a a0) #

extended :: (L a a0 -> b) -> L a a0 -> L a b #

MonadReader [a] (L a) Source # 
Instance details

Defined in Data.Fold.L

Methods

ask :: L a [a] #

local :: ([a] -> [a]) -> L a a0 -> L a a0 #

reader :: ([a] -> a0) -> L a a0 #

type Corep L Source # 
Instance details

Defined in Data.Fold.L

type Corep L = []
type Rep (L a) Source # 
Instance details

Defined in Data.Fold.L

type Rep (L a) = [a]

unfoldL :: (s -> (b, a -> s)) -> s -> L a b Source #

Construct a Moore machine from a state valuation and transition function