| Safe Haskell | Trustworthy |
|---|---|
| Language | Haskell2010 |
ReWire.GHC.ToEidos
Description
The Core -> Eidos bridge: translates the -O0 desugared Core of the
whole home module graph into an Eidos Program (doc/eidos.md §3) by
near-transliteration. Where the retired Crust bridge lowered lets to
beta-redexes (with demand-order rescheduling), crushed cases to
single-arm cascades, and discarded type instantiations for the
typechecker to re-infer, this bridge PRESERVES them: Core lets become
Lets (recursive groups included), join-tagged
binders become Join binds with Jumps at their call sites, cases
stay n-ary with their case binder, and type arguments ride along as
TArgs (driving the substitution-based specializer). Types are
bridged fail-fast: an untranslatable type is a located error at the
occurrence, never a silent Nothing.
Also handled here: the reachability walk from the start symbol + rwPrim* roots, evidence erasure (dictionary arguments/binders/binds erased; user-class dictionaries kept as data, with single-method classes' newtype-dictionary types unwrapped to the method type, matching the term level's cast erasure), rwPrim* recognition, the reactive-monad class-op recognition (Bind and Return at ReacT/StateT/Identity or at an unresolved monad type), Integer/String/list literal folding, INLINE-pragma ride-along, and the base vocabulary. Name and type classification lives in ReWire.GHC.Recognize.
Uniques: every Eidos binder gets a fresh unique from a supply threaded through the translation (GHC Core does not guarantee globally unique binders); occurrences resolve through the context maps.