danidiaz / dep-t

Dependency injection for records-of-functions.
http://hackage.haskell.org/package/dep-t
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Simplify the definition of Dep.Env.Constructor #17

Closed danidiaz closed 2 years ago

danidiaz commented 2 years ago

type Constructor (env :: (Type -> Type) -> (Type -> Type) -> Type) (m :: Type -> Type) = (->) (env Identity m) Compose Identity

It would be better if constructor were simply

type Constructor env = (->) env Compose Identity

That is, Constructor doesn't need to know that the record it receives is parameterizable.

With this new definition, fixEnv would have a more perspicuous signature I think.

fixEnv :: (Phased env, Typeable env) => env (Constructor (env Identity m)) m -> env Identity m

danidiaz commented 2 years ago

Added in 3ad381beb6aff43f825d1c8cef6f208bcf66a98f.