clash-lib
Copyright(C) 2026 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Clash.Rewrite.StrategyDSL.TH

Description

Compile a Clash.Rewrite.StrategyDSL strategy into executable dispatch code. compileStrategy produces the fused fast path: one constructor match per node drives both the dispatch of the node program and the descent into the node's children.

Synopsis

Documentation

compileStrategy :: Strat -> Q Exp Source #

Compile a strategy into its fused dispatch code. The result is an expression of type Rewrite extra, with extra fixed by the workers the spec references.

compileStrategyReference :: Strat -> Q Exp Source #

Compile a strategy into its unfused reference: the same transformations, run as a plain apply chain through the Clash.Rewrite.Combinators traversals. Agrees with compileStrategy on results, transformation counts, and change flags.

dispatchQ :: Step -> Q Exp Source #

A node program as a plain rewrite: match the constructor once and run that constructor's program, without traversing. For composing a Step with plain combinators, and for testing chains in isolation.

asRewriteQ :: Transformation -> Q Exp Source #

A transformation as a plain uninstrumented rewrite: match the term against the worker table, run the worker on a match, return the term untouched otherwise. Splice this where a transformation is invoked from inside another transformation (any instrumentation is the caller's).