How to create multiparameter Applicative Functor or Monad in Haskell?

Let's say I have a functor like this:

data CMaybe a = CJust Int a
              | CNothing CNothing

instance Functor CMaybe where
  fmap f (CJust i a) = CJust i $ f a

It basically a Maybe, but has one more parameter. It seems impossible to create instance of Applicative or Monad, since pure and return can take only one parameter (which also has to be of type a passed to CMaybe, that means you can't use (Int, a)). I don't really care about these functions, but since their implementation is required to get the instance I need them. So is there any way to implement those functions?

No Comments Yet