In trying to solve Puzze 4, I'm having some compilation problems. When I define

instance Adjunction f g => Monad (g :.: f) where

return = Comp1 . unit

(>>=) = undefined

The compiler says it needs an Applicative for Monad (g :.: f), so I write

instance Adjunction f g => Applicative (g :.: f) where

pure = undefined

(<*>) = undefined

But now it complains with:

Duplicate instance declarations:

instance Adjunction f g => Applicative (g :.: f)

-- Defined at /Users/jmgimeno/Dropbox/Developer/lleida-developers/haskell/haskellformac/AppliedCategoryTheory.hsproj/Adjunctions.hs:36:10

instance (Applicative f, Applicative g) => Applicative (f :.: g)

-- Defined in ‘GHC.Generics’

Any magic incantantion (pragma, I suppose) to avoid the problem?

instance Adjunction f g => Monad (g :.: f) where

return = Comp1 . unit

(>>=) = undefined

The compiler says it needs an Applicative for Monad (g :.: f), so I write

instance Adjunction f g => Applicative (g :.: f) where

pure = undefined

(<*>) = undefined

But now it complains with:

Duplicate instance declarations:

instance Adjunction f g => Applicative (g :.: f)

-- Defined at /Users/jmgimeno/Dropbox/Developer/lleida-developers/haskell/haskellformac/AppliedCategoryTheory.hsproj/Adjunctions.hs:36:10

instance (Applicative f, Applicative g) => Applicative (f :.: g)

-- Defined in ‘GHC.Generics’

Any magic incantantion (pragma, I suppose) to avoid the problem?