machines-0.7.2: Networked stream transducers
Copyright(C) 2012 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Machine.Mealy

Description

Synopsis

Documentation

newtype Mealy a b Source #

Mealy machines

Examples

We can enumerate inputs:

>>> let countingMealy = unfoldMealy (\i x -> ((i, x), i + 1)) 0
>>> run (auto countingMealy <~ source "word")
[(0,'w'),(1,'o'),(2,'r'),(3,'d')]

Constructors

Mealy 

Fields

Instances

Instances details
Arrow Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

arr :: (b -> c) -> Mealy b c #

first :: Mealy b c -> Mealy (b, d) (c, d) #

second :: Mealy b c -> Mealy (d, b) (d, c) #

(***) :: Mealy b c -> Mealy b' c' -> Mealy (b, b') (c, c') #

(&&&) :: Mealy b c -> Mealy b c' -> Mealy b (c, c') #

ArrowChoice Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

left :: Mealy b c -> Mealy (Either b d) (Either c d) #

right :: Mealy b c -> Mealy (Either d b) (Either d c) #

(+++) :: Mealy b c -> Mealy b' c' -> Mealy (Either b b') (Either c c') #

(|||) :: Mealy b d -> Mealy c d -> Mealy (Either b c) d #

ArrowApply Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

app :: Mealy (Mealy b c, b) c #

Profunctor Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

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

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

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

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

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

Corepresentable Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Associated Types

type Corep Mealy :: Type -> Type #

Methods

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

Choice Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

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

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

Closed Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

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

Strong Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

first' :: Mealy a b -> Mealy (a, c) (b, c) #

second' :: Mealy a b -> Mealy (c, a) (c, b) #

Costrong Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

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

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

Automaton Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

auto :: Mealy a b -> Process a b Source #

Cosieve Mealy NonEmpty Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

cosieve :: Mealy a b -> NonEmpty a -> b #

Functor (Mealy a) Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

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

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

Applicative (Mealy a) Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

pure :: a0 -> Mealy a a0 #

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

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

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

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

Distributive (Mealy a) Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

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

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

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

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

Representable (Mealy a) Source # 
Instance details

Defined in Data.Machine.Mealy

Associated Types

type Rep (Mealy a) #

Methods

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

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

Pointed (Mealy a) Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

point :: a0 -> Mealy a a0 #

Extend (Mealy a) Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

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

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

Category Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

id :: forall (a :: k). Mealy a a #

(.) :: forall (b :: k) (c :: k) (a :: k). Mealy b c -> Mealy a b -> Mealy a c #

Semigroup b => Semigroup (Mealy a b) Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

(<>) :: Mealy a b -> Mealy a b -> Mealy a b #

sconcat :: NonEmpty (Mealy a b) -> Mealy a b #

stimes :: Integral b0 => b0 -> Mealy a b -> Mealy a b #

Monoid b => Monoid (Mealy a b) Source # 
Instance details

Defined in Data.Machine.Mealy

Methods

mempty :: Mealy a b #

mappend :: Mealy a b -> Mealy a b -> Mealy a b #

mconcat :: [Mealy a b] -> Mealy a b #

type Corep Mealy Source # 
Instance details

Defined in Data.Machine.Mealy

type Rep (Mealy a) Source # 
Instance details

Defined in Data.Machine.Mealy

type Rep (Mealy a) = NonEmpty a

unfoldMealy :: (s -> a -> (b, s)) -> s -> Mealy a b Source #

A Mealy machine modeled with explicit state.

logMealy :: Semigroup a => Mealy a a Source #

Accumulate history.