Skip to content

Commit aa33af1

Browse files
committed
[ upstream ] Support Name in IBindVar
1 parent ffbfe4f commit aa33af1

File tree

17 files changed

+33
-39
lines changed

17 files changed

+33
-39
lines changed

src/Derive/Abs.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ absImplDef abs impl = def impl [patClause (var impl) (appNames "MkAbs" [abs])]
2828

2929
parameters (nms : List Name)
3030
abs : BoundArg 1 Explicit -> TTImp
31-
abs (BA _ [x] _) = `(abs ~(varStr x))
31+
abs (BA _ [x] _) = `(abs ~(var x))
3232

3333
export
3434
absDef : Name -> Con n vs -> Decl

src/Derive/Eq.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ rhs (sx :< x) = foldr (\e,acc => `(~(e) && ~(acc))) x sx
127127

128128
parameters (nms : List Name)
129129
arg : BoundArg 2 Regular -> TTImp
130-
arg (BA g [x,y] _) = assertIfRec nms g.type `(~(varStr x) == ~(varStr y))
130+
arg (BA g [x,y] _) = assertIfRec nms g.type `(~(var x) == ~(var y))
131131

132132
||| Generates pattern match clauses for the constructors of
133133
||| the given data type. `fun` is the name of the function we implement.

src/Derive/Fractional.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ fractionalImplDef d r i =
3535
def i [patClause (var i) (appNames "MkFractional" [d, r])]
3636

3737
div : BoundArg 2 Explicit -> TTImp
38-
div (BA arg [x,y] _) = `(~(varStr x) / ~(varStr y))
38+
div (BA arg [x,y] _) = `(~(var x) / ~(var y))
3939

4040
recip : BoundArg 1 Explicit -> TTImp
41-
recip (BA arg [x] _) = `(recip ~(varStr x))
41+
recip (BA arg [x] _) = `(recip ~(var x))
4242

4343
export
4444
divDef : Name -> Con n vs -> Decl

src/Derive/Integral.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ intImplDef d m impl =
2929

3030
parameters (nms : List Name)
3131
div : BoundArg 2 Explicit -> TTImp
32-
div (BA arg [x,y] _) = `(div ~(varStr x) ~(varStr y))
32+
div (BA arg [x,y] _) = `(div ~(var x) ~(var y))
3333

3434
mod : BoundArg 2 Explicit -> TTImp
35-
mod (BA arg [x,y] _) = `(mod ~(varStr x) ~(varStr y))
35+
mod (BA arg [x,y] _) = `(mod ~(var x) ~(var y))
3636

3737
export
3838
divDef : Name -> Con n vs -> Decl

src/Derive/Neg.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ negImplDef neg min impl =
3535
def impl [patClause (var impl) (appNames "MkNeg" [neg, min])]
3636

3737
minus : BoundArg 2 Explicit -> TTImp
38-
minus (BA arg [x,y] _) = `(~(varStr x) - ~(varStr y))
38+
minus (BA arg [x,y] _) = `(~(var x) - ~(var y))
3939

4040
neg : BoundArg 1 Explicit -> TTImp
41-
neg (BA arg [x] _) = `(negate ~(varStr x))
41+
neg (BA arg [x] _) = `(negate ~(var x))
4242

4343
export
4444
minusDef : Name -> Con n vs -> Decl

src/Derive/Num.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ numImplDef p m fi impl =
4141
def impl [patClause (var impl) (appNames "MkNum" [p,m,fi])]
4242

4343
plus : BoundArg 2 Explicit -> TTImp
44-
plus (BA arg [x,y] _) = `(~(varStr x) + ~(varStr y))
44+
plus (BA arg [x,y] _) = `(~(var x) + ~(var y))
4545

4646
mult : BoundArg 2 Explicit -> TTImp
47-
mult (BA arg [x,y] _) = `(~(varStr x) * ~(varStr y))
47+
mult (BA arg [x,y] _) = `(~(var x) * ~(var y))
4848

4949
fromInt : BoundArg 0 Explicit -> TTImp
5050
fromInt _ = `(fromInteger n)

src/Derive/Ord.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ catchAll ci fun ti =
5555

5656
parameters (nms : List Name)
5757
arg : BoundArg 2 Regular -> TTImp
58-
arg (BA g [x,y] _) = assertIfRec nms g.type `(compare ~(varStr x) ~(varStr y))
58+
arg (BA g [x,y] _) = assertIfRec nms g.type `(compare ~(var x) ~(var y))
5959

6060
||| Generates pattern match clauses for the constructors of
6161
||| the given data type. `fun` is the name of the function we implement.

src/Derive/Pretty.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ parameters (nms : List Name)
5353
-- pretty printing a single, explicit, unnamed constructor argument
5454
arg : BoundArg 1 Explicit -> TTImp
5555
arg (BA (MkArg M0 _ _ _) _ _) = `(pretty US)
56-
arg (BA (MkArg _ _ _ t) [x] _) = assertIfRec nms t `(prettyArg ~(varStr x))
56+
arg (BA (MkArg _ _ _ t) [x] _) = assertIfRec nms t `(prettyArg ~(var x))
5757

5858
-- prettying a constructor plus its arguments
5959
rhs : Name -> SnocList TTImp -> TTImp
@@ -65,7 +65,7 @@ parameters (nms : List Name)
6565
let nm := (argName a).namePrim
6666
in case a.count of
6767
M0 => `(prettyField ~(nm) US)
68-
_ => assertIfRec nms a.type `(prettyField ~(nm) ~(varStr x))
68+
_ => assertIfRec nms a.type `(prettyField ~(nm) ~(var x))
6969

7070
-- prettying a constructor plus its named arguments
7171
nrhs : Name -> SnocList TTImp -> TTImp

src/Derive/Semigroup.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ semigroupImplDef f i =
3333
def i [patClause (var i) (var "MkSemigroup" `app` var f)]
3434

3535
app : BoundArg 2 Explicit -> TTImp
36-
app (BA _ [x,y] _) = `(~(varStr x) <+> ~(varStr y))
36+
app (BA _ [x,y] _) = `(~(var x) <+> ~(var y))
3737

3838
appClause : Name -> Con n vs -> Clause
3939
appClause f = mapArgs2 explicit (\x,y => `(~(var f) ~(x) ~(y))) app

src/Derive/Show.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ parameters (nms : List Name)
7272
-- showing a single, explicit, unnamed constructor argument
7373
arg : BoundArg 1 Explicit -> TTImp
7474
arg (BA (MkArg M0 _ _ _) _ _) = primVal (Str " _")
75-
arg (BA (MkArg _ _ _ t) [x] _) = assertIfRec nms t `(showArg ~(varStr x))
75+
arg (BA (MkArg _ _ _ t) [x] _) = assertIfRec nms t `(showArg ~(var x))
7676

7777
-- showing a constructor plus its arguments
7878
rhs : Name -> SnocList TTImp -> TTImp
@@ -86,7 +86,7 @@ parameters (nms : List Name)
8686
in case a.count of
8787
M0 => `(MkPair ~(nm) "_")
8888
_ =>
89-
let shown := assertIfRec nms a.type `(show ~(varStr x))
89+
let shown := assertIfRec nms a.type `(show ~(var x))
9090
in `(MkPair ~(nm) ~(shown))
9191

9292
-- showing a constructor plus its named arguments

0 commit comments

Comments
 (0)