You always care about the asymptotic properties of your data structures. So there is never a case where Seq makes sense, even as a concept!
-
-
Replying to @djspiewak @LukaJacobowitz
In the case of map, flatMap, filter and foldLeft the complexity is the same for List and Vector, and you can solve a lot of problems with just these operations.
2 replies 0 retweets 3 likes -
Replying to @julienrf @LukaJacobowitz
But even if you do just want these operations, you’re far better off with a typeclass rather than sub typing.
1 reply 0 retweets 3 likes -
Citation needed.
2 replies 0 retweets 2 likes -
flatMap on List suspiciously allows the function parameter to return something that is not a List.
2 replies 0 retweets 3 likes -
Replying to @djspiewak @jvican and
I saw this for the first time in our code base the other day. List flatmapping with Option return type. Did a double take until I realised it was the inheritance that allows it... so is this breaking the monadic laws? I suppose not if you start with the base type but yes for List
1 reply 0 retweets 0 likes -
Replying to @ioupal @djspiewak and
actually thinking about it, it feels more like an extension to the monad than a contravention of its laws
2 replies 0 retweets 1 like -
It's analogous to saying that the `|+|` operation on a monoid should allow the composition of different types. In other words, it is LITERALLY the same as claiming that we should be able to write `1 + "2"` and expect meaningful coercion.
2 replies 0 retweets 1 like -
Replying to @djspiewak @jvican and
I see what you're saying is that inheritance and variance full stop is a bad idea I think it makes life easier and some respects but can give you code soup in others... hmm
2 replies 0 retweets 1 like -
Inheritance and variance are both powerful concepts and can be very helpful in some cases, but they more often get radically over-applied. There are much more precise and controlled forms of abstraction and code-sharing that are often better choices.
1 reply 0 retweets 4 likes
I would like to champion subtyping as both less specific and more useful than inheritance. And variance is very useful for working with subtyping.
-
-
Replying to @propensive @djspiewak and
I guess you mean not methods, just properties or as labels
1 reply 0 retweets 1 like -
Working with unimplemented methods seem fine to me, as do singleton and literal subtypes. Overrides and super calls are where it starts to fall apart...
0 replies 0 retweets 3 likes
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.