https://kotlinlang.org logo
#arrow-meta
Title
# arrow-meta
j

Jannis

12/21/2019, 12:16 PM
Random thought: With higher-kinds using arrow-meta, can we have something like
@higherkind interface Eq<A>
@higherkind interface Show<A> : Eq<A>
? With the current encoding this is not possible because we'd inherit from two Kinds
Kind<ForEq, A>
and
Kind<ForShow, A>
. This is quite useful when defining/deriving these instances (for example by using the
Divisible
typeclass family)
This is also something that is not in haskell (probably for different reasons) and the solution over there is to just newtype wrap all the typeclasses that you'd want this for...
r

raulraja

12/21/2019, 1:27 PM
Yes
We are gonna have more
In the presence of instances of Eq, plus etc the type class extensions have precedence over the Lang operators
The new encoding for types includes it's inline newtype and a run time proof so there is no runtime and no need for ListK wrappers or similar
Show, eq, order etc are always discovered implictly and constrains in polymorphic functions are regular Kotlin type bounds
Anything can now extend synthetically Eq a directly
And it works with the existing system for subtype Polymorphism
No need for given or arguments injections so it's compatible with existing subtype polymorphic Kotlin
The issue in this area right now it's that at the moment it's just me working on proofs and there is a fair amount to finish
All parts are almost ready except laws, tests, inductive derivation and Lang operator overload and the actual arrow migration once tests and laws are ready
j

Jannis

12/21/2019, 2:21 PM
That sounds really cool 😅 Especially using == over eqv ^-^ (Although this needs some sort of note, from a ide plugin or so, if it happens to prevent ambiguity for the person reading it)
One more thing, currently I have a slight issue in the schedule pr where I really want to define variance for the generics, but due to it inheriting the
Kind3<ForSchedule,...>
the compiler prevents that. This leads to some typecasts and the necessity to provide generic types in a few places
r

raulraja

12/21/2019, 2:41 PM
Yes, injections are highlighted differently and include the path to where it comes from.
💯 1