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

Should the record and the environment *jointly* determine the monad in `Has`? #32

Open danidiaz opened 1 year ago

danidiaz commented 1 year ago

Perhaps it could make sense, but I don't have a pressing need for it and it might complicate other things (like dynamic environments).

danidiaz commented 1 year ago

Come to think of it, nothing forbids a component to take a monad type parameter, ignore it completely, and have its effects in IO, like a boss:

data FileSystem (m :: Type -> Type) = FileSystem {
     readFile  :: FilePath -> IO String
     writeFile :: FilePath -> String -> IO ()
  }

So what use is m then? I guess it's a means of coordination, a hint of some common monad that the component might play along with, or ignore.