purescript / purescript-transformers

Monad and comonad transformers
BSD 3-Clause "New" or "Revised" License
69 stars 44 forks source link

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

Closed setsunica closed 3 years ago

setsunica commented 4 years ago

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'

setsunica commented 4 years ago

Also, ComonadAsk instead of ComonadEnv may be sufficient.

garyb commented 4 years ago

:+1: 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.