Eq package:clash-prelude

The Eq class defines equality (==) and inequality (/=). All the basic datatypes exported by the Prelude are instances of Eq, and Eq may be derived for any datatype whose constituents are also instances of Eq. The Haskell Report defines no laws for Eq. However, instances are encouraged to follow these properties:
  • Reflexivity x == x = True
  • Symmetry x == y = y == x
  • Transitivity if x == y && y == z = True, then x == z = True
  • Extensionality if x == y = True and f is a function whose return type is an instance of Eq, then f x == f y = True
  • Negation x /= y = not (x == y)
Minimal complete definition: either == or /=.
Check domain for equality. Return 'Found if so, return 'NotFound if not. The reason d'etre for this type family is that _open_ type families don't allow overlapping types. We therefore defer equality checking to a closed type family.
Evaluate all elements of a vector to WHNF, returning the second argument
Evaluate all elements of a vector to WHNF, returning the second argument. Does not propagate XExceptions.
Evaluate each monadic action in the structure from left to right, and collect the results. For a version that ignores the results see sequence_.

Examples

Basic usage: The first two examples are instances where the input and and output of sequence are isomorphic.
>>> sequence $ Right [1,2,3,4]
[Right 1,Right 2,Right 3,Right 4]
>>> sequence $ [Right 1,Right 2,Right 3,Right 4]
Right [1,2,3,4]
The following examples demonstrate short circuit behavior for sequence.
>>> sequence $ Left [1,2,3,4]
Left [1,2,3,4]
>>> sequence $ [Left 0, Right 1,Right 2,Right 3,Right 4]
Left 0
Evaluate each action in the structure from left to right, and collect the results. For a version that ignores the results see sequenceA_.

Examples

Basic usage: For the first two examples we show sequenceA fully evaluating a a structure and collecting the results.
>>> sequenceA [Just 1, Just 2, Just 3]
Just [1,2,3]
>>> sequenceA [Right 1, Right 2, Right 3]
Right [1,2,3]
The next two example show Nothing and Just will short circuit the resulting structure if present in the input. For more context, check the Traversable instances for Either and Maybe.
>>> sequenceA [Just 1, Just 2, Just 3, Nothing]
Nothing
>>> sequenceA [Right 1, Right 2, Right 3, Left 4]
Left 4
Evaluate each monadic action in the structure from left to right, and ignore the results. For a version that doesn't ignore the results see sequence. sequence_ is just like sequenceA_, but specialised to monadic actions.
Sequential composition of two DataFlow circuits.
deepseqX: fully evaluates the first argument, before returning the second. Does not propagate XExceptions.
Either seqX or deepseqX depending on the value of the cabal flag '-fsuper-strict'. If enabled, defaultSeqX will be deepseqX, otherwise seqX. Flag defaults to false and thus seqX.
Like seqX in simulation, but will force its first argument to be rendered in HDL. This is useful for components that need to be rendered in hardware, but otherwise have no meaning in simulation. An example of such a component would be an ILA: a component monitoring an internal signal of a design. The output of such a component (typically a unit) can be passed as the first argument to hwSeqX to ensure the ILA ends up in the generated HDL. NB: The result of hwSeqX must (indirectly) be used at the very top of a design. If it's not, Clash will remove it like it does for any other unused circuit parts. NB: Make sure the blackbox for the component with zero-width results uses RenderVoid
Like seqX, but will also catch ErrorCall exceptions which are thrown. This should be used with care.
seqErrorX (ErrorCall msg)  b = b
seqErrorX (XException msg) b = b
seqErrorX _|_              b = _|_
Like seq, however, whereas seq will always do:
seq  _|_              b = _|_
seqX will do:
seqX (XException msg) b = b
seqX _|_              b = _|_