| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
RWC.Primitives
Synopsis
- type Identity = Identity
- type ReacT = ReacT
- type StateT = StateT
- type Vec = Vector
- type Finite = Finite
- data Proxy (n :: Nat) = Proxy
- rwPrimAdd :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimAnd :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimBind :: Monad m => m a -> (a -> m b) -> m b
- rwPrimBitIndex :: forall (n :: Nat). Vec n Bool -> Finite n -> Bool
- rwPrimBitSlice :: forall (m :: Nat) (n :: Nat). KnownNat m => Vec n Bool -> Finite n -> Finite n -> Vec m Bool
- rwPrimBits :: Integer -> Vec 128 Bool
- rwPrimCryptol :: String -> String -> a -> a
- rwPrimDiv :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimEq :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Bool
- rwPrimError :: String -> a
- rwPrimExtern :: [(String, Integer)] -> String -> String -> [(String, Integer)] -> [(String, Integer)] -> String -> a -> String -> a
- rwPrimExtrude :: forall (m :: Type -> Type) i o s a. Monad m => ReacT i o (StateT s m) a -> s -> ReacT i o m a
- rwPrimGet :: forall (m :: Type -> Type) s. Monad m => StateT s m s
- rwPrimGt :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Bool
- rwPrimGtEq :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Bool
- rwPrimLAnd :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Bool
- rwPrimLNot :: forall (n :: Nat). Vec n Bool -> Bool
- rwPrimLOr :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Bool
- rwPrimLShift :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimLift :: (MonadTrans t, Monad m) => m a -> t m a
- rwPrimLt :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Bool
- rwPrimLtEq :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Bool
- rwPrimMSBit :: forall (n :: Natural). Vec (1 + n) Bool -> Bool
- rwPrimMod :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimMul :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimNatVal :: forall (n :: Nat). KnownNat n => Proxy n -> Integer
- rwPrimNot :: forall (n :: Nat). Vec n Bool -> Vec n Bool
- rwPrimOr :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimPow :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimPut :: forall (m :: Type -> Type) s. Monad m => s -> StateT s m ()
- rwPrimRAnd :: forall (n :: Nat). Vec n Bool -> Bool
- rwPrimRNAnd :: forall (n :: Natural). Vec (1 + n) Bool -> Bool
- rwPrimRNor :: forall (n :: Natural). Vec (1 + n) Bool -> Bool
- rwPrimROr :: forall (n :: Nat). Vec n Bool -> Bool
- rwPrimRShift :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimRShiftArith :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimRXNor :: forall (n :: Natural). Vec (1 + n) Bool -> Bool
- rwPrimRXOr :: forall (n :: Natural). Vec (1 + n) Bool -> Bool
- rwPrimResize :: forall (m :: Nat) (n :: Nat). KnownNat m => Vec n Bool -> Vec m Bool
- rwPrimReturn :: Monad m => a -> m a
- rwPrimSignal :: forall (m :: Type -> Type) o i. Monad m => o -> ReacT i o m i
- rwPrimSub :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimFinite :: forall (n :: Nat). KnownNat n => Integer -> Finite n
- rwPrimFiniteMinBound :: forall (n :: Nat). KnownNat n => Finite n
- rwPrimFiniteMaxBound :: forall (n :: Nat). KnownNat n => Finite n
- rwPrimToFinite :: forall (n :: Nat) (m :: Nat). KnownNat n => Vec m Bool -> Finite n
- rwPrimToFiniteMod :: forall (m :: Nat) (n :: Nat). KnownNat n => Vec m Bool -> Finite n
- rwPrimFromFinite :: forall (m :: Nat) (n :: Nat). KnownNat m => Finite n -> Vec m Bool
- rwPrimVecConcat :: forall (n :: Nat) a (m :: Nat). Vec n a -> Vec m a -> Vec (n + m) a
- rwPrimVecFromList :: forall (n :: Nat) a. KnownNat n => [a] -> Vec n a
- rwPrimVecIndex :: forall (n :: Nat) a. Vec n a -> Finite n -> a
- rwPrimVecIndexProxy :: forall (n :: Nat) (m :: Natural) a. KnownNat n => Vec ((n + m) + 1) a -> Proxy n -> a
- rwPrimVecMap :: forall a b (n :: Nat). (a -> b) -> Vec n a -> Vec n b
- rwPrimVecGenerate :: forall (n :: Nat) a. KnownNat n => (Finite n -> a) -> Vec n a
- rwPrimVecRSlice :: forall (i :: Nat) (n :: Nat) (m :: Natural) a. (KnownNat i, KnownNat n) => Proxy i -> Vec ((i + n) + m) a -> Vec n a
- rwPrimVecReplicate :: forall (n :: Nat) a. KnownNat n => a -> Vec n a
- rwPrimVecReverse :: forall (n :: Nat) a. Vec n a -> Vec n a
- rwPrimVecSlice :: forall (i :: Nat) (n :: Nat) (m :: Natural) a. (KnownNat i, KnownNat n) => Proxy i -> Vec ((i + n) + m) a -> Vec n a
- rwPrimXNor :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Vec n Bool
- rwPrimXOr :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Vec n Bool
- toIntegerV :: forall (n :: Nat). Vec n Bool -> Integer
- type family (a :: Natural) + (b :: Natural) :: Natural where ...
- class Applicative m => Monad (m :: Type -> Type)
- class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type)
- type KnownNat = KnownNat
Documentation
rwPrimAdd :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Add (wrapping mod 2^n).
rwPrimBind :: Monad m => m a -> (a -> m b) -> m b Source #
rwPrimBitIndex :: forall (n :: Nat). Vec n Bool -> Finite n -> Bool Source #
bitIndex a i == bitSlice a i i. The Finite argument must be known/literal (after inlining).
rwPrimBitSlice :: forall (m :: Nat) (n :: Nat). KnownNat m => Vec n Bool -> Finite n -> Finite n -> Vec m Bool Source #
bitSlice a j i returns bits j (most significant) to i (least significant) from a (j >= i). Bits are numbered with the least significant bit at 0 (Verilog convention); the head of the Vec is the most significant bit. The Finite arguments must be known/literals (after inlining).
rwPrimBits :: Integer -> Vec 128 Bool Source #
Interpret an Integer as a bit vector.
Arguments
| :: String | Cryptol module file. |
| -> String | Function name. |
| -> a | Haskell definition to use when running under GHC. |
| -> a |
The String arguments must be literals (after inlining).
rwPrimDiv :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Unsigned division. Division by zero yields all-ones (2^n - 1), following the SMT-LIB convention implemented by the compiled RTL and the interpreter.
rwPrimError :: String -> a Source #
Arguments
| :: [(String, Integer)] | Module parameters (name and integer literal value). |
| -> String | Clock signal name or empty for no clock. |
| -> String | Reset signal name or empty for no reset. |
| -> [(String, Integer)] | Module inputs (name and integer literal bitwidth). |
| -> [(String, Integer)] | Module outputs (name and integer literal bitwidth). |
| -> String | Module name. |
| -> a | Haskell definition to use when interpreting. |
| -> String | Reserved: an instance-name hint; currently ignored by the compiler. |
| -> a |
The String and list arguments must be literals (after inlining).
rwPrimExtrude :: forall (m :: Type -> Type) i o s a. Monad m => ReacT i o (StateT s m) a -> s -> ReacT i o m a Source #
rwPrimLNot :: forall (n :: Nat). Vec n Bool -> Bool Source #
Logical not.
rwPrimLShift :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Shift left.
rwPrimLift :: (MonadTrans t, Monad m) => m a -> t m a Source #
rwPrimMod :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Unsigned modulus. A zero divisor yields the dividend, following the SMT-LIB convention implemented by the compiled RTL and the interpreter.
rwPrimMul :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Multiply (wrapping mod 2^n).
rwPrimNatVal :: forall (n :: Nat). KnownNat n => Proxy n -> Integer Source #
Produce integer associated with type-level natural.
rwPrimPow :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Exponentiation.
rwPrimRAnd :: forall (n :: Nat). Vec n Bool -> Bool Source #
Reduction and.
rwPrimRNAnd :: forall (n :: Natural). Vec (1 + n) Bool -> Bool Source #
Reduction nand (NOT of the and-reduction, following the Verilog ~& operator).
rwPrimRNor :: forall (n :: Natural). Vec (1 + n) Bool -> Bool Source #
Reduction nor (NOT of the or-reduction, following the Verilog ~| operator).
rwPrimRShift :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Shift right.
rwPrimRShiftArith :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Shift right, sign-extend.
rwPrimRXNor :: forall (n :: Natural). Vec (1 + n) Bool -> Bool Source #
Reduction xnor (NOT of the xor-reduction, following the Verilog ~^ operator).
rwPrimResize :: forall (m :: Nat) (n :: Nat). KnownNat m => Vec n Bool -> Vec m Bool Source #
Truncates or zero-pads most significant bits.
rwPrimReturn :: Monad m => a -> m a Source #
rwPrimSub :: forall (n :: Nat). KnownNat n => Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Subtract (wrapping mod 2^n).
rwPrimFinite :: forall (n :: Nat). KnownNat n => Integer -> Finite n Source #
Convert an Integer into a , throws an error if negative or >= Finite nn.
rwPrimVecConcat :: forall (n :: Nat) a (m :: Nat). Vec n a -> Vec m a -> Vec (n + m) a Source #
Concatenate vectors.
rwPrimVecFromList :: forall (n :: Nat) a. KnownNat n => [a] -> Vec n a Source #
Turns a List literal into a Vec with fixed length. I.e.,
[x, y, z] :: Vec 3 a
rwPrimVecIndexProxy :: forall (n :: Nat) (m :: Natural) a. KnownNat n => Vec ((n + m) + 1) a -> Proxy n -> a Source #
rwPrimVecRSlice :: forall (i :: Nat) (n :: Nat) (m :: Natural) a. (KnownNat i, KnownNat n) => Proxy i -> Vec ((i + n) + m) a -> Vec n a Source #
Slice indexed from the end of the Vec.
rwPrimVecSlice :: forall (i :: Nat) (n :: Nat) (m :: Natural) a. (KnownNat i, KnownNat n) => Proxy i -> Vec ((i + n) + m) a -> Vec n a Source #
rwPrimXNor :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Bitwise exclusive nor.
rwPrimXOr :: forall (n :: Nat). Vec n Bool -> Vec n Bool -> Vec n Bool Source #
Bitwise exclusive or.
toIntegerV :: forall (n :: Nat). Vec n Bool -> Integer Source #
The unsigned value of a bit vector, as an Integer. Not a primitive: GHC-only simulation support backing ReWire.Bits.toInteger (Integer is a compile-time-literal-only type in the compiled fragment). It lives here because neither front end translates this module's bodies or chases its imports.
type family (a :: Natural) + (b :: Natural) :: Natural where ... infixl 6 #
Addition of type-level naturals.
Since: base-4.7.0.0
class Applicative m => Monad (m :: Type -> Type) #
The Monad class defines the basic operations over a monad,
a concept from a branch of mathematics known as category theory.
From the perspective of a Haskell programmer, however, it is best to
think of a monad as an abstract datatype of actions.
Haskell's do expressions provide a convenient syntax for writing
monadic expressions.
Instances of Monad should satisfy the following:
- Left identity
returna>>=k = k a- Right identity
m>>=return= m- Associativity
m>>=(\x -> k x>>=h) = (m>>=k)>>=h
Furthermore, the Monad and Applicative operations should relate as follows:
The above laws imply:
and that pure and (<*>) satisfy the applicative functor laws.
The instances of Monad for List, Maybe and IO
defined in the Prelude satisfy these laws.
Minimal complete definition
Instances
| Monad Complex | Since: base-4.9.0.0 |
| Monad First | Since: base-4.9.0.0 |
| Monad Last | Since: base-4.9.0.0 |
| Monad Max | Since: base-4.9.0.0 |
| Monad Min | Since: base-4.9.0.0 |
| Monad NonEmpty | Since: base-4.9.0.0 |
| Monad Identity | Since: base-4.8.0.0 |
| Monad IO | Since: base-2.1 |
| Monad Vector | |
| Monad Id | |
| Monad Vector | |
| Monad Maybe | Since: base-2.1 |
| Monad Solo | Since: base-4.15 |
| Monad [] | Since: base-2.1 |
| Monad m => Monad (WrappedMonad m) | Since: base-4.7.0.0 |
Defined in Control.Applicative Methods (>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b # (>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # return :: a -> WrappedMonad m a # | |
| Monad (Either e) | Since: base-4.4.0.0 |
| Monad m => Monad (ResT m) | |
| Monoid a => Monad ((,) a) | Since: base-4.9.0.0 |
| Monad (t m) => Monad (LiftingAccum t m) | Since: mtl-2.3 |
Defined in Control.Monad.Accum Methods (>>=) :: LiftingAccum t m a -> (a -> LiftingAccum t m b) -> LiftingAccum t m b # (>>) :: LiftingAccum t m a -> LiftingAccum t m b -> LiftingAccum t m b # return :: a -> LiftingAccum t m a # | |
| Monad (t m) => Monad (LiftingSelect t m) | Since: mtl-2.3 |
Defined in Control.Monad.Select Methods (>>=) :: LiftingSelect t m a -> (a -> LiftingSelect t m b) -> LiftingSelect t m b # (>>) :: LiftingSelect t m a -> LiftingSelect t m b -> LiftingSelect t m b # return :: a -> LiftingSelect t m a # | |
| Monad m => Monad (StateT s m) | |
| KnownNat n => Monad (Vector Vector n) | |
| (Monoid a, Monoid b) => Monad ((,,) a b) | Since: base-4.14.0.0 |
| (Monad f, Monad g) => Monad (Product f g) | Since: base-4.9.0.0 |
| Monad m => Monad (ReacT input output m) | |
| (Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) | Since: base-4.14.0.0 |
| Monad ((->) r) | Since: base-2.1 |
class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) #
The class of monad transformers.
For any monad m, the result t m should also be a monad,
and lift should be a monad transformation from m to t m,
i.e. it should satisfy the following laws:
Since 0.6.0.0 and for GHC 8.6 and later, the requirement that t m
be a Monad is enforced by the implication constraint
forall m. enabled by the
Monad m => Monad (t m)QuantifiedConstraints extension.
Ambiguity error with GHC 9.0 to 9.2.2
These versions of GHC have a bug (https://gitlab.haskell.org/ghc/ghc/-/issues/20582) which causes constraints like
(MonadTrans t, forall m. Monad m => Monad (t m)) => ...
to be reported as ambiguous. For transformers 0.6 and later, this can be fixed by removing the second constraint, which is implied by the first.
Minimal complete definition
Instances
| MonadTrans ResT | |
| MonadTrans (StateT s) | |
Defined in Control.Monad.Trans.State.Lazy | |
| MonadTrans (ReacT input output) | |