Comments (8)
+1 for option 2
from cats.
-Or
requires backticks. ๐\Or
requires backticks and a double . ๐- The L and R suffix on various types in scalaz-stream have never made me flinch.
- Let's hold onto Eenie and Meenie in case we make an Or4 so we can have Miney and Mo. :)
- Lifting from Scalaz bootstraps us faster and reduces the cognitive overhead for transitioning users, with the downside mentioned by @stew. I am neutral on this subject.
from cats.
I'll throw in my 2 cents.
- I'd vote for something like
LeftOr
/RightOr
,Lefty
/Righty
, etc. These are only slightly more verbose thanLOr
/ROr
, and I think they would be way easier for someone new to the library to recognize. I'd propose that we don't do something likeGood
/Bad
. I say this because just last week I had two separate people tell me that they were thinking about using a disjunction but the left side wasn't going to be an error and they wanted to know if that was a bad idea. In my opinion that's a perfectly valid usage that I wouldn't want to discourage. - I don't have strong feelings on this.
- Scalaz is a great library, but I don't think blindly lifting things from it is a great approach. I like the idea of questioning some design decisions, etc. I think it would be good to set up a list of principles/guidelines that direct decisions/implementations if possible.
from cats.
- I think I like
LeftOr
andRightOr
for now. Maybe we should try that and see how it feels? - I like the idea of encouraging people to use factory constructors to end up with the "right" types. But I think leaving public constructors can help make pattern matching more efficient, so I guess I'm leaning in that direction. We could put the case classes inside the companion to make them slightly less accessible if we wanted.
- I think @travisbrown summed up my position pretty well in gitter: we should subject code from Scalaz to the same review process as anything else. In other words, we shouldn't blindly copy stuff over, but if there is a design that works we can definitely include it.
However I would like to be intentional about names, comments, and trying to keep things as modular as possible. I would encourage us to consider dropping methods that we aren't sure are needed -- we can easily add them back later. Let's not bring in the kitchen sink if we don't have to.
Anyway, just my 2ยข.
from cats.
๐ to LeftOr
and RightOr
(and a stronger ๐ to Bad
/ Good
or anything else that suggests an asymmetry beyond right-biasing).
I actually like the unpleasantness of -\/
and \/-
in Scalaz, since it's a reminder that using them should require special justification. I can see the argument against them, though, and the redundancy / verbosity of LeftOr
and RightOr
could play kind of the same role (especially if they're in the companion object).
from cats.
I like LeftOr
and RightOr
but I would prefer they are defined in the companion object to limit their usage.
from cats.
I agree with the above. I'll rebuild this from a clean buffer as with LeftOr and RightOr and resubmit to for further conversation. It's a well-understood type, so it's a good one to help establish the principles and guidelines that @ceedubs mentions. Some specifics, while we're setting precedents:
- Monomorphic
this match
vs. polymorphism. A few people have or recall benchmarks that suggest monomorphism is more efficient, but @mpilquist points out that polymorphism permits more specific return types where applicable. - Do we echo the Scalaz Functions and Instances trait structure, or do they all just go right onto the companion object?
- Subclasses in the companion object, or alongside, or it depends?
from cats.
Here's my feelings on this:
- I would leave this to the author's discretion. I think there are too many variables here to make a general rule -- there are cases where more specific return types are important or essential, there may be cases where performance differs, etc. In this case I think matching is fine.
- In algebra we separated out the functions (so they could be included in other companions too) but did not separate out functions. Previously my vague preference has been to leave things in the companion (except when hacking around implicit precedence). What do you all think?
- I think it depends. In this case I would say we should put them in the companion to discourage use, but I can imagine other cases where this wouldn't be true. Maybe in the companion should be the default location, without being a requirement?
from cats.
Related Issues (20)
- IndexedStateT has superfluous parts HOT 4
- .splitWhen
- Difference in the Applicative inferred for Seq[Seq[?]]#sequence between Scala 2 and 3
- Inconsistent behaviour when using Eval as Applicative
- `Tuple1SemigroupalOps` methods have different names from other `TupleNSemigroupalOps` classes HOT 3
- Instances for Currency HOT 7
- EitherT[Option, ?, ?]] can't be used as a bifunctor HOT 5
- trait EuclidianRing should not be a Ring HOT 4
- OutOfMemoryError when IO.uncancelable is used in recursive function HOT 1
- ambiguous implicit resolution of `Show.ContravariantShow[immutable.SortedMap[K, V]]` HOT 1
- Should Monad extend Defer? HOT 11
- Support Scala Native 0.5 HOT 3
- Adding an alternative version of the method whenA with a different signature
- `Eval` thread safety HOT 4
- Optimize `distinct`/`distinctBy` implementations for non-empty collections
- [PROPOSAL] Aliases for methods `traverse_` and `sequence_` HOT 7
- Any reason `intercalate` isn't exposed directly on the `Semigroup` companion object? HOT 3
- (very breaking) change in Future instances? HOT 5
- Reveal internal but public identifiers and make them `private[cats]`
- Cats Order needs an `orElseBy` combinator HOT 8
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 cats.