lift package:clash-prelude

Turn a value into a Template Haskell expression, suitable for use in a splice.
A Lift instance can have any of its values turned into a Template Haskell expression. This is needed when a value used within a Template Haskell quotation is bound outside the Oxford brackets ([| ... |] or [|| ... ||]) but not at the top level. As an example:
add1 :: Int -> Q (TExp Int)
add1 x = [|| x + 1 ||]
Template Haskell has no way of knowing what value x will take on at splice-time, so it requires the type of x to be an instance of Lift. A Lift instance must satisfy $(lift x) ≡ x and $$(liftTyped x) ≡ x for all x, where $(...) and $$(...) are Template Haskell splices. It is additionally expected that lift x ≡ unTypeQ (liftTyped x). Lift instances can be derived automatically by use of the -XDeriveLift GHC language extension:
{-# LANGUAGE DeriveLift #-}
module Foo where

import Language.Haskell.TH.Syntax

data Bar a = Bar1 a (Bar a) | Bar2 String
deriving Lift
Levity-polymorphic since template-haskell-2.16.0.0.
Lift values inside of Q to a Template Haskell expression
Turn a value into a Template Haskell typed expression, suitable for use in a typed splice.
Dataflow circuit synchronized to the systemClockGen. type DataFlow iEn oEn i o = DataFlow' systemClockGen iEn oEn i o Create a DataFlow circuit from a circuit description with the appropriate type:
Signal dom i        -- Incoming data.
-> Signal dom Bool  -- Flagged with a single /valid/ bit.
-> Signal dom Bool  -- Incoming back-pressure, /ready/ bit.
-> ( Signal dom o   -- Outgoing data.
, Signal dom oEn -- Flagged with a single /valid/ bit.
, Signal dom iEn -- Outgoing back-pressure, /ready/ bit.
)
A circuit adhering to the DataFlow type should:
  • Not consume data when validity is deasserted.
  • Only update its output when readiness is asserted.
liftRnfX should reduce its argument to normal form (that is, fully evaluate all sub-components), given an argument to reduce a arguments, and then return (). See rnfX for the generic deriving.
liftRnfX should reduce its argument to normal form (that is, fully evaluate all sub-components), given an argument to reduce a arguments, and then return (). See rnfX for the generic deriving.