{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
-- |

module Box.Functor
  (
    FFunctor (..),
    FoldableM (..),
  ) where

import Prelude
import Data.Kind

-- | An endofunctor in the category of endofunctors.
--
--  Like `Control.Monad.Morph.MFunctor` but without a `Monad` constraint.
class FFunctor (h :: (Type -> Type) -> Type -> Type) where
  foist :: (forall x. f x -> g x) -> h f a -> h g a

-- | Monadically Foldable
class FoldableM (t :: (Type -> Type) -> Type -> Type) where
  foldrM :: (Monad m) => (a -> m b -> m b) -> m b -> t m a -> m b