harveywi / shapeless-builder

Scala case class builder design pattern using Miles Sabin's shapeless library
Other
23 stars 3 forks source link

Asynchronous setters et al. #1

Open RomanIakovlev opened 8 years ago

RomanIakovlev commented 8 years ago

First of all, this shapeless-builder is my first encounter with the shapeless in general, and it, while complex, is very compelling. I'd like to ask several questions about it.

  1. Automatic generation of the fields. It's a bit tedious to create fieldsContainer for every class. It would be nice to have them automatically generated. I think this might be possible with the macros, but it's not very compelling solution. Is there a way to do this via shapeless?
  2. In addition, it would be great to have code auto-completion hints for setters' names.
  3. Asynchronous setters. A nice feature of such builder would be to have something like setAsync(k: Param[A], val: Future[A]), and then have the build() method to somehow automatically return a Future[CC] instead of CC. This future completes when all of the async setters are completed. Again, is this possible with shapeless and with the current approach used in this library?
  4. Licensing. Is it possible to additionally license it with a more permissive license, like Apache, MIT or BSD? I'd like to use it at my work, and GPL is not allowed here, unfortunately.

I'd be willing to work on points 1-3, if they're feasible, but I'll definitely need some guidance (as I said, I'm totally new to shapeless and type-level programming in general, though I have a little of experience with Haskell). Are you interested in such cooperation?

harveywi commented 8 years ago

Feel free to work on things. You can probably go a long way with (1) and (2) by piggybacking on Shapeless's extensible records, but I'm not 100% sure. That might be a good toe-in-the-water experiment for getting started with Shapeless, and for contributing to this project. Once you understand all of the type-level machinery that keeps things in lockstep, implementing (3) should be straightforward.

I changed the license to MIT - happy hacking!