davegurnell/bridges

Support types with type parameters

Opened this issue · 3 comments

We need to support them, I guess!

So I added some tests on top of the PR for first class ADT (#17) but I am missing some piece of knowledge regarding Shapeless to make this really work.

We already support cases like Class[String] where the parameter is defined and can be replaced in the members of the case class.

For types like Class[A] we get a diverging implicit error unless we define an implicit Typeable for A. But, if we do that, A becomes a value like String on the cod generation

Now, Elm (not sure about Flow/others) would support something like type alias Class a = { param: a } but I am not sure how to make Shapeless understand there is an A there, and to propagate it in a way we can use it.

I need help, senpai :)

To extend on the note above, as far as I can see Shapeless Generic1 would manage types with type parameters, but all the examples I see they only seem to work with Traits, which could be a problem for our use case (if that limitation is correct)

For example for Elm we can have Records that use a type parameter, but that would need to be a case class as the record needs parameters in it. With a trait we probably can't map things across correctly.

It may be that this is not relevant as (talking about Elm here) Records may be used more often with reusable front-end code, not with Json coming from the server.

Sorry, going through all my alerts and open issues, and I'm noticing some which are several years old 😓 I stopped using Elm years ago, and I am not even sure if I can find the time to do this now. I'll remove myself from assignee.