packages feed

free-functors 1.2.1 → 1.3

raw patch · 7 files changed

+149/−20 lines, 7 filesdep ~basedep ~derive-lifted-instancesdep ~template-haskellPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, derive-lifted-instances, template-haskell, transformers

API changes (from Hackage documentation)

- Data.Functor.Cofree: [Cofree] :: c a => (a -> b) -> a -> Cofree c b
+ Data.Functor.Cofree: [Cofree] :: forall (c :: Type -> Constraint) a b. c a => (a -> b) -> a -> Cofree c b
- Data.Functor.Cofree: convert :: (c (w a), Comonad w) => w a -> Cofree c a
+ Data.Functor.Cofree: convert :: forall (c :: Type -> Constraint) w a. (c (w a), Comonad w) => w a -> Cofree c a
- Data.Functor.Cofree: counit :: Cofree c b -> b
+ Data.Functor.Cofree: counit :: forall (c :: Type -> Constraint) b. Cofree c b -> b
- Data.Functor.Cofree: data Cofree c b
+ Data.Functor.Cofree: data Cofree (c :: Type -> Constraint) b
- Data.Functor.Cofree: leftAdjunct :: c a => (a -> b) -> a -> Cofree c b
+ Data.Functor.Cofree: leftAdjunct :: forall (c :: Type -> Constraint) a b. c a => (a -> b) -> a -> Cofree c b
- Data.Functor.Cofree: outL :: Product c m n -> m
+ Data.Functor.Cofree: outL :: forall (c :: Type -> Constraint) m n. Product c m n -> m
- Data.Functor.Cofree: outR :: Product c m n -> n
+ Data.Functor.Cofree: outR :: forall (c :: Type -> Constraint) m n. Product c m n -> n
- Data.Functor.Cofree: product :: c a => (a -> m) -> (a -> n) -> a -> Product c m n
+ Data.Functor.Cofree: product :: forall (c :: Type -> Constraint) a m n. c a => (a -> m) -> (a -> n) -> a -> Product c m n
- Data.Functor.Cofree: rightAdjunct :: (a -> Cofree c b) -> a -> b
+ Data.Functor.Cofree: rightAdjunct :: forall a (c :: Type -> Constraint) b. (a -> Cofree c b) -> a -> b
- Data.Functor.Cofree: terminal :: c a => a -> TerminalObject c
+ Data.Functor.Cofree: terminal :: forall (c :: Type -> Constraint) a. c a => a -> TerminalObject c
- Data.Functor.Cofree: type Product c m n = Cofree c (m, n)
+ Data.Functor.Cofree: type Product (c :: Type -> Constraint) m n = Cofree c (m, n)
- Data.Functor.Cofree: type TerminalObject c = Cofree c ()
+ Data.Functor.Cofree: type TerminalObject (c :: Type -> Constraint) = Cofree c ()
- Data.Functor.Cofree: unit :: c b => b -> Cofree c b
+ Data.Functor.Cofree: unit :: forall (c :: Type -> Constraint) b. c b => b -> Cofree c b
- Data.Functor.Cofree.Internal: type a ~=> b = forall x. a x => b x
+ Data.Functor.Cofree.Internal: type (a :: k -> Constraint) ~=> (b :: k -> Constraint) = forall (x :: k). a x => b x
- Data.Functor.Free: Duplicate :: f (f a) -> Duplicate f a
+ Data.Functor.Free: Duplicate :: f (f a) -> Duplicate (f :: Type -> Type) a
- Data.Functor.Free: Free :: (forall b. c b => (a -> b) -> b) -> Free c a
+ Data.Functor.Free: Free :: (forall b. c b => (a -> b) -> b) -> Free (c :: Type -> Constraint) a
- Data.Functor.Free: [getDuplicate] :: Duplicate f a -> f (f a)
+ Data.Functor.Free: [getDuplicate] :: Duplicate (f :: Type -> Type) a -> f (f a)
- Data.Functor.Free: [runFree] :: Free c a -> forall b. c b => (a -> b) -> b
+ Data.Functor.Free: [runFree] :: Free (c :: Type -> Constraint) a -> forall b. c b => (a -> b) -> b
- Data.Functor.Free: convert :: (c (f a), Applicative f) => Free c a -> f a
+ Data.Functor.Free: convert :: forall (c :: Type -> Constraint) f a. (c (f a), Applicative f) => Free c a -> f a
- Data.Functor.Free: convertClosed :: c r => Free c Void -> r
+ Data.Functor.Free: convertClosed :: forall (c :: Type -> Constraint) r. c r => Free c Void -> r
- Data.Functor.Free: coproduct :: c r => (m -> r) -> (n -> r) -> Coproduct c m n -> r
+ Data.Functor.Free: coproduct :: forall (c :: Type -> Constraint) r m n. c r => (m -> r) -> (n -> r) -> Coproduct c m n -> r
- Data.Functor.Free: counit :: c a => Free c a -> a
+ Data.Functor.Free: counit :: forall (c :: Type -> Constraint) a. c a => Free c a -> a
- Data.Functor.Free: inL :: m -> Coproduct c m n
+ Data.Functor.Free: inL :: forall m (c :: Type -> Constraint) n. m -> Coproduct c m n
- Data.Functor.Free: inR :: n -> Coproduct c m n
+ Data.Functor.Free: inR :: forall n (c :: Type -> Constraint) m. n -> Coproduct c m n
- Data.Functor.Free: initial :: c r => InitialObject c -> r
+ Data.Functor.Free: initial :: forall (c :: Type -> Constraint) r. c r => InitialObject c -> r
- Data.Functor.Free: leftAdjunct :: (Free c a -> b) -> a -> b
+ Data.Functor.Free: leftAdjunct :: forall (c :: Type -> Constraint) a b. (Free c a -> b) -> a -> b
- Data.Functor.Free: newtype Duplicate f a
+ Data.Functor.Free: newtype Duplicate (f :: Type -> Type) a
- Data.Functor.Free: newtype Free c a
+ Data.Functor.Free: newtype Free (c :: Type -> Constraint) a
- Data.Functor.Free: rightAdjunct :: c b => (a -> b) -> Free c a -> b
+ Data.Functor.Free: rightAdjunct :: forall (c :: Type -> Constraint) b a. c b => (a -> b) -> Free c a -> b
- Data.Functor.Free: type Coproduct c m n = Free c (Either m n)
+ Data.Functor.Free: type Coproduct (c :: Type -> Constraint) m n = Free c Either m n
- Data.Functor.Free: type InitialObject c = Free c Void
+ Data.Functor.Free: type InitialObject (c :: Type -> Constraint) = Free c Void
- Data.Functor.Free: unfold :: (b -> Coproduct c b a) -> b -> Free c a
+ Data.Functor.Free: unfold :: forall b (c :: Type -> Constraint) a. (b -> Coproduct c b a) -> b -> Free c a
- Data.Functor.Free: unit :: a -> Free c a
+ Data.Functor.Free: unit :: forall a (c :: Type -> Constraint). a -> Free c a
- Data.Functor.Free.Internal: type a ~=> b = forall x. a x => b x
+ Data.Functor.Free.Internal: type (a :: k -> Constraint) ~=> (b :: k -> Constraint) = forall (x :: k). a x => b x
- Data.Functor.HCofree: [HCofree] :: c f => (f :~> g) -> f a -> HCofree c g a
+ Data.Functor.HCofree: [HCofree] :: forall (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) (g :: Type -> Type) a. c f => (f :~> g) -> f a -> HCofree c g a
- Data.Functor.HCofree: coiter :: c Identity => (forall b. b -> f b) -> a -> HCofree c f a
+ Data.Functor.HCofree: coiter :: forall (c :: (Type -> Type) -> Constraint) f a. c Identity => (forall b. () => b -> f b) -> a -> HCofree c f a
- Data.Functor.HCofree: convert :: (c (t f), Comonad f, ComonadTrans t) => t f a -> HCofree c f a
+ Data.Functor.HCofree: convert :: forall (c :: (Type -> Type) -> Constraint) t (f :: Type -> Type) a. (c (t f), Comonad f, ComonadTrans t) => t f a -> HCofree c f a
- Data.Functor.HCofree: counit :: HCofree c g :~> g
+ Data.Functor.HCofree: counit :: forall (c :: (Type -> Type) -> Constraint) g b. HCofree c g b -> g b
- Data.Functor.HCofree: data HCofree c g a
+ Data.Functor.HCofree: data HCofree (c :: Type -> Type -> Constraint) (g :: Type -> Type) a
- Data.Functor.HCofree: hextend :: (HCofree c f :~> g) -> HCofree c f :~> HCofree c g
+ Data.Functor.HCofree: hextend :: forall (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) (g :: Type -> Type). (HCofree c f :~> g) -> HCofree c f :~> HCofree c g
- Data.Functor.HCofree: hfmap :: (f :~> g) -> HCofree c f :~> HCofree c g
+ Data.Functor.HCofree: hfmap :: forall (f :: Type -> Type) (g :: Type -> Type) (c :: (Type -> Type) -> Constraint). (f :~> g) -> HCofree c f :~> HCofree c g
- Data.Functor.HCofree: leftAdjunct :: c f => (f :~> g) -> f :~> HCofree c g
+ Data.Functor.HCofree: leftAdjunct :: forall (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) (g :: Type -> Type). c f => (f :~> g) -> f :~> HCofree c g
- Data.Functor.HCofree: liftCofree :: c f => f a -> HCofree c f a
+ Data.Functor.HCofree: liftCofree :: forall (c :: (Type -> Type) -> Constraint) f a. c f => f a -> HCofree c f a
- Data.Functor.HCofree: lowerCofree :: HCofree c f a -> f a
+ Data.Functor.HCofree: lowerCofree :: forall (c :: (Type -> Type) -> Constraint) f a. HCofree c f a -> f a
- Data.Functor.HCofree: rightAdjunct :: (f :~> HCofree c g) -> f :~> g
+ Data.Functor.HCofree: rightAdjunct :: forall (f :: Type -> Type) (c :: (Type -> Type) -> Constraint) (g :: Type -> Type). (f :~> HCofree c g) -> f :~> g
- Data.Functor.HCofree: transform :: (forall r. c r => (r :~> f) -> r :~> g) -> HCofree c f :~> HCofree c g
+ Data.Functor.HCofree: transform :: forall c (f :: Type -> Type) (g :: Type -> Type). (forall (r :: Type -> Type). c r => (r :~> f) -> r :~> g) -> HCofree c f :~> HCofree c g
- Data.Functor.HCofree: type f :~> g = forall b. f b -> g b
+ Data.Functor.HCofree: type (f :: Type -> Type) :~> (g :: Type -> Type) = forall b. () => f b -> g b
- Data.Functor.HCofree: unit :: c g => g :~> HCofree c g
+ Data.Functor.HCofree: unit :: forall (c :: (Type -> Type) -> Constraint) (g :: Type -> Type). c g => g :~> HCofree c g
- Data.Functor.HFree: HFree :: (forall g. c g => (f :~> g) -> g a) -> HFree c f a
+ Data.Functor.HFree: HFree :: (forall (g :: Type -> Type). c g => (f :~> g) -> g a) -> HFree (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) a
- Data.Functor.HFree: [runHFree] :: HFree c f a -> forall g. c g => (f :~> g) -> g a
+ Data.Functor.HFree: [runHFree] :: HFree (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) a -> forall (g :: Type -> Type). c g => (f :~> g) -> g a
- Data.Functor.HFree: bind :: (f :~> HFree c g) -> HFree c f :~> HFree c g
+ Data.Functor.HFree: bind :: forall (f :: Type -> Type) (c :: (Type -> Type) -> Constraint) (g :: Type -> Type). (f :~> HFree c g) -> HFree c f :~> HFree c g
- Data.Functor.HFree: convert :: (c (t f), Monad f, MonadTrans t) => HFree c f a -> t f a
+ Data.Functor.HFree: convert :: forall (c :: (Type -> Type) -> Constraint) t (f :: Type -> Type) a. (c (t f), Monad f, MonadTrans t) => HFree c f a -> t f a
- Data.Functor.HFree: counit :: c f => HFree c f :~> f
+ Data.Functor.HFree: counit :: forall (c :: (Type -> Type) -> Constraint) (f :: Type -> Type). c f => HFree c f :~> f
- Data.Functor.HFree: hfmap :: (f :~> g) -> HFree c f :~> HFree c g
+ Data.Functor.HFree: hfmap :: forall (f :: Type -> Type) (g :: Type -> Type) (c :: (Type -> Type) -> Constraint). (f :~> g) -> HFree c f :~> HFree c g
- Data.Functor.HFree: iter :: c Identity => (forall b. f b -> b) -> HFree c f a -> a
+ Data.Functor.HFree: iter :: forall (c :: (Type -> Type) -> Constraint) f a. c Identity => (forall b. () => f b -> b) -> HFree c f a -> a
- Data.Functor.HFree: leftAdjunct :: (HFree c f :~> g) -> f :~> g
+ Data.Functor.HFree: leftAdjunct :: forall (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) (g :: Type -> Type). (HFree c f :~> g) -> f :~> g
- Data.Functor.HFree: liftFree :: f a -> HFree c f a
+ Data.Functor.HFree: liftFree :: forall f a (c :: (Type -> Type) -> Constraint). f a -> HFree c f a
- Data.Functor.HFree: lowerFree :: c f => HFree c f a -> f a
+ Data.Functor.HFree: lowerFree :: forall (c :: (Type -> Type) -> Constraint) f a. c f => HFree c f a -> f a
- Data.Functor.HFree: newtype HFree c f a
+ Data.Functor.HFree: newtype HFree (c :: Type -> Type -> Constraint) (f :: Type -> Type) a
- Data.Functor.HFree: rightAdjunct :: c g => (f :~> g) -> HFree c f :~> g
+ Data.Functor.HFree: rightAdjunct :: forall (c :: (Type -> Type) -> Constraint) (g :: Type -> Type) (f :: Type -> Type). c g => (f :~> g) -> HFree c f :~> g
- Data.Functor.HFree: transform :: (forall r. c r => (g :~> r) -> f :~> r) -> HFree c f :~> HFree c g
+ Data.Functor.HFree: transform :: forall c (g :: Type -> Type) (f :: Type -> Type). (forall (r :: Type -> Type). c r => (g :~> r) -> f :~> r) -> HFree c f :~> HFree c g
- Data.Functor.HFree: type f :~> g = forall b. f b -> g b
+ Data.Functor.HFree: type (f :: Type -> Type) :~> (g :: Type -> Type) = forall b. () => f b -> g b
- Data.Functor.HFree: unit :: f :~> HFree c f
+ Data.Functor.HFree: unit :: forall f (c :: (Type -> Type) -> Constraint) b. f b -> HFree c f b
- Data.Functor.HHCofree: [HHCofree] :: c f => (f :~~> g) -> f a b -> HHCofree c g a b
+ Data.Functor.HHCofree: [HHCofree] :: forall (c :: (Type -> Type -> Type) -> Constraint) (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) a b. c f => (f :~~> g) -> f a b -> HHCofree c g a b
- Data.Functor.HHCofree: counit :: HHCofree c g :~~> g
+ Data.Functor.HHCofree: counit :: forall (c1 :: (Type -> Type -> Type) -> Constraint) g c2 d. HHCofree c1 g c2 d -> g c2 d
- Data.Functor.HHCofree: data HHCofree c g a b
+ Data.Functor.HHCofree: data HHCofree (c :: Type -> Type -> Type -> Constraint) (g :: Type -> Type -> Type) a b
- Data.Functor.HHCofree: hextend :: (HHCofree c f :~~> g) -> HHCofree c f :~~> HHCofree c g
+ Data.Functor.HHCofree: hextend :: forall (c :: (Type -> Type -> Type) -> Constraint) (f :: Type -> Type -> Type) (g :: Type -> Type -> Type). (HHCofree c f :~~> g) -> HHCofree c f :~~> HHCofree c g
- Data.Functor.HHCofree: hfmap :: (f :~~> g) -> HHCofree c f :~~> HHCofree c g
+ Data.Functor.HHCofree: hfmap :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) (c :: (Type -> Type -> Type) -> Constraint). (f :~~> g) -> HHCofree c f :~~> HHCofree c g
- Data.Functor.HHCofree: leftAdjunct :: c f => (f :~~> g) -> f :~~> HHCofree c g
+ Data.Functor.HHCofree: leftAdjunct :: forall (c :: (Type -> Type -> Type) -> Constraint) (f :: Type -> Type -> Type) (g :: Type -> Type -> Type). c f => (f :~~> g) -> f :~~> HHCofree c g
- Data.Functor.HHCofree: rightAdjunct :: (f :~~> HHCofree c g) -> f :~~> g
+ Data.Functor.HHCofree: rightAdjunct :: forall (f :: Type -> Type -> Type) (c :: (Type -> Type -> Type) -> Constraint) (g :: Type -> Type -> Type). (f :~~> HHCofree c g) -> f :~~> g
- Data.Functor.HHCofree: transform :: (forall r. c r => (r :~~> f) -> r :~~> g) -> HHCofree c f :~~> HHCofree c g
+ Data.Functor.HHCofree: transform :: forall c (f :: Type -> Type -> Type) (g :: Type -> Type -> Type). (forall (r :: Type -> Type -> Type). c r => (r :~~> f) -> r :~~> g) -> HHCofree c f :~~> HHCofree c g
- Data.Functor.HHCofree: type f :~~> g = forall c d. f c d -> g c d
+ Data.Functor.HHCofree: type (f :: Type -> Type -> Type) :~~> (g :: Type -> Type -> Type) = forall c d. () => f c d -> g c d
- Data.Functor.HHCofree: unit :: c g => g :~~> HHCofree c g
+ Data.Functor.HHCofree: unit :: forall (c :: (Type -> Type -> Type) -> Constraint) (g :: Type -> Type -> Type). c g => g :~~> HHCofree c g
- Data.Functor.HHFree: HHFree :: (forall g. c g => (f :~~> g) -> g a b) -> HHFree c f a b
+ Data.Functor.HHFree: HHFree :: (forall (g :: Type -> Type -> Type). c g => (f :~~> g) -> g a b) -> HHFree (c :: (Type -> Type -> Type) -> Constraint) (f :: Type -> Type -> Type) a b
- Data.Functor.HHFree: [runHHFree] :: HHFree c f a b -> forall g. c g => (f :~~> g) -> g a b
+ Data.Functor.HHFree: [runHHFree] :: HHFree (c :: (Type -> Type -> Type) -> Constraint) (f :: Type -> Type -> Type) a b -> forall (g :: Type -> Type -> Type). c g => (f :~~> g) -> g a b
- Data.Functor.HHFree: bind :: (f :~~> HHFree c g) -> HHFree c f :~~> HHFree c g
+ Data.Functor.HHFree: bind :: forall (f :: Type -> Type -> Type) (c :: (Type -> Type -> Type) -> Constraint) (g :: Type -> Type -> Type). (f :~~> HHFree c g) -> HHFree c f :~~> HHFree c g
- Data.Functor.HHFree: counit :: c f => HHFree c f :~~> f
+ Data.Functor.HHFree: counit :: forall (c :: (Type -> Type -> Type) -> Constraint) (f :: Type -> Type -> Type). c f => HHFree c f :~~> f
- Data.Functor.HHFree: hfmap :: (f :~~> g) -> HHFree c f :~~> HHFree c g
+ Data.Functor.HHFree: hfmap :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) (c :: (Type -> Type -> Type) -> Constraint). (f :~~> g) -> HHFree c f :~~> HHFree c g
- Data.Functor.HHFree: leftAdjunct :: (HHFree c f :~~> g) -> f :~~> g
+ Data.Functor.HHFree: leftAdjunct :: forall (c :: (Type -> Type -> Type) -> Constraint) (f :: Type -> Type -> Type) (g :: Type -> Type -> Type). (HHFree c f :~~> g) -> f :~~> g
- Data.Functor.HHFree: newtype HHFree c f a b
+ Data.Functor.HHFree: newtype HHFree (c :: Type -> Type -> Type -> Constraint) (f :: Type -> Type -> Type) a b
- Data.Functor.HHFree: rightAdjunct :: c g => (f :~~> g) -> HHFree c f :~~> g
+ Data.Functor.HHFree: rightAdjunct :: forall (c :: (Type -> Type -> Type) -> Constraint) (g :: Type -> Type -> Type) (f :: Type -> Type -> Type). c g => (f :~~> g) -> HHFree c f :~~> g
- Data.Functor.HHFree: transform :: (forall r. c r => (g :~~> r) -> f :~~> r) -> HHFree c f :~~> HHFree c g
+ Data.Functor.HHFree: transform :: forall c (g :: Type -> Type -> Type) (f :: Type -> Type -> Type). (forall (r :: Type -> Type -> Type). c r => (g :~~> r) -> f :~~> r) -> HHFree c f :~~> HHFree c g
- Data.Functor.HHFree: type f :~~> g = forall a b. f a b -> g a b
+ Data.Functor.HHFree: type (f :: Type -> Type -> Type) :~~> (g :: Type -> Type -> Type) = forall a b. () => f a b -> g a b
- Data.Functor.HHFree: unit :: f :~~> HHFree c f
+ Data.Functor.HHFree: unit :: forall f (c :: (Type -> Type -> Type) -> Constraint) a b. f a b -> HHFree c f a b

