dry-monads 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +10 -39
- data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +10 -0
- data/.github/ISSUE_TEMPLATE/---bug-report.md +34 -0
- data/.github/ISSUE_TEMPLATE/---feature-request.md +18 -0
- data/.github/workflows/ci.yml +74 -0
- data/.github/workflows/docsite.yml +34 -0
- data/.github/workflows/sync_configs.yml +34 -0
- data/.rspec +1 -0
- data/.rubocop.yml +89 -0
- data/CHANGELOG.md +21 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +4 -4
- data/Gemfile +4 -1
- data/LICENSE +17 -17
- data/README.md +2 -2
- data/docsite/source/case-equality.html.md +42 -0
- data/docsite/source/do-notation.html.md +207 -0
- data/docsite/source/getting-started.html.md +142 -0
- data/docsite/source/index.html.md +179 -0
- data/docsite/source/list.html.md +87 -0
- data/docsite/source/maybe.html.md +146 -0
- data/docsite/source/pattern-matching.html.md +68 -0
- data/docsite/source/result.html.md +190 -0
- data/docsite/source/task.html.md +126 -0
- data/docsite/source/tracing-failures.html.md +32 -0
- data/docsite/source/try.html.md +76 -0
- data/docsite/source/unit.html.md +36 -0
- data/docsite/source/validated.html.md +88 -0
- data/lib/dry/monads.rb +1 -0
- data/lib/dry/monads/{undefined.rb → constants.rb} +3 -1
- data/lib/dry/monads/do.rb +2 -1
- data/lib/dry/monads/do/all.rb +2 -2
- data/lib/dry/monads/do/mixin.rb +2 -3
- data/lib/dry/monads/maybe.rb +2 -4
- data/lib/dry/monads/result.rb +1 -1
- data/lib/dry/monads/right_biased.rb +52 -7
- data/lib/dry/monads/validated.rb +1 -1
- data/lib/dry/monads/version.rb +1 -1
- metadata +25 -5
- data/.travis.yml +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f54a2d70bd196bdb08cc35bb339744c29f9006b01802e4d30b6365d0494812eb
|
4
|
+
data.tar.gz: 9d8ba396be69616e0091a85505a1514089cd62569ad858990e3c6af1f05fb2c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ecbcd466aa5192858a1a5c9f5337e067e2ab12164fcf6cc4d2409bbdf3d8173587ca98278f896f1aede291e04d2b41ee38c8a4325f256615655ad8772050352
|
7
|
+
data.tar.gz: cbbbf5179a3176c5ab7abae370683c4c0a00df807cfb8a17591e2f2c35214c1e4eccc69f3baca491fb883c5605ad7af9fd3fe0c2c6bedf60e1183da6aaa84bfa
|
data/.codeclimate.yml
CHANGED
@@ -1,41 +1,12 @@
|
|
1
|
-
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
version: "2"
|
4
|
+
|
5
|
+
exclude_patterns:
|
6
|
+
- "benchmarks/"
|
7
|
+
- "examples/"
|
8
|
+
- "spec/"
|
9
|
+
|
10
|
+
plugins:
|
2
11
|
rubocop:
|
3
12
|
enabled: true
|
4
|
-
checks:
|
5
|
-
Rubocop/Style/Documentation:
|
6
|
-
enabled: false
|
7
|
-
Rubocop/Style/StringLiterals:
|
8
|
-
enabled: false
|
9
|
-
Rubocop/Style/MethodName:
|
10
|
-
enabled: false
|
11
|
-
Rubocop/Style/LambdaCall:
|
12
|
-
enabled: false
|
13
|
-
Rubocop/Style/StabbyLambdaParentheses:
|
14
|
-
enabled: false
|
15
|
-
Rubocop/Style/NestedParenthesizedCalls:
|
16
|
-
enabled: false
|
17
|
-
Rubocop/Style/MultilineBlockChain:
|
18
|
-
enabled: false
|
19
|
-
Rubocop/Style/GuardClause:
|
20
|
-
enabled: false
|
21
|
-
Rubocop/Metrics/LineLength:
|
22
|
-
enabled: true
|
23
|
-
max: 110
|
24
|
-
Rubocop/Style/FileName:
|
25
|
-
enabled: true
|
26
|
-
exclude:
|
27
|
-
- 'lib/dry-monads.rb'
|
28
|
-
Rubocop/Lint/Debugger:
|
29
|
-
enabled: true
|
30
|
-
exclude:
|
31
|
-
- 'bin/console'
|
32
|
-
Rubocop/Lint/HandleExceptions:
|
33
|
-
enabled: true
|
34
|
-
exclude:
|
35
|
-
- 'spec/spec_helper.rb'
|
36
|
-
ratings:
|
37
|
-
paths:
|
38
|
-
- lib/**/*.rb
|
39
|
-
exclude_paths:
|
40
|
-
- spec/**/*
|
41
|
-
- examples/**/*
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
name: "\U0001F41B Bug report"
|
3
|
+
about: See CONTRIBUTING.md for more information
|
4
|
+
title: ''
|
5
|
+
labels: bug
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Before you submit this: WE ONLY ACCEPT BUG REPORTS AND FEATURE REQUESTS**
|
11
|
+
|
12
|
+
For more information see [our contribution guidelines](https://github.com/rom-rb/rom/blob/master/CONTRIBUTING.md)
|
13
|
+
|
14
|
+
**Before you report**
|
15
|
+
|
16
|
+
:warning: If you have a problem related to a schema, please **report it under [dry-schema issues](https://github.com/dry-rb/dry-schema/issues/new?assignees=&labels=bug&template=---bug-report.md&title=)** instead.
|
17
|
+
|
18
|
+
**Describe the bug**
|
19
|
+
|
20
|
+
A clear and concise description of what the bug is.
|
21
|
+
|
22
|
+
**To Reproduce**
|
23
|
+
|
24
|
+
Provide detailed steps to reproduce, an executable script would be best.
|
25
|
+
|
26
|
+
**Expected behavior**
|
27
|
+
|
28
|
+
A clear and concise description of what you expected to happen.
|
29
|
+
|
30
|
+
**Your environment**
|
31
|
+
|
32
|
+
- Affects my production application: **YES/NO**
|
33
|
+
- Ruby version: ...
|
34
|
+
- OS: ...
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
name: "\U0001F6E0 Feature request"
|
3
|
+
about: See CONTRIBUTING.md for more information
|
4
|
+
title: ''
|
5
|
+
labels: feature
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
Summary of what the feature is supposed to do.
|
11
|
+
|
12
|
+
## Examples
|
13
|
+
|
14
|
+
Code examples showing how the feature could be used.
|
15
|
+
|
16
|
+
## Resources
|
17
|
+
|
18
|
+
Additional information, like a link to the discussion forum thread where the feature was discussed etc.
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
name: ci
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
paths:
|
8
|
+
- .github/workflows/ci.yml
|
9
|
+
- lib/**
|
10
|
+
- spec/**
|
11
|
+
- Gemfile
|
12
|
+
- "*.gemspec"
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
tests-mri:
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
strategy:
|
18
|
+
fail-fast: false
|
19
|
+
matrix:
|
20
|
+
ruby: ["2.6.x", "2.5.x", "2.4.x"]
|
21
|
+
include:
|
22
|
+
- ruby: "2.6.x"
|
23
|
+
coverage: "true"
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v1
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: actions/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{matrix.ruby}}
|
30
|
+
- name: Download test reporter
|
31
|
+
if: "matrix.coverage == 'true'"
|
32
|
+
run: |
|
33
|
+
mkdir -p tmp/
|
34
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
|
35
|
+
chmod +x ./tmp/cc-test-reporter
|
36
|
+
./tmp/cc-test-reporter before-build
|
37
|
+
- name: Run all tests
|
38
|
+
env:
|
39
|
+
COVERAGE: ${{matrix.coverage}}
|
40
|
+
run: |
|
41
|
+
gem install bundler
|
42
|
+
bundle install --jobs 4 --retry 3 --without tools docs benchmarks
|
43
|
+
bundle exec rake
|
44
|
+
- name: Send coverage results
|
45
|
+
if: "matrix.coverage == 'true'"
|
46
|
+
env:
|
47
|
+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
|
48
|
+
GIT_COMMIT_SHA: ${{github.sha}}
|
49
|
+
GIT_BRANCH: ${{github.ref}}
|
50
|
+
GIT_COMMITTED_AT: ${{github.event.head_commit.timestamp}}
|
51
|
+
run: |
|
52
|
+
GIT_BRANCH=`ruby -e "puts ENV['GITHUB_REF'].split('/', 3).last"` \
|
53
|
+
GIT_COMMITTED_AT=`ruby -r time -e "puts Time.iso8601(ENV['GIT_COMMITTED_AT']).to_i"` \
|
54
|
+
./tmp/cc-test-reporter after-build
|
55
|
+
|
56
|
+
tests-others:
|
57
|
+
runs-on: ubuntu-latest
|
58
|
+
strategy:
|
59
|
+
fail-fast: false
|
60
|
+
matrix:
|
61
|
+
image: ["jruby:9.2.8", "ruby:rc"]
|
62
|
+
container:
|
63
|
+
image: ${{matrix.image}}
|
64
|
+
steps:
|
65
|
+
- uses: actions/checkout@v1
|
66
|
+
- name: Install git
|
67
|
+
run: |
|
68
|
+
apt-get update
|
69
|
+
apt-get install -y --no-install-recommends git
|
70
|
+
- name: Run all tests
|
71
|
+
run: |
|
72
|
+
gem install bundler
|
73
|
+
bundle install --jobs 4 --retry 3 --without tools docs benchmarks
|
74
|
+
bundle exec rspec
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
name: docsite
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
paths:
|
8
|
+
- docsite/**
|
9
|
+
- .github/workflows/docsite.yml
|
10
|
+
branches:
|
11
|
+
- master
|
12
|
+
- release-**
|
13
|
+
tags:
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
update-docs:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v1
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: actions/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: "2.6.x"
|
24
|
+
- name: Install dependencies
|
25
|
+
run: |
|
26
|
+
gem install bundler
|
27
|
+
bundle install --jobs 4 --retry 3 --without benchmarks sql
|
28
|
+
- name: Symlink ossy
|
29
|
+
run: mkdir -p bin && ln -sf "$(bundle show ossy)/bin/ossy" bin/ossy
|
30
|
+
- name: Trigger dry-rb.org deploy
|
31
|
+
env:
|
32
|
+
GITHUB_LOGIN: dry-bot
|
33
|
+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
34
|
+
run: bin/ossy github workflow dry-rb/dry-rb.org ci
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
name: sync_configs
|
4
|
+
|
5
|
+
on:
|
6
|
+
repository_dispatch:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
sync-configs:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
if: github.event.action == 'sync_configs'
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v1
|
14
|
+
- name: Update configuration files from devtools
|
15
|
+
env:
|
16
|
+
GITHUB_LOGIN: dry-bot
|
17
|
+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
18
|
+
run: |
|
19
|
+
git clone https://github.com/dry-rb/devtools.git tmp/devtools
|
20
|
+
|
21
|
+
if [ -f ".github/workflows/custom_ci.yml" ]; then
|
22
|
+
rsync -av --exclude '.github/workflows/ci.yml' tmp/devtools/shared/ . ;
|
23
|
+
else
|
24
|
+
rsync -av tmp/devtools/shared/ . ;
|
25
|
+
fi
|
26
|
+
|
27
|
+
git config --local user.email "dry-bot@dry-rb.org"
|
28
|
+
git config --local user.name "dry-bot"
|
29
|
+
git add -A
|
30
|
+
git commit -m "[devtools] config sync" || echo "nothing changed"
|
31
|
+
- name: Push changes
|
32
|
+
uses: ad-m/github-push-action@master
|
33
|
+
with:
|
34
|
+
github_token: ${{ secrets.GH_PAT }}
|
data/.rspec
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.4
|
5
|
+
|
6
|
+
Style/EachWithObject:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Style/StringLiterals:
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: single_quotes
|
12
|
+
|
13
|
+
Style/Alias:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/LambdaCall:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/StabbyLambdaParentheses:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/FormatString:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Layout/SpaceInLambdaLiteral:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Layout/MultilineMethodCallIndentation:
|
32
|
+
Enabled: true
|
33
|
+
EnforcedStyle: indented
|
34
|
+
|
35
|
+
Metrics/LineLength:
|
36
|
+
Max: 100
|
37
|
+
|
38
|
+
Metrics/MethodLength:
|
39
|
+
Max: 22
|
40
|
+
|
41
|
+
Metrics/ClassLength:
|
42
|
+
Max: 150
|
43
|
+
|
44
|
+
Metrics/AbcSize:
|
45
|
+
Max: 20
|
46
|
+
|
47
|
+
Metrics/BlockLength:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Metrics/CyclomaticComplexity:
|
51
|
+
Enabled: true
|
52
|
+
Max: 10
|
53
|
+
|
54
|
+
Lint/BooleanSymbol:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/AccessModifierDeclarations:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/BlockDelimiters:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Layout/IndentFirstArrayElement:
|
64
|
+
EnforcedStyle: consistent
|
65
|
+
|
66
|
+
Style/ClassAndModuleChildren:
|
67
|
+
Exclude:
|
68
|
+
- "spec/**/*_spec.rb"
|
69
|
+
|
70
|
+
Lint/HandleExceptions:
|
71
|
+
Exclude:
|
72
|
+
- "spec/spec_helper.rb"
|
73
|
+
|
74
|
+
Naming/FileName:
|
75
|
+
Exclude:
|
76
|
+
- "lib/dry-*.rb"
|
77
|
+
|
78
|
+
Style/SymbolArray:
|
79
|
+
Exclude:
|
80
|
+
- "spec/**/*_spec.rb"
|
81
|
+
|
82
|
+
Style/ConditionalAssignment:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Naming/MethodName:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Style/AsciiComments:
|
89
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# v1.3.2 2019-11-30
|
2
|
+
|
3
|
+
## Fixed
|
4
|
+
|
5
|
+
- Warnings about keywords from Ruby 2.7 (flash-gordon)
|
6
|
+
|
7
|
+
## Added
|
8
|
+
|
9
|
+
- Pattern matching syntax was improved by implementing `#deconstruct_keys`. Now curly braces aren't necessary when the wrapped value is a Hash (flash-gordon)
|
10
|
+
```ruby
|
11
|
+
case result
|
12
|
+
in Success(code: 200...300) then :ok
|
13
|
+
end
|
14
|
+
```
|
15
|
+
|
16
|
+
## Internal
|
17
|
+
|
18
|
+
- Performance of do notation was improved for failing cases (1.2x to 1.3x on synthetic benchmarks) (flash-gordon)
|
19
|
+
|
20
|
+
[Compare v1.3.1...v1.3.2](https://github.com/dry-rb/dry-monads/compare/v1.3.1...v1.3.2)
|
21
|
+
|
1
22
|
# v1.3.1 2019-09-07
|
2
23
|
|
3
24
|
## Fixed
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.4.0, available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct)
|
data/CONTRIBUTING.md
CHANGED
@@ -6,11 +6,11 @@ If you found a bug, report an issue and describe what's the expected behavior ve
|
|
6
6
|
|
7
7
|
## Reporting feature requests
|
8
8
|
|
9
|
-
Report a feature request **only after
|
9
|
+
Report a feature request **only after discussing it first on [discourse.dry-rb.org](https://discourse.dry-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
|
10
10
|
|
11
11
|
## Reporting questions, support requests, ideas, concerns etc.
|
12
12
|
|
13
|
-
**PLEASE DON'T** - use [discourse.dry-rb.org](
|
13
|
+
**PLEASE DON'T** - use [discourse.dry-rb.org](http://discourse.dry-rb.org) instead.
|
14
14
|
|
15
15
|
# Pull Request Guidelines
|
16
16
|
|
@@ -22,8 +22,8 @@ Other requirements:
|
|
22
22
|
2) Follow the style conventions of the surrounding code. In most cases, this is standard ruby style.
|
23
23
|
3) Add API documentation if it's a new feature
|
24
24
|
4) Update API documentation if it changes an existing feature
|
25
|
-
5) Bonus points for sending a PR to [github.com/dry-rb/dry-rb.org](
|
25
|
+
5) Bonus points for sending a PR to [github.com/dry-rb/dry-rb.org](github.com/dry-rb/dry-rb.org) which updates user documentation and guides
|
26
26
|
|
27
27
|
# Asking for help
|
28
28
|
|
29
|
-
If these guidelines aren't helpful, and you're stuck, please post a message on [discourse.dry-rb.org](https://discourse.dry-rb.org).
|
29
|
+
If these guidelines aren't helpful, and you're stuck, please post a message on [discourse.dry-rb.org](https://discourse.dry-rb.org) or join [our chat](https://dry-rb.zulipchat.com).
|
data/Gemfile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
3
5
|
gemspec
|
4
6
|
|
5
7
|
group :test do
|
6
|
-
gem 'codeclimate-test-reporter', require: false
|
7
8
|
gem 'simplecov', require: false
|
8
9
|
gem 'warning'
|
9
10
|
end
|
@@ -11,6 +12,8 @@ end
|
|
11
12
|
group :tools do
|
12
13
|
gem 'pry-byebug', platform: :mri
|
13
14
|
gem 'pry', platform: :jruby
|
15
|
+
gem 'ossy', github: 'solnic/ossy', branch: 'master'
|
16
|
+
gem 'benchmark-ips'
|
14
17
|
end
|
15
18
|
|
16
19
|
group :docs do
|