Haskell Code - How to approximate infinite objects
Proof of correctness
The proof of correctness for this code is in the paper:
-
Approximation of Nested Fixpoints – A Coalgebraic View of Parametric Dataypes
by Alexander Kurz, Alberto Pardo, Daniela Petrişan, Paula Severi, and Fer-Jan de Vries.
Haskell Code - Instructions
- The file Trunc.hs is needed for all sections.
- Example from the Introduction. Naive printing gives infinite 0's.
Files WrongPrinting.hs
and TestWrongPrinting.hs .
To compile
ghc TestWrongPrinting.hs
- Non-generic Solution.
Files NonGeneric.hs
and TestNonGeneric.hs .
To compile
ghc -XDataKinds -XGADTs TestNonGeneric.hs
- Generic Solution.
Files Generic.hs
and the file TestGeneric.hs .
To compile
ghc -XDataKinds -XGADTs TestGeneric.hs
|