Keean Schupke
Keean Schupke
@shelby3 > This will still be a bifurcation w.r.t. to generic functions that can’t be monomorphised statically The source code of the function will be the same whether it can...
@shelby3 I am thinking along the same lines. As far as I understand it there is no subtyping. With type classes when we say `trait B` extends `trait A` we...
Or, with types ``` data Nil = Nil data Cons = Cons trait List A impl List Nil impl List Cons ```
As a single type with multiple constructors (tagged union): ``` data List = Nil | Cons ``` I'm still not sure about which keywords we should be using for trait,...
Not quite :-) some things to discuss. You have given value constructors round brackets, that seems okay to me. ``` data List = Nil | Cons(head: A, tail: List) ```...
The `{}` have the same use in 'C' for structs, C++ and Java for object definition so they are not new as such. In C, C++ and Rust we would...
@shelby3 wrote > I had a typo and Cons does not need two type parameters (two would mess up other things): Yes it does, what you wrote cannot ever end...
@shelby3 this version is correct in Rust syntax: ``` data Nil = Nil data Cons = Cons(A, B) // constraints on data bad. trait List impl List for Nil impl...
@shelby3 wrote: > A typeclass's type parameters can't express genericity that doesn't specialize on implementation. Thus we can't for example parametrize a typeclass trait List to track the type of...
Sorry you are wrong here. You can express a list as a type class and I have done it in Haskell and Rust. The HList paper I co-wrote with Oleg...