purescript/purescript-transformers

Modify the definition of the `asks` function of `ComonadEnv`.

setsunica opened this issue · 2 comments

The current definition is more restrictive than necessary. Modify as follows.

from
asks :: forall e1 e2 w. ComonadEnv e1 w => (e1 -> e2) -> w e1 -> e2
to
asks :: forall e1 e2 w a. ComonadEnv e1 w => (e1 -> e2) -> w a -> e2

The Haskell definition is as follows.
asks :: ComonadEnv e w => (e -> e') -> w a -> e'

Also, ComonadAsk instead of ComonadEnv may be sufficient.

garyb commented

👍 to both suggestions.

I'd say asks's type is a bug even, it makes no sense to require w e1, probably makes the function unusable most of the time.