[Juan Manuel Gimeno #10](https://forum.azimuthproject.org/discussion/comment/16546/#Comment_16546) wrote:

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

Hmm... I'm bumping into this too.

I think it's easier if we skip `GHC.Generics`. Here's some boilerplate that should get you to where you want to be:

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

Hmm... I'm bumping into this too.

I think it's easier if we skip `GHC.Generics`. Here's some boilerplate that should get you to where you want to be:

{-# LANGUAGE MultiParamTypeClasses #-}

{-# LANGUAGE FunctionalDependencies #-}

{-# LANGUAGE Rank2Types #-}

{-# LANGUAGE TypeOperators #-}

{-# LANGUAGE KindSignatures #-}

{-# LANGUAGE PolyKinds #-}

{-# LANGUAGE DeriveFunctor #-}

module Adjunction where

class (Functor f, Functor g) => Adjunction f g | f -> g, g -> f where

leftAdjunct :: (f a -> b) -> a -> g b

rightAdjunct :: (a -> g b) -> f a -> b

unit :: Adjunction f g => a -> g (f a)

unit = leftAdjunct id

infixr 7 :.:

newtype (:.:) (f :: k2 -> *) (g :: k1 -> k2) (p :: k1) =

Comp1 { unComp1 :: f (g p) }

deriving (Functor)

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

pure = undefined

(<*>) = undefined

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

return = Comp1 . unit

(>>=) = undefined