Skip to content

Commit c5d4fcd

Browse files
authored
CI: set bundled stdlib to the PR branch commit (#161)
* Now the CI checks out the PR branch commit for the bundled stdlib before building the Juvix compiler. This solves the problem of having different incompatible versions of the standard library during tests. * Reformats the standard library.
1 parent 14b562e commit c5d4fcd

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ jobs:
2828
with:
2929
repository: anoma/juvix
3030
path: juvix
31-
submodules: true
31+
submodules: false
32+
33+
- name: Set bundled stdlib to PR branch commit
34+
run: |
35+
cd juvix
36+
git submodule update --init --recursive
37+
cd juvix-stdlib
38+
git checkout $GITHUB_SHA || git checkout ${{ github.event.pull_request.head.sha }}
3239
3340
- name: install LLVM
3441
run: |
@@ -46,7 +53,7 @@ jobs:
4653
working-directory: juvix
4754
test: false
4855
fast: false
49-
56+
5057
- name: Install Juvix
5158
run: |
5259
cd juvix
@@ -55,7 +62,7 @@ jobs:
5562
5663
- name: Checkout Std Library
5764
uses: actions/checkout@v3
58-
65+
5966
- name : Typecheck library code
6067
run : make check
6168

Stdlib/Data/List.juvix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,7 @@ traversableListI : Traversable List :=
105105
mkTraversable@{
106106
terminating
107107
sequenceA
108-
{F : Type -> Type}
109-
{{Applicative F}}
110-
{A}
111-
(xs : List (F A))
112-
: F (List A) :=
108+
{F : Type -> Type} {{Applicative F}} {A} (xs : List (F A)) : F (List A) :=
113109
case xs of
114110
| nil := pure nil
115111
| x :: xs := liftA2 (::) x (sequenceA xs);

Stdlib/Data/Set.juvix

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,7 @@ open Internal;
138138
--- Ord A, Ord K and fun must be compatible. i.e cmp_k (fun a1) (fun a2) == cmp_a a1 a2
139139
{-# specialize: [1, 2] #-}
140140
lookupWith
141-
{A K}
142-
{{order : Ord K}}
143-
(fun : A -> K)
144-
(elem : K)
145-
(set : Set A)
146-
: Maybe A :=
141+
{A K} {{order : Ord K}} (fun : A -> K) (elem : K) (set : Set A) : Maybe A :=
147142
let
148143
{-# specialize-by: [order, fun] #-}
149144
go : Set A -> Maybe A
@@ -172,12 +167,7 @@ isMember {A} {{Ord A}} (elem : A) (set : Set A) : Bool :=
172167
--- where == comes from Ord a.
173168
{-# specialize: [1, 2] #-}
174169
insertWith
175-
{A}
176-
{{order : Ord A}}
177-
(fun : A -> A -> A)
178-
(elem : A)
179-
(set : Set A)
180-
: Set A :=
170+
{A} {{order : Ord A}} (fun : A -> A -> A) (elem : A) (set : Set A) : Set A :=
181171
let
182172
{-# specialize-by: [order, fun] #-}
183173
go : Set A -> Set A
@@ -235,8 +225,7 @@ deleteWith
235225

236226
--- 𝒪(log 𝓃). Removes `elem` from `set`.
237227
{-# specialize: [1] #-}
238-
delete {A} {{Ord A}} (elem : A) (set : Set A) : Set A :=
239-
deleteWith id elem set;
228+
delete {A} {{Ord A}} (elem : A) (set : Set A) : Set A := deleteWith id elem set;
240229

241230
--- 𝒪(log 𝓃). Returns the minimum element of `set`.
242231
lookupMin {A} : (set : Set A) -> Maybe A
@@ -309,8 +298,7 @@ instance
309298
polymorphicFoldableSetI : Polymorphic.Foldable Set :=
310299
Polymorphic.mkFoldable@{
311300
{-# inline: true #-}
312-
for {A B} (f : B -> A -> B) (acc : B) (set : Set A) : B :=
313-
foldl f acc set;
301+
for {A B} (f : B -> A -> B) (acc : B) (set : Set A) : B := foldl f acc set;
314302
{-# inline: true #-}
315303
rfor {A B} (f : B -> A -> B) (acc : B) (set : Set A) : B :=
316304
foldr (flip f) acc set;
@@ -423,11 +411,7 @@ filter {A} {{Ord A}} (predicate : A -> Bool) (set : Set A) : Set A :=
423411

424412
syntax iterator partition {init := 0; range := 1};
425413
partition
426-
{A}
427-
{{Ord A}}
428-
(predicate : A -> Bool)
429-
(set : Set A)
430-
: Pair (Set A) (Set A) :=
414+
{A} {{Ord A}} (predicate : A -> Bool) (set : Set A) : Pair (Set A) (Set A) :=
431415
for (trueSet, falseSet := empty, empty) (x in set) {
432416
if
433417
| predicate x := insert x trueSet, falseSet

0 commit comments

Comments
 (0)