Skip to content

Commit cfac11f

Browse files
committed
Bump to agda-2.8.0
1 parent 149d25f commit cfac11f

File tree

9 files changed

+71
-44
lines changed

9 files changed

+71
-44
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16-
- uses: omelkonian/setup-agda@v2.2
16+
- uses: omelkonian/setup-agda@v2.3
1717
with:
18-
agda-version: 2.7.0.1
19-
stdlib-version: 2.2
20-
libraries: agda/agda-stdlib-classes#v2.2
18+
agda-version: 2.8.0
19+
stdlib-version: 2.3
20+
libraries: agda/agda-stdlib-classes#v2.3
2121
main: standard-library-meta
2222
deploy: ${{ github.ref == 'refs/heads/master' }}
2323
token: ${{ secrets.GITHUB_TOKEN }}

Class/MonadError.agda

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{-# OPTIONS --safe --without-K #-}
22

3-
open import Level
4-
53
open import Meta.Prelude
64

5+
open import Class.Functor
6+
open import Class.Applicative
77
open import Class.Monad
88
open import Reflection using (TC; ErrorPart; typeError; catchTC; strErr)
99

@@ -25,16 +25,35 @@ MonadError-TC .catch x h = catchTC x (h [ strErr "TC doesn't provide which error
2525
ErrorT : (E : Set) (M : {f} Set f Set f) {f} Set f Set f
2626
ErrorT E M A = M (E ⊎ A)
2727

28-
module _ {E : Set} {M : {a} Set a Set a} ⦃ _ : Monad M ⦄ where
28+
import Data.Sum as Sum
29+
30+
module _ {E : Set} {M : {a} Set a Set a} where
31+
32+
Functor-ErrorT : ⦃ _ : Functor M ⦄ Functor (ErrorT E M)
33+
Functor-ErrorT ._<$>_ f = fmap (Sum.map₂ f)
34+
35+
instance _ = Functor-ErrorT
2936

30-
Monad-ErrorT : Monad (ErrorT E M)
37+
Applicative-ErrorT : ⦃ _ : Applicative M ⦄ Applicative (ErrorT E M)
38+
Applicative-ErrorT .pure a = pure (inj₂ a)
39+
Applicative-ErrorT ._<*>_ f x = _<*>_ {F = M} (fmap go f) x
40+
where
41+
go : (E ⊎ (A B)) (E ⊎ A) (E ⊎ B)
42+
go = λ where
43+
(inj₁ e) _ inj₁ e
44+
_ (inj₁ e) inj₁ e
45+
(inj₂ f) (inj₂ a) inj₂ (f a)
46+
47+
instance _ = Applicative-ErrorT
48+
49+
Monad-ErrorT : ⦃ _ : Monad M ⦄ Monad (ErrorT E M)
3150
Monad-ErrorT .return a = return (inj₂ a)
3251
Monad-ErrorT ._>>=_ x f = x >>= λ where
3352
(inj₁ e) return (inj₁ e)
3453
(inj₂ a) f a
3554

36-
MonadError-ErrorT : MonadError E (ErrorT E M)
55+
instance _ = Monad-ErrorT
56+
57+
MonadError-ErrorT : ⦃ _ : Monad M ⦄ MonadError E (ErrorT E M)
3758
MonadError-ErrorT .error e = return (inj₁ e)
38-
MonadError-ErrorT .catch x h = x >>= λ where
39-
(inj₁ e) h e
40-
(inj₂ a) return (inj₂ a)
59+
MonadError-ErrorT .catch x h = x >>= Sum.[ h , return ]

Class/MonadReader.agda

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,50 @@ module Class.MonadReader where
44

55
open import Meta.Prelude
66

7-
open import Class.Monad
7+
open import Class.Core
88
open import Class.Functor
9+
open import Class.Applicative
10+
open import Class.Monad
911
open import Class.MonadError
1012

1113
open MonadError ⦃...⦄
1214

13-
record MonadReader (R : Set ℓ) (M : {a} Set a Set a) ⦃ _ : Monad M ⦄ : Setω where
15+
record MonadReader (R : Set ℓ) (M : Type↑) ⦃ _ : Monad M ⦄ : Setω where
1416
field
1517
ask : M R
1618
local : {a} {A : Set a} (R R) M A M A
1719

1820
reader : {a} {A : Set a} (R A) M A
1921
reader f = f <$> ask
20-
where instance _ = Functor-M
2122

2223
open MonadReader ⦃...⦄
2324

2425
ReaderT : (R : Set) (M : {a} Set a Set a) {a} Set a Set a
2526
ReaderT R M A = R M A
2627

27-
module _ {R : Set} {M : {a} Set a Set a} ⦃ _ : Monad M ⦄ where
28+
module _ {R : Set} {M : {a} Set a Set a} where
29+
30+
Functor-ReaderT : ⦃ Functor M ⦄ Functor (ReaderT R M)
31+
Functor-ReaderT ._<$>_ f ra r = f <$> ra r
32+
33+
instance _ = Functor-ReaderT
34+
35+
Applicative-ReaderT : ⦃ Applicative M ⦄ Applicative (ReaderT R M)
36+
Applicative-ReaderT .pure a = const (pure a)
37+
Applicative-ReaderT ._<*>_ rf ra r = rf r <*> ra r
38+
39+
instance _ = Applicative-ReaderT
40+
41+
Monad-ReaderT : ⦃ Monad M ⦄ Monad (ReaderT R M)
42+
Monad-ReaderT .return a _ = return a
43+
Monad-ReaderT ._>>=_ x f r = x r >>= flip f r
2844

29-
Monad-ReaderT : Monad (ReaderT R M)
30-
Monad-ReaderT .return a = λ r return a
31-
Monad-ReaderT ._>>=_ x f = λ r x r >>= λ a f a r
45+
instance _ = Monad-ReaderT
3246

33-
MonadReader-ReaderT : MonadReader R (ReaderT R M) ⦃ Monad-ReaderT ⦄
34-
MonadReader-ReaderT .ask = λ r return r
47+
MonadReader-ReaderT : ⦃ _ : Monad M ⦄ MonadReader R (ReaderT R M)
48+
MonadReader-ReaderT .ask r = return r
3549
MonadReader-ReaderT .local f x = x ∘ f
3650

3751
MonadError-ReaderT : {e} {E : Set e} ⦃ MonadError E M ⦄ MonadError E (ReaderT R M)
38-
MonadError-ReaderT .error e = λ r error e
39-
MonadError-ReaderT .catch x h = λ r catch (x r) (λ e h e r)
52+
MonadError-ReaderT .error e _ = error e
53+
MonadError-ReaderT .catch x h r = catch (x r) (flip h r)

Class/MonadTC.agda

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ record MonadTC (M : ∀ {f} → Set f → Set f)
9090
runSpeculative : M (A × Bool) M A
9191
getInstances : Meta M (List Term)
9292

93-
instance _ = Functor-M {M = M}
9493
open MonadError me
9594

9695
runAndReset : M A M A
@@ -218,7 +217,6 @@ record MonadTC (M : ∀ {f} → Set f → Set f)
218217
module _ {M : {f} Set f Set f}
219218
⦃ m : Monad M ⦄ ⦃ me : MonadError (List ErrorPart) M ⦄ ⦃ mtc : MonadTC M ⦄ ⦃ mre : MonadReader TCEnv M ⦄ where
220219

221-
instance _ = Functor-M {M = M}
222220
open MonadError me
223221
open MonadTC mtc
224222
open MonadReader mre

Meta/Prelude.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open import Data.Unit public
2121
open import Data.Sum public
2222
hiding (assocʳ; assocˡ; map; map₁; map₂; reduce; swap)
2323
open import Data.Product public
24-
hiding (assocʳ; assocˡ; map; map₁; map₂; swap; zip; zipWith)
24+
hiding (assocʳ; assocˡ; map; map₁; map₂; swap; zip; zipWith; _<*>_)
2525
open import Data.Nat public
2626
hiding (_≟_; _≤_; _≤?_; _<_; _<?_; _≤ᵇ_; _≡ᵇ_)
2727
open import Data.String public

Reflection/TCI.agda

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ TC : Set ℓ → Set ℓ
2424
TC = ReaderT TCEnv R.TC
2525

2626
Monad-TC : Monad TC
27-
Monad-TC = Monad-ReaderT ⦃ Class.Monad.Monad-TC ⦄
27+
Monad-TC = Monad-ReaderT
2828

2929
MonadReader-TC : MonadReader TCEnv TC ⦃ Monad-TC ⦄
30-
MonadReader-TC = MonadReader-ReaderT ⦃ Class.Monad.Monad-TC ⦄
30+
MonadReader-TC = MonadReader-ReaderT
31+
32+
instance _ = Class.MonadError.MonadError-TC
3133

3234
MonadError-TC : MonadError (List ErrorPart) TC
33-
MonadError-TC = MonadError-ReaderT ⦃ Class.Monad.Monad-TC ⦄ ⦃ Class.MonadError.MonadError-TC ⦄
35+
MonadError-TC = MonadError-ReaderT
3436

3537
applyReductionOptions : TC A TC A
3638
applyReductionOptions x r@record { reduction = onlyReduce red } = R'.withReduceDefs (true , red) (x r)

Reflection/Utils/TCI.agda

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ open import Class.DecEq
2121
open import Class.Functor
2222
open import Class.Traversable
2323

24-
instance _ = Functor-M
25-
2624
fresh-level : M Level
2725
fresh-level = newMeta (quote Level ∙) >>= unquoteTC
2826

Tactic/ClauseBuilder.agda

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ singlePatternFromPattern (arg i p) =
9393

9494
module _ {M : {a} Set a Set a} ⦃ _ : Monad M ⦄ ⦃ me : MonadError (List ErrorPart) M ⦄ ⦃ mre : MonadReader TCEnv M ⦄ ⦃ _ : MonadTC M ⦄ where
9595

96-
instance _ = Functor-M {M = M}
97-
9896
ctxSinglePatterns : M (List SinglePattern)
9997
ctxSinglePatterns = do
10098
ctx getContext
@@ -192,17 +190,14 @@ record ContextMonad (M : ∀ {a} → Set a → Set a) ⦃ _ : Monad M ⦄ : Set
192190

193191
open ContextMonad ⦃...⦄
194192

195-
Monad-Id : Monad id
196-
Monad-Id .return = id
197-
Monad-Id ._>>=_ = flip _$_
198-
199193
-- No context
200-
ContextMonad-Id : ContextMonad id ⦃ Monad-Id ⦄
201-
ContextMonad-Id .introPatternM _ a = a
194+
module _ where
195+
open import Class.Monad.Id
202196

203-
module _ {M : {a} Set a Set a} ⦃ _ : Monad M ⦄ ⦃ me : MonadError (List ErrorPart) M ⦄ ⦃ mre : MonadReader TCEnv M ⦄ ⦃ _ : MonadTC M ⦄ where
197+
ContextMonad-Id : ContextMonad id
198+
ContextMonad-Id .introPatternM _ a = a
204199

205-
instance _ = Functor-M {M = M}
200+
module _ {M : {a} Set a Set a} ⦃ _ : Monad M ⦄ ⦃ me : MonadError (List ErrorPart) M ⦄ ⦃ mre : MonadReader TCEnv M ⦄ ⦃ _ : MonadTC M ⦄ where
206201

207202
refineWithSingle : (Term Term) M Term M Term
208203
refineWithSingle ref x = do
@@ -266,8 +261,6 @@ module _ {M : ∀ {a} → Set a → Set a} ⦃ _ : Monad M ⦄ ⦃ me : MonadErr
266261

267262
module ClauseExprM {M : {a} Set a Set a} ⦃ _ : Monad M ⦄ ⦃ _ : ContextMonad M ⦄ where
268263

269-
instance _ = Functor-M {M = M}
270-
271264
-- Construct a ClauseExpr in M and extend the context appropriately
272265
matchExprM : List (SinglePattern × M (ClauseExpr ⊎ Maybe Term)) M ClauseExpr
273266
matchExprM = _<$>_ MatchExpr ∘ traverse (λ (a , b) (a ,_) <$> introPatternM a b)
@@ -321,6 +314,8 @@ clauseTelescope (Clause.clause tel _ _) = tel
321314
clauseTelescope (Clause.absurd-clause tel _) = tel
322315

323316
module _ where
317+
open import Class.Monad.Id
318+
324319
open ClauseExprM ⦃ Monad-Id ⦄ ⦃ ContextMonad-Id ⦄
325320

326321
instanciatePattern : SinglePattern List (Arg Type)

Tactic/Derive.agda

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ open import Meta.Prelude
2323

2424
open import Agda.Builtin.Reflection using () renaming (primShowQName to showName)
2525

26-
import Data.List as L
26+
import Data.Bool.ListAction as L
27+
import Data.List as L hiding (any)
2728
import Data.List.NonEmpty as NE
2829
import Data.String as S
2930
open import Data.Maybe using (fromMaybe)

0 commit comments

Comments
 (0)