summaryrefslogtreecommitdiff
path: root/src/Obs/Syntax.idr
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2022-12-20 11:07:04 +0000
committerGreg Brown <greg.brown01@ed.ac.uk>2022-12-20 11:07:04 +0000
commitcb4ec1e7c1551c1d28f00ba11b062daa78e8c4e3 (patch)
treedfc735cd0a37cab884d6bf3abb7ab7085dce6c2a /src/Obs/Syntax.idr
parentd05a1259d764730da53c92db20f74bc5ae6cb953 (diff)
Add equality types and casts.
Diffstat (limited to 'src/Obs/Syntax.idr')
-rw-r--r--src/Obs/Syntax.idr33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Obs/Syntax.idr b/src/Obs/Syntax.idr
index f1a552f..bcc0cb4 100644
--- a/src/Obs/Syntax.idr
+++ b/src/Obs/Syntax.idr
@@ -29,6 +29,12 @@ data Syntax : Type where
-- False
Bottom : Bounds -> Syntax
Absurd : Bounds -> Syntax -> Syntax -> Syntax
+ -- Equality
+ Equal : Bounds -> Syntax -> Syntax -> Syntax
+ Refl : Bounds -> Syntax -> Syntax
+ Transp : Bounds -> Syntax -> Syntax -> Syntax -> Syntax -> Syntax -> Syntax
+ Cast : Bounds -> Syntax -> Syntax -> Syntax -> Syntax
+ CastId : Bounds -> Syntax -> Syntax
public export
record Definition where
@@ -85,6 +91,33 @@ Pretty Syntax where
parenthesise (d >= App) $
group $
fillSep [pretty "absurd", prettyPrec App a, prettyPrec App t]
+ prettyPrec d (Equal _ t u) =
+ parenthesise (d >= Equal) $
+ group $
+ prettyPrec Equal t <++> pretty "~" <+> softline <+> prettyPrec Equal u
+ prettyPrec d (Refl _ t) =
+ parenthesise (d >= App) $
+ group $
+ fillSep [pretty "refl", prettyPrec App t]
+ prettyPrec d (Transp _ t b u t' e) =
+ parenthesise (d >= App) $
+ group $
+ fillSep $
+ [ pretty "transp"
+ , prettyPrec App t
+ , prettyPrec App b
+ , prettyPrec App u
+ , prettyPrec App t'
+ , prettyPrec App e
+ ]
+ prettyPrec d (Cast _ b e t) =
+ parenthesise (d >= App) $
+ group $
+ fillSep [pretty "cast", prettyPrec App b, prettyPrec App e, prettyPrec App t]
+ prettyPrec d (CastId _ t) =
+ parenthesise (d >= App) $
+ group $
+ fillSep [pretty "castRefl", prettyPrec App t]
export
Pretty Definition where