for applicative <*> i got:
xof pf <*> xof pa = xof (\i -> (pf i) (pa i))

and for monad >>= i got:

xof pa >>= k = xof (\i -> (deX (k (pa i))) i)

am i on the right track?

for applicative <*> i got:
xof pf <*> xof pa = xof (\i -> (pf i) (pa i))

and for monad >>= i got:

xof pa >>= k = xof (\i -> (deX (k (pa i))) i)

am i on the right track?

I am not super confident, but I got basically the same thing for the applicative.

For the monad I got (\i -> DeX (k pa) i) I think it is this because pa is of type (Int -> a) and K is of type (a -> X b) so combining them gets you something of type Int -> X b.

My solution is pretty much identical to OP’s:

instance Functor X where

fmap f (Xof pa) = Xof (\i -> f (pa i))

instance Applicative X where

pure a = Xof (\i -> a)

Xof pf <*> Xof pa = Xof (\i ->

case pf i of {f ->

case pa i of {a ->

f a }})

instance Monad X where

return = pure

Xof pa >>= k = Xof (\i -> case pa i of

a -> deX (k a) i)