blob: 6b95910b3aac952c1c8fc114a2b940fddb79adc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
||| Raw syntax for terms. This is before eliminating names.
module Obs.Syntax
import Obs.Sort
import Text.Bounded
import Text.PrettyPrint.Prettyprinter
%default total
-- Definition ------------------------------------------------------------------
public export
data Syntax : Type where
Var : Bounds -> String -> Syntax
-- Sorts
Sort : Bounds -> Sort -> Syntax
-- True
Top : Bounds -> Syntax
Point : Bounds -> Syntax
-- False
Bottom : Bounds -> Syntax
Absurd : Bounds -> Syntax -> Syntax -> Syntax
public export
record Definition where
constructor MkDefinition
bounds : Bounds -- of the name
name : String
ty : Syntax
tm : Syntax
-- Pretty Print ----------------------------------------------------------------
export
Pretty Syntax where
prettyPrec d (Var x str) = pretty str
prettyPrec d (Sort x s) = prettyPrec d s
prettyPrec d (Top x) = pretty "()"
prettyPrec d (Point x) = pretty "*"
prettyPrec d (Bottom x) = pretty "Void"
prettyPrec d (Absurd x a t) =
parenthesise (d > Open) $
group $
fillSep [pretty "absurd", prettyPrec App a, prettyPrec App t]
export
Pretty Definition where
pretty def = group $
pretty def.name <++> colon <+> softline <+> pretty def.ty <+> hardline <+>
pretty def.name <++> equals <+> softline <+> pretty def.tm
|