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

Safe Haskell | Safe
Language | Haskell2010

Copilot.Language.Stream

Description

Abstract syntax for streams and operators.

Synopsis

- data Stream a where
  - Append :: forall a. Typed a => [a] -> Maybe (Stream Bool) -> Stream a -> Stream a
  - Const :: forall a. Typed a => a -> Stream a
  - Drop :: forall a. Typed a => Int -> Stream a -> Stream a
  - Extern :: forall a. Typed a => String -> Maybe [a] -> Stream a
  - Local :: forall a1 a. (Typed a1, Typed a) => Stream a1 -> (Stream a1 -> Stream a) -> Stream a
  - Var :: forall a. Typed a => String -> Stream a
  - Op1 :: forall a1 a. (Typed a1, Typed a) => Op1 a1 a -> Stream a1 -> Stream a
  - Op2 :: forall a1 b a. (Typed a1, Typed b, Typed a) => Op2 a1 b a -> Stream a1 -> Stream b -> Stream a
  - Op3 :: forall a1 b c a. (Typed a1, Typed b, Typed c, Typed a) => Op3 a1 b c a -> Stream a1 -> Stream b -> Stream c -> Stream a
  - Label :: forall a. Typed a => String -> Stream a -> Stream a
- ceiling :: (Typed a, RealFrac a) => Stream a -> Stream a
- floor :: (Typed a, RealFrac a) => Stream a -> Stream a
- atan2 :: (Typed a, RealFloat a) => Stream a -> Stream a -> Stream a

# Documentation

data Stream a where Source #

A stream in Copilot is an infinite succession of values of the same type.

Streams can be built using simple primities (e.g., `Const`), by applying step-wise (e.g., `Op1`) or temporal transformations (e.g., `Append`, `Drop`) to streams, or by combining existing streams to form new streams (e.g., `Op2`, `Op3`).

Constructors

Append :: forall a. Typed a => [a] -> Maybe (Stream Bool) -> Stream a -> Stream a |
Const :: forall a. Typed a => a -> Stream a |
Drop :: forall a. Typed a => Int -> Stream a -> Stream a |
Extern :: forall a. Typed a => String -> Maybe [a] -> Stream a |
Local :: forall a1 a. (Typed a1, Typed a) => Stream a1 -> (Stream a1 -> Stream a) -> Stream a |
Var :: forall a. Typed a => String -> Stream a |
Op1 :: forall a1 a. (Typed a1, Typed a) => Op1 a1 a -> Stream a1 -> Stream a |
Op2 :: forall a1 b a. (Typed a1, Typed b, Typed a) => Op2 a1 b a -> Stream a1 -> Stream b -> Stream a |
Op3 :: forall a1 b c a. (Typed a1, Typed b, Typed c, Typed a) => Op3 a1 b c a -> Stream a1 -> Stream b -> Stream c -> Stream a |
Label :: forall a. Typed a => String -> Stream a -> Stream a |

#### Instances

Instances details

(Typed a, Bits a) => Bits (Stream a) Source # | Instance of the `Bits` class for `Stream`s. Only the methods `.&.`, `complement`, `.|.` and `xor` are defined.

Instance details

Defined in Copilot.Language.Operators.BitWise

Methods

(.&.) :: Stream a -> Stream a -> Stream a Source #

(.|.) :: Stream a -> Stream a -> Stream a Source #

xor :: Stream a -> Stream a -> Stream a Source #

complement :: Stream a -> Stream a Source #

shift :: Stream a -> Int -> Stream a Source #

rotate :: Stream a -> Int -> Stream a Source #

zeroBits :: Stream a Source #

bit :: Int -> Stream a Source #

setBit :: Stream a -> Int -> Stream a Source #

clearBit :: Stream a -> Int -> Stream a Source #

complementBit :: Stream a -> Int -> Stream a Source #

testBit :: Stream a -> Int -> Bool Source #

bitSizeMaybe :: Stream a -> Maybe Int Source #

bitSize :: Stream a -> Int Source #

isSigned :: Stream a -> Bool Source #

shiftL :: Stream a -> Int -> Stream a Source #

unsafeShiftL :: Stream a -> Int -> Stream a Source #

shiftR :: Stream a -> Int -> Stream a Source #

unsafeShiftR :: Stream a -> Int -> Stream a Source #

rotateL :: Stream a -> Int -> Stream a Source #

rotateR :: Stream a -> Int -> Stream a Source #

popCount :: Stream a -> Int Source #

