https://kotlinlang.org logo
#functional
Title
# functional
t

tschuchort

09/13/2019, 3:14 PM
Can you give a code snippet how you would do it?
p

pakoito

09/13/2019, 3:34 PM
it's going to be a monster, there's no type-level programming in Kotlin
and I have no generalisation for it
t

tschuchort

09/13/2019, 3:36 PM
hmm, that sucks. I guess I have to think of something else then
u

Uberto Barbini

09/16/2019, 7:13 PM
Are you able to express that in Haskell? I've tried but...
Coming from Haskell, what Kotlin is mostly missing are the Higher Kinded Types. It's a deliberate choice apparently, bc they are too complex for people to understand (which I disagree)
t

tschuchort

09/16/2019, 9:42 PM
I'm sure there is some crazy way to do it in Haskell, especially if you consider extensions for dependent types. Perhaps something with type families would work, but my Haskell isn't good enough yet to come up with something right off the bat. I will ask the oracle and report back
Hopefully we will get HKTs eventually. The arrow guys are already working on a proposal for type classes, so if we ever get that it wouldn't make sense to stop at HKTs. Personally, what I'm missing the most is first class union types and type-level programming in general.
p

pakoito

09/16/2019, 10:14 PM
on the good news department HKTs are not an if anymore, just a when
💯 2
same for typeclasses
u

Uberto Barbini

09/17/2019, 1:47 PM
Really? I thought they put everything on hold... great!
p

pakoito

09/17/2019, 2:17 PM
#arrow-meta
u

Uberto Barbini

09/18/2019, 7:08 PM
Thanks I missed that. Still, as much as I enjoy tinkering around, a custom compiler plugin is not the same as having it supported by the language. :)
Kudos for the job and I will follow it closely
c

cedric

09/23/2019, 5:35 AM
Count me in the dissenting (and apparently, very scarcely populated) crowd of people who understand Higher Kinded Types and who don't want to see them in Kotlin 🙂
t

tschuchort

09/23/2019, 2:33 PM
And why is that?
c

cedric

09/23/2019, 6:01 PM
I think overall, HKT’s don’t meet the requirement of a reasonable ratio for “complexity added to the language and compiler” / benefits
t

tschuchort

09/23/2019, 6:49 PM
What do I care about the compiler though, someone else has to implement it
c

cedric

09/23/2019, 6:50 PM
You have probably never used
scalac
🙂
r

raulraja

09/27/2019, 11:20 AM
HKTs as a compiler plugin has no complexity in usage because it’s transparent to the user.
Our current encoding in Arrow is problematic though since fix and Kind get in the way but with automatic typeclasses and kinds powered by Arrow meta and compiler plugins we can not only have higherkinded types but potentially intersection and union types too that are ergonomic to work with
Also resolution of typeclasses with kotlinc + arrow meta is way faster than scala because scala implodes search inside out based on scopes whereas our resolution which is already implemented can get to the instance directly since the lookup is coherent and predictable so it does not impose crazy compile times like scala’s implicits
It’s as fast as importing and looking up extension functions
6 Views