danidiaz / dep-t

Dependency injection for records-of-functions.

Home Page:http://hackage.haskell.org/package/dep-t

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should `Constructor` and `AccumConstructor` be newtypes?

danidiaz opened this issue · comments

  • It would be more uniform with how other phases are handled (other phases are not "peeled" by the Bare TF).
  • Perhaps it would make component insertions into the DI context less confusing.
  • Constructor is a simple function, perhaps overkill in this case.
  • For AccumConstructor, it may help hide the mandatory lazy pattern-match. Forgetting it causes infinite loops!
  • Them being synonyms for Compose is cute for calling fixEnv, but perhaps it shouldn't be exposed.

How to make the transition without an immediate breaking change? Deprecate the types in Dep.Env (including fixEnv and fixEnvAccum and add the new versions in a separate modle Dep.Constructor. This would give us the added bonus of having a natural place to explain how "DI by tying the knot" works.