ForSyDe-3.1.1: ForSyDe's Haskell-embedded Domain Specific Language.

Portabilityportable
Stabilityexperimental
Maintainerforsyde-dev@ict.kth.se

ForSyDe.Shallow.Queue

Description

This provides two data types, that can be used to model queue structures, such as FIFOs. There is a data type for an queue of infinite size Queue and one for finite size FiniteQueue.

Synopsis

Documentation

data Queue a Source

A queue is modeled as a list. The data type Queue modelles an queue of infinite size.

Constructors

Q [a] 

Instances

Eq a => Eq (Queue a) 
Show a => Show (Queue a) 

data FiniteQueue a Source

The data type FiniteQueue has an additional parameter, that determines the size of the queue.

Constructors

FQ Int [a] 

Instances

Eq a => Eq (FiniteQueue a) 
Show a => Show (FiniteQueue a) 

pushQ :: Queue a -> a -> Queue aSource

pushQ pushes one element into an infinite queue.

pushListQ :: Queue a -> [a] -> Queue aSource

pushListQ pushes a list of elements into an infinite queue.

popQ :: Queue a -> (Queue a, AbstExt a)Source

popQ pops one element from an infinite queue.

queue :: [a] -> Queue aSource

queue transforms a list into an infinite queue.

pushFQ :: FiniteQueue a -> a -> FiniteQueue aSource

pushFQ pushes one element into a finite queue.

pushListFQ :: FiniteQueue a -> [a] -> FiniteQueue aSource

pushListFQ pushes a list of elements into a finite queue.

popFQ :: FiniteQueue a -> (FiniteQueue a, AbstExt a)Source

popFQ pops one element from a finite queue.

finiteQueue :: Int -> [a] -> FiniteQueue aSource

finiteQueue transforms a list into an infinite queue.