Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding missing helper methods, improved docs #256

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
os: [ubuntu-latest]
scala: [2.13, 3]
java: [temurin@11, temurin@17]
project: [rootJS, rootJVM, rootNative]
project: [sealedMonadNative, sealedMonadJS, sealedMonadJVM]
exclude:
- project: rootJS
- project: sealedMonadNative
java: temurin@17
- project: rootNative
- project: sealedMonadJS
java: temurin@17
runs-on: ${{ matrix.os }}
timeout-minutes: 60
Expand Down Expand Up @@ -76,14 +76,14 @@ jobs:
- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- name: scalaJSLink
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult

- name: nativeLink
if: matrix.project == 'rootNative'
if: matrix.project == 'sealedMonadNative'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/nativeLink

- name: scalaJSLink
if: matrix.project == 'sealedMonadJS'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult

- name: Test
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test

Expand All @@ -97,11 +97,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
run: mkdir -p sealedmonad/.native/target sealedmonad/.jvm/target sealedmonad/.js/target project/target
run: mkdir -p sealedmonad/.native/target sealedmonad/.js/target sealedmonad/.jvm/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
run: tar cf targets.tar sealedmonad/.native/target sealedmonad/.jvm/target sealedmonad/.js/target project/target
run: tar cf targets.tar sealedmonad/.native/target sealedmonad/.js/target sealedmonad/.jvm/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
Expand Down Expand Up @@ -154,62 +154,62 @@ jobs:
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Download target directories (2.13, rootJS)
- name: Download target directories (2.13, sealedMonadNative)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-sealedMonadNative

- name: Inflate target directories (2.13, rootJS)
- name: Inflate target directories (2.13, sealedMonadNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13, rootJVM)
- name: Download target directories (2.13, sealedMonadJS)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-sealedMonadJS

- name: Inflate target directories (2.13, rootJVM)
- name: Inflate target directories (2.13, sealedMonadJS)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13, rootNative)
- name: Download target directories (2.13, sealedMonadJVM)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-sealedMonadJVM

- name: Inflate target directories (2.13, rootNative)
- name: Inflate target directories (2.13, sealedMonadJVM)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (3, rootJS)
- name: Download target directories (3, sealedMonadNative)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3-sealedMonadNative

- name: Inflate target directories (3, rootJS)
- name: Inflate target directories (3, sealedMonadNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (3, rootJVM)
- name: Download target directories (3, sealedMonadJS)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3-sealedMonadJS

- name: Inflate target directories (3, rootJVM)
- name: Inflate target directories (3, sealedMonadJS)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (3, rootNative)
- name: Download target directories (3, sealedMonadJVM)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative
name: target-${{ matrix.os }}-${{ matrix.java }}-3-sealedMonadJVM

- name: Inflate target directories (3, rootNative)
- name: Inflate target directories (3, sealedMonadJVM)
run: |
tar xf targets.tar
rm targets.tar
Expand Down Expand Up @@ -284,5 +284,5 @@ jobs:
- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: root_2.13 root_3 rootjs_2.13 rootjs_3 rootjvm_2.13 rootjvm_3 rootnative_2.13 rootnative_3
modules-ignore: sealedmonadnative_2.13 sealedmonadnative_3 sealedmonad_2.13 sealedmonad_3 sealedmonadjs_2.13 sealedmonadjs_3 sealedmonadjvm_2.13 sealedmonadjvm_3
configs-ignore: test scala-tool scala-doc-tool test-internal
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SealedPrograms {
def benchmark2 = {
val s = for {
m <- returnOption.valueOr(SomeCase)
_ <- doSomeOtherWork(m).valueOr(SomeOtherCase) >>! (s => M.pure(m + s.toInt))
_ <- doSomeOtherWork(m).valueOr(SomeOtherCase).flatTap(s => M.pure(m + s.toInt))
} yield Result(m)

s.run
Expand Down
13 changes: 7 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ lazy val noPublishSettings =

lazy val examples = project
.in(file("examples"))
.dependsOn(sealedMonad.jvm % "test->test;compile->compile")
.dependsOn(core.jvm % "test->test;compile->compile")
.settings(baseSettings *)
.settings(noPublishSettings *)
.settings(
Expand All @@ -104,7 +104,7 @@ lazy val examples = project

lazy val docs = project
.in(file("sealed-docs"))
.dependsOn(sealedMonad.jvm % "test->test;compile->compile")
.dependsOn(core.jvm % "test->test;compile->compile")
.enablePlugins(MdocPlugin, DocusaurusPlugin)
.settings(baseSettings *)
.settings(noPublishSettings *)
Expand All @@ -121,7 +121,7 @@ lazy val docs = project

lazy val benchmarks = project
.in(file("benchmarks"))
.dependsOn(sealedMonad.jvm % "test->test;compile->compile")
.dependsOn(core.jvm % "test->test;compile->compile")
.enablePlugins(JmhPlugin)
.settings(baseSettings *)
.settings(noPublishSettings *)
Expand All @@ -133,7 +133,7 @@ lazy val benchmarks = project

addCommandAlias("flame", "benchmarks/jmh:run -p tokens=64 -prof jmh.extras.Async:dir=target/flamegraphs;flameGraphOpts=--width,1900")

lazy val sealedMonad = crossProject(JSPlatform, JVMPlatform, NativePlatform)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("sealedmonad"))
Expand All @@ -144,5 +144,6 @@ lazy val sealedMonad = crossProject(JSPlatform, JVMPlatform, NativePlatform)
description := "Scala library for nice for-comprehension-style error handling"
)

lazy val root = tlCrossRootProject.aggregate(sealedMonad, benchmarks, docs, examples)
.settings(baseSettings *)
lazy val sealedMonad = tlCrossRootProject
.aggregate(core, benchmarks, docs, examples)
.settings(baseSettings *)
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ object Options {
): M[ConfirmResponse] = {
val s = for {
method <- findAuthMethod(token).valueOr[ConfirmResponse](ConfirmResponse.MethodNotFound)
user <- findUser(method.userId).valueOr[ConfirmResponse](ConfirmResponse.UserNotFound) ! upsertAuthMethod(confirmMethod(method))
user <- findUser(method.userId)
.valueOr[ConfirmResponse](ConfirmResponse.UserNotFound)
.flatTap(_ => upsertAuthMethod(confirmMethod(method)))
} yield ConfirmResponse.Confirmed(issueTokenFor(user))

s.run
Expand Down
Loading
Loading