- how to handle reification of types with a HKT type-param?
-
if the hkt-type-param is not used:
class Foo[F[_]]
-
if the hkt-type-param is used in method signatures:
trait Foo[F[_]] def map[A](a: A): F[A]
-
if the hkt-type-param is used in the body of a function with a concrete type (is that even possible? where should it get that type from?):
trait Foo[F[_]] def string(): String => let f: F[String] = Fs.str_f[F]() f.string()
should we reify
Foo
for each instance ofF
here, without type-args? Or for eachF[String]
, with type-args? After allF
could be used with different args across the whole type (e.g. in different methods with different type-args, not depending on a type-param in the method signature). -
how to handle usage in constraints on the same type and on methods?
trait Foo[F[_], T: F[String]] def map[X: F[U8]](): T
-
- handle iftype
- only allow using HKT-type-args applied with a type-param on the LHS of an iftype:
iftype F[T] <: F[String] then
- can we allow the raw HKT-type on the LHS:
iftype F <: List[String] then
? In which context? What could be put on the RHS, also a generic HKT-type with a specified type-arg, like:iftype F <: F[String] then
or is the above the only thing?
- only allow using HKT-type-args applied with a type-param on the LHS of an iftype:
Last active
February 1, 2019 13:00
-
-
Save mfelsche/0a4f11a582da3846f6fb535cde30d20f to your computer and use it in GitHub Desktop.
Ponylang HKT implementation checklist: https://github.com/ponylang/rfcs/pull/134
- if the hkt-type-param is not used
I think this should be fine, much like if any other type param is unused:
primitive Foo[A]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think this is possible without some constraint. Like you said, there's no way to know how to construct an
F
, let alone how to stuff some type in it. 😄