copilot-language-4.8: A Haskell-embedded DSL for monitoring hard real-time distributed systems.

Safe Haskell | Safe
Language | Haskell2010

Copilot.Language.Operators.Array

Contents

- Orphan instances

Description

Combinators to deal with streams carrying arrays.

Synopsis

- (!) :: forall (n :: Nat) t. (KnownNat n, Typed t) => Stream (Array n t) -> Stream Word32 -> Stream t
- (!!) :: forall (n :: Nat) t. Stream (Array n t) -> Stream Word32 -> Projection (Array n t) (Stream Word32) t
- (=:) :: Projectable d s t => Projection d s t -> Stream t -> Stream d
- (=$) :: Projectable d s t => Projection d s t -> (Stream t -> Stream t) -> Stream d

# Documentation

(!) :: forall (n :: Nat) t. (KnownNat n, Typed t) => Stream (Array n t) -> Stream Word32 -> Stream t Source #

Create a stream that carries an element of an array in another stream.

This function implements a projection of the element of an array at a given position, over time. For example, if `s` is a stream of type `Stream (Array '5 Word8)`, then `s ! 3` has type `Stream Word8` and contains the 3rd element (starting from zero) of the arrays in `s` at any point in time.

(!!) :: forall (n :: Nat) t. Stream (Array n t) -> Stream Word32 -> Projection (Array n t) (Stream Word32) t Source #

Pair a stream with an element accessor, without applying it to obtain the value of the element.

This function is needed to refer to an element accessor when the goal is to update the element value, not just to read it.

(=:) :: Projectable d s t => Projection d s t -> Stream t -> Stream d infixl 8 Source #

Modify the value of a sub-element of a type in a stream of elements of that type.

(=$) :: Projectable d s t => Projection d s t -> (Stream t -> Stream t) -> Stream d infixl 8 Source #

Update the value of a sub-element of a type in a stream of elements of that type, by applying a function on streams.

# Orphan instances

(KnownNat n, Typed t) => Projectable (Array n t) (Stream Word32) t Source # | Update a stream of arrays.

Instance details

Associated Types

data Projection (Array n t) (Stream Word32) t |
Instance details Defined in Copilot.Language.Operators.Array data Projection (Array n t) (Stream Word32) t = ProjectionA (Stream (Array n t)) (Stream Word32)

Methods

(=:) :: Projection (Array n t) (Stream Word32) t -> Stream t -> Stream (Array n t) Source #

(=$) :: Projection (Array n t) (Stream Word32) t -> (Stream t -> Stream t) -> Stream (Array n t) Source #