Files

CHANGELOG view
@@ -1,4 +1,7 @@ CHANGELOG+1.2 -> 1.3+  - Add support for GHC 9.6 through 9.14+  - Update to derive-lifted-instances v0.3  1.1.2 -> 1.2   - Add support for GHC 9.0, drop GHC 8.8
examples/Automaton.hs view
@@ -6,13 +6,13 @@   #-} module Automaton where -import Data.Functor.Cofree-import Data.Functor.Cofree.Internal-import Data.DeriveLiftedInstances+import Data.Functor.Cofree ( Cofree(..) )+import Data.Functor.Cofree.Internal ( cofreeDeriv )+import Data.DeriveLiftedInstances ( deriveInstance ) -import Control.Comonad-import Data.Functor.Identity-import Data.Functor.Compose+import Control.Comonad ( Comonad(extract) )+import Data.Functor.Identity ( Identity )+import Data.Functor.Compose ( Compose(..) )   class Action i s where
+ examples/Laws.hs view
@@ -0,0 +1,127 @@+{-# LANGUAGE+    TypeFamilies+  , GADTs+  , LambdaCase+  , RankNTypes+  , BlockArguments+  , KindSignatures+  , ScopedTypeVariables+  , ConstraintKinds+  , FlexibleInstances+  , FlexibleContexts+  , DeriveGeneric+  , DeriveAnyClass+  , TypeApplications+  , AllowAmbiguousTypes+  , StandaloneDeriving+  , UndecidableInstances+  #-}+module Laws where++import GHC.Generics (Generic)+import Data.Functor.Free ( Free )+import qualified Data.Functor.Free as Free ( rightAdjunct, unit )+import Data.Functor.HFree ( HFree )+import qualified Data.Functor.HFree as HFree ( rightAdjunct, unit )+import Data.Kind (Type, Constraint)+import Test.QuickCheck ( quickCheck, Arbitrary(..), CoArbitrary, Gen )++import Data.Monoid (Sum)+import Control.Applicative (ZipList)++data EQ a = a :=: a deriving (Eq, Show)+infix 4 :=:++class Laws (c :: Type -> Constraint) where+  type Var c :: Type+  laws :: [EQ (Free c (Var c))]++data VAR = X | Y | Z deriving (Eq, Show, Generic, CoArbitrary)++instance Show a => Show (VAR -> a) where+  show f = unlines $ map show [(X, f X), (Y, f Y), (Z, f Z)]++x, y, z :: Free c VAR+x = Free.unit X+y = Free.unit Y+z = Free.unit Z++instance Laws Semigroup where+  type Var Semigroup = VAR+  laws = [x <> (y <> z) :=: (x <> y) <> z]++instance Laws Monoid where+  type Var Monoid = VAR+  laws =+    [ x <> mempty :=: x+    , mempty <> x :=: x+    ]++props :: forall c a. (Laws c, c a, Eq a) => (Var c -> a) -> Bool+props f = and $ (\(l :=: r) -> Free.rightAdjunct f l == Free.rightAdjunct f r) <$> laws @c++checkLaws :: forall c a. (Laws c, c a, CoArbitrary (Var c), Arbitrary a, Eq a, Show (Var c -> a)) => IO ()+checkLaws = quickCheck (props @c @a)++run :: IO ()+run = checkLaws @Semigroup @(Sum Double)+++data EQ1 f a = f a :==: f a+deriving instance Eq (f a) => Eq (EQ1 f a)+deriving instance Show (f a) => Show (EQ1 f a)+infix 4 :==:++class Laws1 (c :: (Type -> Type) -> Constraint) where+  type Var1 c :: (Type -> Type)+  type Param c :: Type+  laws1 :: [EQ1 (HFree c (Var1 c)) (Param c)]++data VAR1 a where+  U :: VAR1 (Int -> Int)+  V :: VAR1 (Int -> Int)+  W :: VAR1 Int+deriving instance Eq (VAR1 a)+deriving instance Show (VAR1 a)++u :: HFree c VAR1 (Int -> Int)+u = HFree.unit U+v :: HFree c VAR1 (Int -> Int)+v = HFree.unit V+w :: HFree c VAR1 Int+w = HFree.unit W++instance Laws1 Applicative where+  type Var1 Applicative = VAR1+  type Param Applicative = Int+  laws1 =+    [ (pure id <*> w) :==: w+    , (pure (.) <*> u <*> v <*> w) :==: (u <*> (v <*> w))+    , (pure (+ 1) <*> pure 2) :==: pure 3+    , (u <*> pure 1) :==: (pure ($ 1) <*> u)+    ]++newtype Nat c f = Nat (forall a. Var1 c a -> f a)+instance (Functor f, Arbitrary (f Int), Arbitrary (f (Int -> Int))) => Arbitrary (Nat Applicative f) where+  arbitrary = do+    u' <- arbitrary :: Gen (f (Int -> Int))+    v' <- arbitrary :: Gen (f (Int -> Int))+    w' <- arbitrary :: Gen (f Int)+    pure $ Nat \case+      U -> u'+      V -> v'+      W -> w'+instance (Show (f Int), Show (f (Int -> Int))) => Show (Nat Applicative f) where+  show (Nat f) = unlines [show (U, f U), show (V, f V), show (W, f W)]++instance Show (Int -> Int) where+  show f = ".." ++ (init . tail . show) [f (-2), f (-1), f 0, f 1, f 2] ++ ".."++props1 :: forall c f. (Laws1 c, c f, Eq (f (Param c))) => Nat c f -> Bool+props1 (Nat f) = and $ (\(l :==: r) -> HFree.rightAdjunct f l == HFree.rightAdjunct f r) <$> laws1 @c++checkLaws1 :: forall c f. (Laws1 c, c f, Eq (f (Param c)), Arbitrary (Nat c f), Functor f, Show (Nat c f)) => IO ()+checkLaws1 = quickCheck (props1 @c @f)++run1 :: IO ()+run1 = checkLaws1 @Applicative @[]
free-functors.cabal view
@@ -1,5 +1,5 @@ name:                free-functors-version:             1.2.1+version:             1.3 synopsis:            Free functors, adjoint to functors that forget class constraints. description:         A free functor is a left adjoint to a forgetful functor. It used to be the case                      that the only category that was easy to work with in Haskell was Hask itself, so@@ -21,15 +21,17 @@ bug-reports:         https://github.com/sjoerdvisscher/free-functors/issues  build-type:          Simple-cabal-version:       >= 1.10-tested-with:         GHC==9.0.0.20200925, GHC==8.10.2, GHC==8.8.4+cabal-version:       2.0+tested-with:         GHC==9.6.7, GHC==9.8.4, GHC==9.10.3, GHC==9.12.2, GHC==9.14.1  extra-source-files:   examples/*.hs++extra-doc-files:   CHANGELOG  Library-  HS-Source-Dirs:+  hs-source-dirs:     src    exposed-modules:@@ -46,11 +48,11 @@     Haskell2010    build-depends:-    base >= 4.13 && < 4.16,-    template-haskell >= 2.15 && < 2.18,-    transformers == 0.5.*,+    base >= 4.18 && < 4.23,+    template-haskell >= 2.20 && < 2.25,+    transformers >= 0.5 && < 0.7,     comonad == 5.*,-    derive-lifted-instances >= 0.2.2 && < 0.3,+    derive-lifted-instances == 0.3.*,     contravariant == 1.5.*,     bifunctors == 5.*,     profunctors == 5.*@@ -58,4 +60,4 @@  source-repository head   type:     git-  location: git://github.com/sjoerdvisscher/free-functors.git+  location: https://github.com/sjoerdvisscher/free-functors
src/Data/Functor/Cofree/Internal.hs view
@@ -40,7 +40,7 @@   cst = \e -> [| const $e $kExp |], -- Suppress "Defined but not used: ‘k’" warning   res = \e -> [| $(pure (ConE cofree)) $kExp $e |],   eff = \e -> [| $(pure (ConE cofree)) $kExp <$> $e |],-  inp = fmap (\vp -> ConP cofree [kPat, vp])+  inp = fmap (\vp -> ConP cofree [] [kPat, vp]) }  deriveCofreeInstance' :: Name -> Name -> Name -> Q [Dec]
src/Data/Functor/Free.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-unused-matches #-}+{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-unused-matches -Wno-noncanonical-monoid-instances#-} {-# LANGUAGE     RankNTypes   , TypeFamilies@@ -100,7 +100,6 @@   fs <*> as = transform (\k f -> rightAdjunct (k . f) as) fs  instance Monad (Free c) where-  return = unit   as >>= f = transform (\k -> rightAdjunct k . f) as  instance (forall f x. Applicative f => c (Ap f (Free c x))) => Foldable (Free c) where
src/Data/Functor/HFree.hs view
@@ -45,8 +45,6 @@ instance (c ~=> Monad, c (HFree c f)) => Monad (HFree c f) where   return = pure   HFree f >>= g = HFree $ \k -> f k >>= rightAdjunct k . g-  HFree f >> HFree g = HFree $ \k -> f k >> g k-  -- | Derive the instance of @`HFree` c f a@ for the class @c@,. --