-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename the Product type to Pair (#102)
* Closes #101
- Loading branch information
1 parent
73ecbc5
commit b8d8484
Showing
9 changed files
with
31 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 10 additions & 11 deletions
21
Stdlib/Data/Product/Base.juvix → Stdlib/Data/Pair/Base.juvix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
module Stdlib.Data.Product.Base; | ||
module Stdlib.Data.Pair.Base; | ||
|
||
import Stdlib.Data.Fixity open; | ||
|
||
syntax operator × functor; | ||
syntax operator , pair; | ||
|
||
--- Inductive pair. I.e. a tuple with two components. | ||
type × (A B : Type) := , : A → B → A × B; | ||
type Pair (A B : Type) := , : A → B → Pair A B; | ||
|
||
--- Converts a function of two arguments to a function with a product argument. | ||
uncurry {A B C} (f : A -> B -> C) : A × B -> C | ||
uncurry {A B C} (f : A -> B -> C) : Pair A B -> C | ||
| (a, b) := f a b; | ||
|
||
--- Converts a function with a product argument to a function of two arguments. | ||
curry {A B C} (f : A × B -> C) (a : A) (b : B) : C := | ||
curry {A B C} (f : Pair A B -> C) (a : A) (b : B) : C := | ||
f (a, b); | ||
|
||
--- Projects the first component of a tuple. | ||
fst {A B} : A × B → A | ||
fst {A B} : Pair A B → A | ||
| (a, _) := a; | ||
|
||
--- Projects the second component of a tuple. | ||
snd {A B} : A × B → B | ||
snd {A B} : Pair A B → B | ||
| (_, b) := b; | ||
|
||
--- Swaps the components of a tuple. | ||
swap {A B} : A × B → B × A | ||
swap {A B} : Pair A B → Pair B A | ||
| (a, b) := b, a; | ||
|
||
--- Applies a function to the first component. | ||
first {A B A'} (f : A → A') : A × B → A' × B | ||
first {A B A'} (f : A → A') : Pair A B → Pair A' B | ||
| (a, b) := f a, b; | ||
|
||
--- Applies a function to the second component. | ||
second {A B B'} (f : B → B') : A × B → A × B' | ||
second {A B B'} (f : B → B') : Pair A B → Pair A B' | ||
| (a, b) := a, f b; | ||
|
||
--- Applies a function to both components. | ||
both {A B} (f : A → B) : A × A → B × B | ||
both {A B} (f : A → B) : Pair A A → Pair B B | ||
| (a, b) := f a, f b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# This file was autogenerated by Juvix version 0.6.1. | ||
# This file was autogenerated by Juvix version 0.6.2. | ||
# Do not edit this file manually. | ||
|
||
version: 2 | ||
checksum: 5db5ab8aab6fa95f39544dd18cb95ae8a80d88ae261add7801926ac96f7955e6 | ||
checksum: c311ba35a484fb649358719f7720cf706aa8b13d8066bb0fe600ef0d7bc4ca2c | ||
dependencies: | ||
- path: ../ | ||
dependencies: [] | ||
- git: | ||
name: anoma_juvix-quickcheck | ||
ref: d9696bb0c038e12df4a7b736a4030b6940011404 | ||
ref: b6ca4d4bd80d62b95e2d7e28e881c5b547643564 | ||
url: https://github.com/anoma/juvix-quickcheck | ||
dependencies: | ||
- git: | ||
name: anoma_juvix-stdlib | ||
ref: 27f54ef11c3b21cea18c6b00c54b1d4f3b0cb9f8 | ||
ref: 3f2c29880e749c7dd222011527a077b5f5050a95 | ||
url: https://github.com/anoma/juvix-stdlib | ||
dependencies: [] |