blarney
Copyright(c) Alexandre Joannou 2019
LicenseMIT
Maintaineralexandre.joannou@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred

Blarney.SourceSink

Description

This module defines the Source and Sink types. These types can be used as Module Interfaces do provide a standardized way of handling flow control.

Synopsis

Documentation

data Source t Source #

Source type. A Source t Interface returns values of type t via its peek method and flow control through its canPeek and consume methods.

Constructors

Source 

Fields

Instances

Instances details
Functor Source # 
Instance details

Defined in Blarney.SourceSink

Methods

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

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

Generic (Source t) # 
Instance details

Defined in Blarney.SourceSink

Associated Types

type Rep (Source t) :: Type -> Type #

Methods

from :: Source t -> Rep (Source t) x #

to :: Rep (Source t) x -> Source t #

Interface t => Interface (Source t) # 
Instance details

Defined in Blarney.SourceSink

ToSource (Source t) t #

Identity conversion from Source to Source

Instance details

Defined in Blarney.SourceSink

Methods

toSource :: Source t -> Source t Source #

Connectable (Source t) (Sink t) #

Connectable instance for Source t and Sink t

Instance details

Defined in Blarney.SourceSink

Methods

makeConnection :: Source t -> Sink t -> Module () Source #

ToSP (SP t0 t1) t0 t1 #

ToSP instance for StreamProcessor itself

Instance details

Defined in Blarney.Stream

Methods

toSP :: SP t0 t1 -> SP t0 t1 Source #

ToSP (Sink t0, Source t1) t0 t1 #

ToSP instance for (Sink, Source) pairs

Instance details

Defined in Blarney.Stream

Methods

toSP :: (Sink t0, Source t1) -> SP t0 t1 Source #

type Rep (Source t) # 
Instance details

Defined in Blarney.SourceSink

type Rep (Source t) = D1 ('MetaData "Source" "Blarney.SourceSink" "main" 'False) (C1 ('MetaCons "Source" 'PrefixI 'True) (S1 ('MetaSel ('Just "canPeek") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Bit 1)) :*: (S1 ('MetaSel ('Just "peek") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 t) :*: S1 ('MetaSel ('Just "consume") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Action ())))))

data Sink t Source #

Sink type. A Sink t Interface can be fed values of type t via its put method, expected to be called when its canPut method returns true.

Constructors

Sink 

Fields

Instances

Instances details
Generic (Sink t) # 
Instance details

Defined in Blarney.SourceSink

Associated Types

type Rep (Sink t) :: Type -> Type #

Methods

from :: Sink t -> Rep (Sink t) x #

to :: Rep (Sink t) x -> Sink t #

(Interface t, Bits t) => Interface (Sink t) # 
Instance details

Defined in Blarney.SourceSink

ToSink (Sink t) t #

Identify conversion from Sink to Sink

Instance details

Defined in Blarney.SourceSink

Methods

toSink :: Sink t -> Sink t Source #

Connectable (Source t) (Sink t) #

Connectable instance for Source t and Sink t

Instance details

Defined in Blarney.SourceSink

Methods

makeConnection :: Source t -> Sink t -> Module () Source #

ToSP (Sink t0, Source t1) t0 t1 #

ToSP instance for (Sink, Source) pairs

Instance details

Defined in Blarney.Stream

Methods

toSP :: (Sink t0, Source t1) -> SP t0 t1 Source #

type Rep (Sink t) # 
Instance details

Defined in Blarney.SourceSink

type Rep (Sink t) = D1 ('MetaData "Sink" "Blarney.SourceSink" "main" 'False) (C1 ('MetaCons "Sink" 'PrefixI 'True) (S1 ('MetaSel ('Just "canPut") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Bit 1)) :*: S1 ('MetaSel ('Just "put") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (t -> Action ()))))

class ToSource a b | a -> b where Source #

ToSource class to convert to a Source

Methods

toSource :: a -> Source b Source #

Converts its argument of type a to a Source b

Instances

Instances details
ToSource (Queue t) t #

ToSource instance for Queue

Instance details

Defined in Blarney.Queue

Methods

toSource :: Queue t -> Source t Source #

ToSource (Source t) t #

Identity conversion from Source to Source

Instance details

Defined in Blarney.SourceSink

Methods

toSource :: Source t -> Source t Source #

ToSource (Stack t) t # 
Instance details

Defined in Blarney.Stack

Methods

toSource :: Stack t -> Source t Source #

class ToSink a b | a -> b where Source #

ToSink class to convert to a Sink

Methods

toSink :: a -> Sink b Source #

Converts its argument of type a to a Sink b

Instances

Instances details
ToSink (Queue t) t #

ToSink instance for Queue

Instance details

Defined in Blarney.Queue

Methods

toSink :: Queue t -> Sink t Source #

ToSink (Sink t) t #

Identify conversion from Sink to Sink

Instance details

Defined in Blarney.SourceSink

Methods

toSink :: Sink t -> Sink t Source #

ToSink (Stack t) t # 
Instance details

Defined in Blarney.Stack

Methods

toSink :: Stack t -> Sink t Source #

nullSource :: Bits t => Source t Source #

"Null" Source that never produces any valid output.

makeNullSource :: Bits t => Module (Source t) Source #

"Null" Source Module that never produces any valid output.

nullSink :: Sink t Source #

"Null" Sink that always consumes its input.

makeNullSink :: Module (Sink t) Source #

"Null" Sink Module that always consumes its input.

mapSource Source #

Arguments

:: (a -> b)

The function to map over the initial Source

-> Source a

The initial Source

-> Source b

The new Source

"map" a function over a Source and returns the new Source. Note: this function is suitable for use as fmap in a Functor instance of Source.

mapSink Source #

Arguments

:: (b -> a)

The function to map over the initial Sink. Note: The type 'b -> a' is making this function not suitable for a potential Functor instance of Sink

-> Sink a

The initial Source

-> Sink b

The new Source

"map" a function over a Sink and returns the new Sink

guardSource :: (a -> Bit 1) -> Source a -> Source a Source #

Apply a guard to a source

debugSource Source #

Arguments

:: FShow t 
=> Source t

The Source to debug

-> Format

A Format prefix

-> Source t

The wrapped Source

Wraps a Source t with some debug info.

debugSink Source #

Arguments

:: FShow t 
=> Sink t

The Sink to debug

-> Format

A Format prefix

-> Sink t

The wrapped Sink

Wraps a Sink t with some debug info.