https://kotlinlang.org logo
#compose
Title
# compose
d

dewildte

10/05/2019, 12:06 PM
I wish Kotlin had support for custom operators like F# lol.
r

Robert Menke

10/05/2019, 12:41 PM
What are you looking for beyond infix functions?
a

alexsullivan114

10/05/2019, 12:46 PM
It's cool being able to have custom operators that support monad transformations. Or I guess at least
flatMap
I'm not sure it's worth the headache but ReactiveSwift and libraries like that build up a pretty ergonomic API for making reactive calls by using things like
~=
to bind disposables and whatnot
d

dewildte

10/05/2019, 1:01 PM
I built my own parser combinator library in Kotlin and using infix functions like
_AND  _AND_  AND_
vs
.>>  .>>.  >>.
is not as nice and can get verbose.
For example
<?>
takes a parser and modifies its error messages but
_?_
is not valid Kotlin.
_em_
is fine I guess but I like to stick to common conventions.
p

Pablichjenkov

10/05/2019, 4:28 PM
I wish I could understand hieroglyph 🗿
💯 4
s

spierce7

10/06/2019, 9:30 PM
I actually think it encourages the creation of nonsense APIs. for libs, leading to less discoverable libraries i.e. you can’t google for documentation on the scala
++=-
function. And even if you could, isn’t a function that imparts some semblance of what it does actually better? With a lot of this stuff, less is more.
1
t

themishkun

10/07/2019, 5:25 AM
@spierce7 When you stumble across this function first time, maybe it looks mystical. But when it is a part of a library with nice algebraic design you start writing this as a breeze. My suggestion would be to always provide some kind of real name and apply custom operator only via some kind of annotation
5 Views