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

Could the type errors for `asCall` be improved?

danidiaz opened this issue · comments

For a 1-argument "method".

make ref (Call φ) = do
  let withResource k = do
        φ log "withResource"

With one extra argument:

       φ log "withResource" "foo"

• Couldn't match type ‘()’ with ‘m a0’
  Expected: Logger m -> String -> t0 -> m a0
    Actual: Logger m -> String -> m ()
• In the first argument of ‘φ’, namely ‘log’
  In a stmt of a 'do' block: φ log "withResource" "foo"

If we omit the argument:

       φ log

 Couldn't match type ‘m’ with ‘(->) String’
  Expected: Logger m -> m (m ())
    Actual: Logger m -> String -> m ()

Not sure how to improve this. Working in a generic monad is tricky.

Still no idea.