wrench-0.0.6.3
Safe HaskellSafe-Inferred
LanguageHaskell2010

Wrench.Report.View

Description

Report views, the {...} keys of a report template, as data. A view's Spec says how its key is spelled and what it reads (numbers, a format); parsing a key against it yields that value, typed, and the renderer takes it. Usage text, the docs table and key matching all read the same Spec.

The shared views live in Wrench.Report, each ISA's own in views. A report template is compiled against them once, before the simulation runs, so rendering cannot meet a bad key.

Synopsis

Key specs

data Spec a Source #

How a key is spelled, and what it reads: a free applicative over its parts, so it can be both parsed and inspected (for usage and docs).

Instances

Instances details
Applicative Spec Source # 
Instance details

Defined in Wrench.Report.View

Methods

pure :: a -> Spec a #

(<*>) :: Spec (a -> b) -> Spec a -> Spec b #

liftA2 :: (a -> b -> c) -> Spec a -> Spec b -> Spec c #

(*>) :: Spec a -> Spec b -> Spec b #

(<*) :: Spec a -> Spec b -> Spec a #

Functor Spec Source # 
Instance details

Defined in Wrench.Report.View

Methods

fmap :: (a -> b) -> Spec a -> Spec b #

(<$) :: a -> Spec b -> Spec a #

data Format Source #

Constructors

Dec 
Hex 
Sym 
Bin 

Instances

Instances details
Bounded Format Source # 
Instance details

Defined in Wrench.Report.View

Enum Format Source # 
Instance details

Defined in Wrench.Report.View

Show Format Source # 
Instance details

Defined in Wrench.Report.View

Eq Format Source # 
Instance details

Defined in Wrench.Report.View

Methods

(==) :: Format -> Format -> Bool #

(/=) :: Format -> Format -> Bool #

lit :: Text -> Spec () Source #

Literal parts: lit "mem:instr-ranges" is two of them.

specName :: Spec a -> Text Source #

The literal part of a key: mem:table, mem:dump, pc.

Views

data CheckEnv Source #

What a key's arguments are checked against: the configuration.

Constructors

CheckEnv 

Fields

data View env Source #

Constructors

View 

Fields

mkView :: Spec a -> Text -> (env -> a -> Text) -> View env Source #

checkedView :: Spec a -> Text -> (CheckEnv -> a -> Either Text ()) -> (env -> a -> Text) -> View env Source #

A view whose arguments must also fit the configuration.

withRenames :: [(Text, Text)] -> [View env] -> [View env] Source #

contramapView :: (b -> a) -> View a -> View b Source #

The same view over a larger environment.

viewsTable :: [View env] -> Text Source #

A Markdown table of the current views. Neighbours with the same description, such as a register under its two names, share a row.

data Stat env Source #

A run-wide stat of an ISA: a view of its own and a line of {isa-specific}.

Constructors

Stat 

Fields

statView :: Stat env -> View env Source #

Templates

data Template env Source #

A report template with every key already matched to its view.

compileTemplate :: CheckEnv -> [View env] -> Text -> Either [Text] ([Text], Template env) Source #

Split a template into text and {key} holes, matching every key.

examples :: View env -> [Text] Source #

Keys that name this view, one per spelling: every format, with and without optional parts, 0 for each number.