Skip to content

Commit e5e75de

Browse files
authored
[ fix ] Generalise some types in Vec.Relation.Unary.AllPairs (#1398)
1 parent 84dcc85 commit e5e75de

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Bug-fixes
3030
* In `IO`, ``-returning functions (such as `putStrLn`) have been made level polymorphic.
3131
This may force you to add more type or level annotations to your programs.
3232

33+
* Generalised the types of `Data.Vec.Relation.Unary.AllPairs`'s `head`, `tail`, `uncons`
34+
so that the vector talked about does not need to be cons-headed.
35+
3336
Non-backwards compatible changes
3437
--------------------------------
3538

src/Data/Vec/Relation/Unary/AllPairs.agda

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ open import Relation.Binary using (Rel)
1111
module Data.Vec.Relation.Unary.AllPairs
1212
{a ℓ} {A : Set a} {R : Rel A ℓ} where
1313

14-
open import Data.Vec.Base using (Vec; []; _∷_)
14+
open import Data.Nat.Base using (suc)
15+
open import Data.Vec.Base as Vec using (Vec; []; _∷_)
1516
open import Data.Vec.Relation.Unary.All as All using (All; []; _∷_)
1617
open import Data.Product as Prod using (_,_; _×_; uncurry; <_,_>)
1718
open import Function using (id; _∘_)
@@ -32,13 +33,14 @@ open import Data.Vec.Relation.Unary.AllPairs.Core public
3233
------------------------------------------------------------------------
3334
-- Operations
3435

35-
head : {x n} {xs : Vec A n} AllPairs R (x ∷ xs) All (R x) xs
36+
head : {n} {xs : Vec A (suc n)} AllPairs R xs All (R (Vec.head xs)) (Vec.tail xs)
3637
head (px ∷ pxs) = px
3738

38-
tail : {x n} {xs : Vec A n} AllPairs R (x ∷ xs) AllPairs R xs
39+
tail : {n} {xs : Vec A (suc n)} AllPairs R xs AllPairs R (Vec.tail xs)
3940
tail (px ∷ pxs) = pxs
4041

41-
uncons : {x n} {xs : Vec A n} AllPairs R (x ∷ xs) All (R x) xs × AllPairs R xs
42+
uncons : {n} {xs : Vec A (suc n)} AllPairs R xs
43+
All (R (Vec.head xs)) (Vec.tail xs) × AllPairs R (Vec.tail xs)
4244
uncons = < head , tail >
4345

4446
module _ {s} {S : Rel A s} where

0 commit comments

Comments
 (0)