greyblake/nutype

DRY logic in the module generation

greyblake opened this issue · 2 comments

Context

At the moment we support 3 type families: integers, floats and String.
Recently Newtype trait was introduced, which formalizes parse -> validate -> generate flow.
The generation logic is handled individually by each single type in gen modules, by the following functions:

Those functions are very similar and have a similar structure.
Since we're going to add new type families in the nearest future we want to find a way to avoid those duplications and DRY them.

Specs

  • Find a way to DRY the duplications (consider higher order functions, traits with template methods, or something else

Acceptance Criteria

  • The tests remain untouched and pass
  • The code is restructured in the way that adding a new type family will require writing less code for the generation logic.

I am working on it.

Done in #73