| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
ReWire.Synolon.Repr
Description
The representable closure (doc/synolon.md §3.1): the fixed bit width of a Synolon type. Computed once, here, for the two consumers that must agree — the machine lint, which rejects a binder, cell, port, or halt answer whose type has no width, and the fold, which lays values out at that width — so the two agree on which types have a width (a type in a position only the fold sizes, such as a definition's codomain or a primitive's instantiation, gets the same diagnostic there).
Widths: Vec n τ is n · |τ| (n nat-closed); Finite n is
nbits n; Integer is 128; Proxy is 0; a tuple is the sum of its
components; a declared datatype is nbits (#constructors) plus the
widest constructor payload (the sum of its field widths at the
instantiation); a type variable is 0 (the fold only sees closed types);
a recursive datatype, an open width, and a function type have no width.
Synopsis
Documentation
The datatype table sizing consults: each datatype's constructors in declaration order (a constructor's tag is its index) and each constructor's declared signature.
type Sizes = HashMap Ty Natural Source #
The sizing memo (types compare structurally; annotations are ignored).
sizeOf :: DataEnv -> Ty -> Either Text Natural Source #
The width of a type, or the reason it has none.
sizeOfM :: DataEnv -> Ty -> StateT Sizes (Either Text) Natural Source #
sizeOf over an explicit memo (the fold sizes many types per program).
isTupleCon :: Text -> Bool Source #
The tuple type constructors, () included (the zero-component tuple).