term1to2 was encoding Term.Request as Constructor

This commit is contained in:
Arya Irani 2021-02-12 15:27:37 -05:00
parent 696755c196
commit 11a9d60515
3 changed files with 4 additions and 5 deletions

View File

@ -917,7 +917,7 @@ convertTerm1 lookup1 lookup2 lookupText hash1 v1component = do
V1.Term.Constructor r i ->
V2.Term.Constructor (lookupType r) (fromIntegral i)
V1.Term.Request r i ->
V2.Term.Constructor (lookupType r) (fromIntegral i)
V2.Term.Request (lookupType r) (fromIntegral i)
V1.Term.Handle b h -> V2.Term.Handle (goTerm b) (goTerm h)
V1.Term.App f a -> V2.Term.App (goTerm f) (goTerm a)
V1.Term.Ann e t -> V2.Term.Ann (goTerm e) (buildTermType2H lookup t)

View File

@ -105,7 +105,7 @@ term1to2 h =
V1.Term.Char c -> V2.Term.Char c
V1.Term.Ref r -> V2.Term.Ref (rreference1to2 h r)
V1.Term.Constructor r i -> V2.Term.Constructor (reference1to2 r) (fromIntegral i)
V1.Term.Request r i -> V2.Term.Constructor (reference1to2 r) (fromIntegral i)
V1.Term.Request r i -> V2.Term.Request (reference1to2 r) (fromIntegral i)
V1.Term.Handle b h -> V2.Term.Handle b h
V1.Term.App f a -> V2.Term.App f a
V1.Term.Ann e t -> V2.Term.Ann e (ttype1to2 t)

View File

@ -1097,7 +1097,6 @@ instance (ABT.Var vt, Eq at, Eq a) => Eq (F vt at p a) where
instance (Show v, Show a) => Show (F v a0 p a) where
showsPrec = go
where
showConstructor r n = shows r <> s "#" <> shows n
go _ (Int n ) = (if n >= 0 then s "+" else s "") <> shows n
go _ (Nat n ) = shows n
go _ (Float n ) = shows n
@ -1122,13 +1121,13 @@ instance (Show v, Show a) => Show (F v a0 p a) where
go _ (Handle b body) = showParen
True
(s "handle " <> shows b <> s " in " <> shows body)
go _ (Constructor r n ) = showConstructor r n
go _ (Constructor r n ) = s "Con" <> shows r <> s "#" <> shows n
go _ (Match scrutinee cases) = showParen
True
(s "case " <> shows scrutinee <> s " of " <> shows cases)
go _ (Text s ) = shows s
go _ (Char c ) = shows c
go _ (Request r n) = showConstructor r n
go _ (Request r n) = s "Req" <> shows r <> s "#" <> shows n
go p (If c t f) =
showParen (p > 0)
$ s "if "