-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(new validation) Adds a function to aggregate lists of validations (#71)
This closes #71.
- Loading branch information
1 parent
6f59f61
commit a677e96
Showing
3 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//---------------------------------------------------------------------- | ||
// | ||
// This source file is part of the Folktale project. | ||
// | ||
// Licensed under MIT. See LICENCE for full licence information. | ||
// See CONTRIBUTORS for the list of contributors to the project. | ||
// | ||
//---------------------------------------------------------------------- | ||
|
||
|
||
const { Success } = require('./validation'); | ||
|
||
|
||
/*~ | ||
* stability: experimental | ||
* type: | | ||
* forall a, b: (Array (Validation a b)) => Validation a b | ||
* where a is Semigroup | ||
*/ | ||
const collect = (validations) => | ||
validations.reduce((a, b) => a.concat(b), Success()); | ||
|
||
|
||
module.exports = collect; |
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