Skip to content

Commit e9b113a

Browse files
committed
add idempotency elimination to roundtrip
1 parent 5993340 commit e9b113a

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/Vatras/Test/Experiments/RoundTrip.agda

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module CCC-to-NCC = Vatras.Translation.Lang.CCC-to-NCC.Exact
3333
import Vatras.Translation.Lang.NCC-to-2CC
3434
open Vatras.Translation.Lang.NCC-to-2CC.2Ary using () renaming (NCC→2CC to NCC-2→2CC)
3535
open import Vatras.Lang.CCC.Encode using () renaming (encoder to CCC-Rose-encoder)
36+
open import Vatras.Translation.Lang.2CC.Idempotence using (Idempotence-Elimination)
3637

3738
open import Vatras.Lang.CCC.Show as ShowCCC
3839
open import Vatras.Lang.NCC.Show as ShowNCC
@@ -90,12 +91,14 @@ get round-trip ex@(name ≔ ccc) = do
9091
(boxed (6 + width pretty-ccc) "" pretty-ccc)
9192

9293
void-level do
93-
ncc translate ccc "NCC" CCC→NCC-Exact (ShowNCC.pretty id)
94-
ncc2 compile ncc "NCC" (shrinkTo2Compiler ⌈ ccc ⌉) (ShowNCC.pretty (String.diagonal-ℕ ∘ map₂ Fin.toℕ))
95-
2cc compile ncc2 "2CC" NCC-2→2CC (Show2CC.pretty (String.diagonal-ℕ ∘ map₂ Fin.toℕ))
96-
adt compile 2cc "ADT" 2CC→ADT (ShowADT.pretty (show-rose id) (String.diagonal-ℕ ∘ map₂ Fin.toℕ))
97-
variantList compile adt "VariantList" (ADT→VariantList (decidableEquality-× String._≟_ Fin._≟_)) (ShowVariantList.pretty (show-rose id))
98-
do compile variantList "CCC" (VariantList→CCC "default feature" CCC-Rose-encoder) (ShowCCC.pretty id)
94+
let eq = decidableEquality-× String._≟_ Fin._≟_
95+
ncc translate ccc "NCC" CCC→NCC-Exact (ShowNCC.pretty id)
96+
ncc2 compile ncc "NCC" (shrinkTo2Compiler ⌈ ccc ⌉) (ShowNCC.pretty (String.diagonal-ℕ ∘ map₂ Fin.toℕ))
97+
2cc compile ncc2 "2CC" NCC-2→2CC (Show2CC.pretty (String.diagonal-ℕ ∘ map₂ Fin.toℕ))
98+
2ccClean compile 2cc "2CC w/o idempotent choices" (Idempotence-Elimination _ eq) (Show2CC.pretty (String.diagonal-ℕ ∘ map₂ Fin.toℕ))
99+
adt compile 2ccClean "ADT" 2CC→ADT (ShowADT.pretty (show-rose id) (String.diagonal-ℕ ∘ map₂ Fin.toℕ))
100+
variantList compile adt "VariantList" (ADT→VariantList eq) (ShowVariantList.pretty (show-rose id))
101+
do compile variantList "CCC" (VariantList→CCC "default feature" CCC-Rose-encoder) (ShowCCC.pretty id)
99102
linebreak
100103

101104

0 commit comments

Comments
 (0)