packages feed

freelude-0.3.1.0 / src / Freelude / Impl / MakeFunctor.hs

{-# LANGUAGE TypeInType #-}{-# LANGUAGE TypeFamilies #-}{-# LANGUAGE MultiParamTypeClasses #-}module Freelude.Impl.MakeFunctor (  MakeFunctor(getFunctor)) whereimport Prelude hiding (Functor, fmap, Monad)import qualified Preludeimport Data.Kind (Type)import Freelude.Impl.Categoryimport qualified Control.Applicativenewtype MakeFunctor f a = MakeFunctor { getFunctor :: f a }data MakeFunctorP (f :: Type -> Type)type instance FunctorT (MakeFunctorP f) a = MakeFunctor f atype instance FunctorSrcC' (MakeFunctorP _) = 'Nothingtype instance FunctorDstC' (MakeFunctorP _) = 'Nothinginstance Prelude.Functor f => Functor FunctionP (MakeFunctorP f) where  fmap f (MakeFunctor x) = MakeFunctor (Prelude.fmap f x)instance Prelude.Applicative f => Lift (MakeFunctorP f) where  liftA2 f (MakeFunctor x) (MakeFunctor y) = MakeFunctor (Control.Applicative.liftA2 f x y)instance Prelude.Applicative f => Apply (MakeFunctorP f) where  (MakeFunctor f) <*> (MakeFunctor x) = MakeFunctor (f Prelude.<*> x)instance Prelude.Applicative f => Pure (MakeFunctorP f) where  pure x = MakeFunctor (Prelude.pure x)instance Prelude.Monad f => Monad (MakeFunctorP f) where  (MakeFunctor x) >>= f = MakeFunctor (x Prelude.>>= f') where    f' x' = getFunctor (f x')