Skip to content

Commit ef3bd24

Browse files
committed
Change syntax of path exps to have typs and dot path exps as args
For example, one previously wrote ap 'a 'b: f (type a -> b) -> f a -> f b and now one writes ap 'a 'b: f (a -> b) -> f a -> f b which is both more concise and also more familiar.
1 parent 738044c commit ef3bd24

5 files changed

Lines changed: 8 additions & 6 deletions

File tree

paper.1ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ type COLL c = {
9797
lookup : c -> key ~> opt val
9898
keys : c ~> list key
9999
}
100-
entries (c : type) (C : COLL c) (xs : c) : list (type (C.key, C.val)) =
100+
entries (c : type) (C : COLL c) (xs : c) : list (C.key, C.val) =
101101
List.map (C.keys xs) (fun (k : C.key) => (k, caseopt (C.lookup xs k) bot id))
102102

103103
type MONAD (m : type -> type) = {

parser.mly

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,10 @@ atpathexp :
278278
apppathexp :
279279
| dotpathexp
280280
{ $1 }
281-
| apppathexp dotexp
281+
| apppathexp dotpathexp
282282
{ appE($1, $2)@@at() }
283+
| apppathexp attyp
284+
{ appE($1, TypE($2)@@ati 2)@@at() }
283285
| AT attyp atexp
284286
{ rollE($3, $2)@@at() }
285287
| AT name atexp

prelude/index.1ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Alt = {
4848
;;
4949

5050
Opt = {
51-
type t x = Alt.t (type {}) x
51+
type t x = Alt.t {} x
5252
none = Alt.inl ()
5353
some = Alt.inr
5454
case {none, some} = Alt.case {inl () = none, inr = some}

regression.1ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,13 @@ Hungry = {
208208

209209
PolyRec = {
210210
type l a = rec (type t) => a | t
211-
...rec {type t a} => {type t a = a | t (type (a, a))}
211+
...rec {type t a} => {type t a = a | t (a, a)}
212212

213213
t_int = t int
214214

215215
hmm (x: t int) = flip Alt.case (x.@(t int))
216216

217-
t0 = @(t int) (inr (@(t (type (int, int))) (inl (0, 0))))
217+
t0 = @(t int) (inr (@(t (int, int)) (inl (0, 0))))
218218
}
219219

220220
N :> {

talk.1ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type COLL c = {
8282
keys : c ~> list key
8383
}
8484

85-
entries 'c (C : COLL c) xs : list (type (C.key, C.val)) =
85+
entries 'c (C : COLL c) xs : list (C.key, C.val) =
8686
List.map (C.keys xs) (fun k => caseopt (C.lookup xs k) bot (fun v => (k, v)))
8787

8888

0 commit comments

Comments
 (0)