supply-next-0.0.1.2: Supply-chain interface for basic streaming
Safe HaskellSafe-Inferred
LanguageGHC2021

Next.Interface

Contents

Synopsis

Types

data Next item result Source #

A basic dynamic interface for a possibly-finite stream

Once End is returned from a Next request, it is expected that the stream will thenceforth return End and perform no side effects in response to any subsequent Next requests.

Constructors

result ~ Step item => Next

Request the next item from the stream

Instances

Instances details
TerminableStream item (Next item) Source # 
Instance details

Defined in Next.Interface.Class

Methods

liftNext :: Next item result -> Next item result Source #

data Step item Source #

The result obtained from a Next request

Constructors

Item item

An item obtained from the stream

End

Indicates that the stream has ended and there are no more items

Instances

Instances details
Foldable Step Source # 
Instance details

Defined in Next.Interface.Type

Methods

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

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

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

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

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

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

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

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

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

toList :: Step a -> [a] #

null :: Step a -> Bool #

length :: Step a -> Int #

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

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

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

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

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

Traversable Step Source # 
Instance details

Defined in Next.Interface.Type

Methods

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

sequenceA :: Applicative f => Step (f a) -> f (Step a) #

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

sequence :: Monad m => Step (m a) -> m (Step a) #

Functor Step Source # 
Instance details

Defined in Next.Interface.Type

Methods

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

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

Show item => Show (Step item) Source # 
Instance details

Defined in Next.Interface.Type

Methods

showsPrec :: Int -> Step item -> ShowS #

show :: Step item -> String #

showList :: [Step item] -> ShowS #

Eq item => Eq (Step item) Source # 
Instance details

Defined in Next.Interface.Type

Methods

(==) :: Step item -> Step item -> Bool #

(/=) :: Step item -> Step item -> Bool #

Ord item => Ord (Step item) Source # 
Instance details

Defined in Next.Interface.Type

Methods

compare :: Step item -> Step item -> Ordering #

(<) :: Step item -> Step item -> Bool #

(<=) :: Step item -> Step item -> Bool #

(>) :: Step item -> Step item -> Bool #

(>=) :: Step item -> Step item -> Bool #

max :: Step item -> Step item -> Step item #

min :: Step item -> Step item -> Step item #

Class

class TerminableStream item interface | interface -> item where Source #

An interface for which Next is one of possibly many supported requests

Methods

liftNext :: Next item result -> interface result Source #

Lift a Next request into a larger interface

Instances

Instances details
TerminableStream item (Next item) Source # 
Instance details

Defined in Next.Interface.Class

Methods

liftNext :: Next item result -> Next item result Source #

next :: TerminableStream item interface => interface (Step item) Source #

Like Next, but polymorphic