よく分からないなりに

{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, FlexibleInstances #-}

data Zero = Zero
data Succ n = Succ n

_0 = Zero
_1 = Succ _0
_2 = Succ _1
_3 = Succ _2
_4 = Succ _3
_5 = Succ _4

type family NthParamType n a :: *
type instance NthParamType Zero (a->b) = a
type instance NthParamType (Succ n) (a->b) = NthParamType n b

type family Replace n a b :: *
type instance Replace Zero (c->b) a = (->) a b
type instance Replace (Succ n) (a->b) c = a->Replace n b c

class Bind n a where
  bind :: n->a->(b->NthParamType n a)->Replace n a b

instance Bind Zero (a->b) where
  bind Zero f g = f . g
instance Bind n a => Bind (Succ n) (b->a) where
  bind (Succ n) f g x = bind n (f x) g

bind _2 (,,,) fst 1 2 (3,4) 5
-- (1,2,3,5)
bind _3 (,,,) fst 1 2 3 (4,5)
-- (1,2,3,4)

楽しいです