Hi, I think I saw at some point something like @given in an example. Are we going to have KEEP-87 im...
g
Hi, I think I saw at some point something like @given in an example. Are we going to have KEEP-87 implemented with Arrow Meta?
But most importantly syntax of type classes is auto projected over data types by global coherent proof so in most cases you don’t even need to require anything with @given unless you are writing polymorphic functions where you require type arguments to be constrained by them.
It also uses a mechanism to be compatible with the same style of declaration of subtype bounds since proofs in meta use the notion of a synthetic subtype that is replaced by the proof to tie up the relationship between a data type and its type class
g
Cool, thank you
👍 1
r
Copy code
@Proof(TypeProof.Extension)
fun String.Companion.monoid(): Monoid<String> =
  StringMonoid

@Proof(TypeProof.Extension)
fun String.semigroupSyntax(): Semigroup.Syntax<String> =
  StringSyntax(this)
that says the String companion gets all constructors and members of Monoid<String> and string values get all syntax of semigroup and enables:
Copy code
String.empty()
"a".combine("b")
👍 1
without imports
g
This is great, looks awesome
c
Wow that's amazing So it's something like a extension inheritance? As in, you can create an ‘extension interface' and make a class you don't control inherit it via extension functions? If so, that's amazing
r
Yes that is what it is
imply in logic is equivalent to subtyping in kotlin
It's an impl of Programs as proofs as in the Curry Howard Lambek correspondence
Ad hoc policies between types as a compiler and ide plugin