-
Notifications
You must be signed in to change notification settings - Fork 37
/
rewrite-rules-example.yaml
104 lines (95 loc) · 2.92 KB
/
rewrite-rules-example.yaml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# An example config file for the '--rewrite-rules' option.
# Imagine a library which uses the Agda standard library extensively and let's suppose we would like to translate its operators to the Haskell equivalents. The library includes a Haskell.Prim.Num.Num instance.
# First, we specify how to handle Prelude.
prelude:
implicit: true
hiding: # if implicit is true
- "seq"
#using: # if implicit is false
# - + # (+) should be given like that
# - Num
#Then the rules themselves.
rewrites:
# The rational type.
- from: "Data.Rational.Unnormalised.Base.ℚᵘ"
to: "Rational"
importing: "Data.Ratio"
# Arithmetic operators.
# Note: Prelude has to be specified too!
- from: "Agda.Builtin.Nat._+_"
to: "_+_"
importing: "Prelude"
- from: "Agda.Builtin.Nat._*_"
to: "_*_"
importing: "Prelude"
- from: "Agda.Builtin.Nat.-_"
to: "negate"
importing: "Prelude"
- from: "Agda.Builtin.Nat._-_"
to: "_-_"
importing: "Prelude"
- from: "Data.Nat.Base._⊔_"
to: "max"
importing: "Prelude"
- from: "Agda.Builtin.Integer._+_"
to: "_+_"
importing: "Prelude"
- from: "Data.Integer.Base._*_"
to: "_*_"
importing: "Prelude"
- from: "Agda.Builtin.Integer.-_"
to: "negate"
importing: "Prelude"
- from: "Agda.Builtin.Integer._-_"
to: "_-_"
importing: "Prelude"
- from: "Data.Rational.Unnormalised.Base._+_"
to: "_+_"
importing: "Prelude"
- from: "Data.Rational.Unnormalised.Base._*_"
to: "_*_"
importing: "Prelude"
- from: "Data.Rational.Unnormalised.Base.-_"
to: "negate"
importing: "Prelude"
- from: "Data.Rational.Unnormalised.Base._-_"
to: "_-_"
importing: "Prelude"
- from: "Data.Rational.Unnormalised.Base._/_"
to: "_%_"
importing: "Data.Ratio"
- from: "Data.Rational.Unnormalised.Base._⊔_"
to: "max"
importing: "Prelude"
- from: "Data.Rational.Unnormalised.Base._⊓_"
to: "min"
importing: "Prelude"
- from: "Data.Rational.Unnormalised.Base.∣_∣"
to: "abs"
importing: "Prelude"
- from: "Data.Integer.Base.∣_∣"
to: "intAbs"
importing: "Base"
# Standard library functions related to naturals and integers.
- from: "Agda.Builtin.Nat.Nat.suc"
to: "suc"
importing: "Base"
- from: "Agda.Builtin.Int.Int.pos"
to: "toInteger"
importing: "Prelude"
- from: "Data.Integer.DivMod._divℕ_"
to: "divNat"
importing: "Base"
- from: "Data.Nat.DivMod._/_"
to: "div"
importing: "Prelude"
# Standard library functions related to rationals.
- from: "Data.Rational.Unnormalised.Base.ℚᵘ.numerator"
to: "numerator"
importing: "Data.Ratio"
- from: "Data.Rational.Unnormalised.Base.ℚᵘ.denominator"
to: "denominatorNat"
importing: "Base" #the Base version returns a Natural
- from: "Data.Rational.Unnormalised.Base.ℚᵘ.denominator-1"
to: "denominatorMinus1"
importing: "Base"