containers icon indicating copy to clipboard operation
containers copied to clipboard

Loosen superclass bounds for type class instances for merge tactics

Open gereeter opened this issue 6 years ago • 1 comments

The merge tactic types (WhenMissing f a b and WhenMatched f a b c) implement a number of type classes (Category, Monad, Applicative, and Functor). All of these instances except for Functor (WhenMatched f a b c) have (Applicative f, Monad f) constraints, yet only Category and Monad need those constraints. It seems unlikely that any further optimization would need those constraints either.

Instead, there could be

instance Functor f => Functor (WhenMissing f a b)
instance Applicative f => Applicative (WhenMissing f a b)
instance Functor f => Functor (WhenMatched f a b c) -- already present
instance Applicative f => Applicative (WhenMatched f a b c)

gereeter avatar Jan 23 '20 04:01 gereeter

Is this really possible with MaybeT semantics?

treeowl avatar Apr 16 '20 02:04 treeowl