(Typed a, Eq a, Floating a) => Floating (Stream a) Source # | Streams carrying floating point numbers are instances of `Floating`, and you can apply to them the `Floating` functions, point-wise.

Instance details

Defined in Copilot.Language.Stream

Methods

pi :: Stream a Source #

exp :: Stream a -> Stream a Source #

log :: Stream a -> Stream a Source #

sqrt :: Stream a -> Stream a Source #

(**) :: Stream a -> Stream a -> Stream a Source #

logBase :: Stream a -> Stream a -> Stream a Source #

sin :: Stream a -> Stream a Source #

cos :: Stream a -> Stream a Source #

tan :: Stream a -> Stream a Source #

asin :: Stream a -> Stream a Source #

acos :: Stream a -> Stream a Source #

atan :: Stream a -> Stream a Source #

sinh :: Stream a -> Stream a Source #

cosh :: Stream a -> Stream a Source #

tanh :: Stream a -> Stream a Source #

asinh :: Stream a -> Stream a Source #

acosh :: Stream a -> Stream a Source #

atanh :: Stream a -> Stream a Source #

log1p :: Stream a -> Stream a Source #

expm1 :: Stream a -> Stream a Source #

log1pexp :: Stream a -> Stream a Source #

log1mexp :: Stream a -> Stream a Source #

(Typed a, Eq a, Num a) => Num (Stream a) Source # | Streams carrying numbers are instances of `Num`, and you can apply to them the `Num` functions, point-wise.
Instance details Defined in Copilot.Language.Stream Methods (+) :: Stream a -> Stream a -> Stream a Source # (-) :: Stream a -> Stream a -> Stream a Source # (*) :: Stream a -> Stream a -> Stream a Source # negate :: Stream a -> Stream a Source # abs :: Stream a -> Stream a Source # signum :: Stream a -> Stream a Source # fromInteger :: Integer -> Stream a Source #
(Typed a, Eq a, Fractional a) => Fractional (Stream a) Source # | Streams carrying fractional numbers are instances of `Fractional`, and you can apply to them the `Fractional` functions, point-wise.
Instance details Defined in Copilot.Language.Stream Methods (/) :: Stream a -> Stream a -> Stream a Source # recip :: Stream a -> Stream a Source # fromRational :: Rational -> Stream a Source #
Show (Stream a) Source # | Dummy instance in order to make `Stream` an instance of `Num`.
Instance details Defined in Copilot.Language.Stream Methods showsPrec :: Int -> Stream a -> ShowS Source # show :: Stream a -> String Source # showList :: [Stream a] -> ShowS Source #
Eq (Stream a) Source # | Dummy instance in order to make `Stream` an instance of `Num`.
Instance details Defined in Copilot.Language.Stream Methods (==) :: Stream a -> Stream a -> Bool Source # (/=) :: Stream a -> Stream a -> Bool Source #
(KnownNat n, Typed t) => Projectable (Array n t) (Stream Word32) t Source # | Update a stream of arrays.

Instance details

Defined in Copilot.Language.Operators.Array

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 #

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

ceiling :: (Typed a, RealFrac a) => Stream a -> Stream a Source #

Point-wise application of `ceiling` to a stream.

Unlike the Haskell variant of this function, this variant takes and returns two streams of the same type. Use a casting function to convert the result to an intergral type of your choice.

Note that the result can be too big (or, if negative, too small) for that type (see the man page of `ceil` for details), so you must check that the value fits in the desired integral type before casting it.

This definition clashes with one in `RealFrac` in Haskell's Prelude, re-exported from `Language.Copilot`, so you need to import this module qualified to use this function.

floor :: (Typed a, RealFrac a) => Stream a -> Stream a Source #

Point-wise application of `floor` to a stream.

Unlike the Haskell variant of this function, this variant takes and returns two streams of the same type. Use a casting function to convert the result to an intergral type of your choice.

Note that the result can be too big (or, if negative, too small) for that type (see the man page of `floor` for details), so you must check that the value fits in the desired integral type before casting it.

This definition clashes with one in `RealFrac` in Haskell's Prelude, re-exported from `Language.Copilot`, so you need to import this module qualified to use this function.

atan2 :: (Typed a, RealFloat a) => Stream a -> Stream a -> Stream a Source #

Point-wise application of `atan2` to the values of two streams.

For each pair of real floating-point samples `x` and `y`, one from each stream, `atan2` computes the angle of the vector from `(0, 0)` to the point `(x, y)`.

This definition clashes with one in `RealFloat` in Haskell's Prelude, re-exported from `Language.Copilot`, so you need to import this module qualified to use this function.