Comments (1)
Things that were most surprising initially to me, which I would highlight:
-
there are 2 type params that describe some result type:
Sealed[F, A, ADT]
-A
andADT
A
is an intermediate result type of sortADT
is like a final result type
-
ADT
is used for handling errors, HOWEVER it is also used as a final result type when exiting theSealed
monad inrun
- therefore while most of the timeADT
can be used for some error-only type, onrun
ADT
is expected to be something which stores both errors and success values -
in a way it makes it similar to
(a: L).tailRecM[R](... : L => F[Either[L, R]])
's parameters whereL
is intermediate result andR
is final result -
however when we are thinking that
Sealed
is similar toEitherT
then we might be surprised becauseEitherT[F, L, R]
flatMaps/maps etc on rightR
value, whileSealed[F, A, ADT]
on leftA
value- to add to confusion method names are borrowed from
EitherT
- to add to confusion method names are borrowed from
-
probably it would make more sense to use examples comparing it to
Result<S, F>
from Rust which has a success as the first and a failure as the second type parameter -
it would also make sense to show that intended usages for
ADT
is something likeenum UserCreationResult: case Success case UserAlreadyExists(details: String) case InvalidEmail(details: String)
which models all allowed outcomes for some business action
- since such enums are
sealed trait
s in Scala 2 it explains theSealed
name, but I haven't been able to make that connection for a long time
- since such enums are
All in all use cases are pretty reasonable BUT do not match Cats conventions and without a proper explanation Cats' users might follow wrong intuitions.
from sealed-monad.
Related Issues (15)
- Add release-drafter
- Add sbt-ci-release
- Add effectful version of `ensure`
- Add `rethrow` to `SealedFAEitherOps`
- Research: decouple sealed-monad from Cats, create integrations for Future and cats.Monad
- `ensure` is missing `ensureF` variant HOT 1
- `inspect` is missing `inspectF`
- `attemptF` - inconsistent type parameter order
- Feature request - add `.void` method
- Add missing method variants: boolean and F-methods
- Add Sealed.unit method
- Add support for Scala.js and Scala Native
- Add mdoc
- Improve documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sealed-monad.