packages feed

applicable 0.2.0.0 → 0.3.0.0

raw patch · 4 files changed

+19/−10 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.Applicable: instance GHC.Enum.Bounded Data.Applicable.ChurchBool
- Data.Applicable: instance GHC.Enum.Enum Data.Applicable.ChurchBool
+ Data.Applicable: instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Data.Applicable.ChurchTuple a b)
+ Data.Applicable: instance (GHC.Ix.Ix a, GHC.Ix.Ix b) => GHC.Ix.Ix (Data.Applicable.ChurchTuple a b)
+ Data.Applicable: instance Data.Data.Data Data.Applicable.ChurchBool
+ Data.Applicable: instance Data.Data.Data a => Data.Data.Data (Data.Applicable.ApplyTo a)
+ Data.Applicable: instance Data.Data.Data a => Data.Data.Data (Data.Applicable.ChurchNumeral a)
+ Data.Applicable: instance Data.Data.Data a => Data.Data.Data (Data.Applicable.GroupAction a)
+ Data.Applicable: instance Data.Foldable.Foldable (Data.Applicable.ChurchTuple a)
+ Data.Applicable: instance Data.Foldable.Foldable Data.Applicable.ApplyTo
+ Data.Applicable: instance Data.Foldable.Foldable Data.Applicable.ChurchNumeral
+ Data.Applicable: instance Data.Foldable.Foldable Data.Applicable.GroupAction
+ Data.Applicable: instance Data.Traversable.Traversable (Data.Applicable.ChurchTuple a)
+ Data.Applicable: instance Data.Traversable.Traversable Data.Applicable.ApplyTo
+ Data.Applicable: instance Data.Traversable.Traversable Data.Applicable.ChurchNumeral
+ Data.Applicable: instance Data.Traversable.Traversable Data.Applicable.GroupAction
+ Data.Applicable: instance GHC.Generics.Generic (Data.Applicable.ApplyAp f a b)
+ Data.Applicable: instance GHC.Generics.Generic (Data.Applicable.ApplyBind m a b)
+ Data.Applicable: instance GHC.Generics.Generic (Data.Applicable.ApplyTo a)
+ Data.Applicable: instance GHC.Generics.Generic (Data.Applicable.ChurchNumeral a)
+ Data.Applicable: instance GHC.Generics.Generic (Data.Applicable.ChurchTuple a b)
+ Data.Applicable: instance GHC.Generics.Generic (Data.Applicable.GroupAction a)
+ Data.Applicable: instance GHC.Generics.Generic Data.Applicable.ChurchBool
+ Data.Applicable: instance GHC.Ix.Ix Data.Applicable.ChurchBool
+ Data.Applicable: instance GHC.Ix.Ix a => GHC.Ix.Ix (Data.Applicable.ApplyTo a)
+ Data.Applicable: instance GHC.Ix.Ix a => GHC.Ix.Ix (Data.Applicable.ChurchNumeral a)
+ Data.Applicable: instance GHC.Ix.Ix a => GHC.Ix.Ix (Data.Applicable.GroupAction a)

Files

CHANGELOG.md view
@@ -1,8 +1,12 @@ # Revision history for applicable +## 0.3.0.0 -- 2022-06-27++* Added more instances.+ ## 0.2.0.0 -- 2022-06-27 -* Fixed not exporting constructors+* Fixed not exporting constructors.  ## 0.1.0.0 -- 2022-06-27 
Data/Applicable.hs view
@@ -1,8 +1,10 @@ {-# OPTIONS_HADDOCK show-extensions #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveDataTypeable #-}  {- | Module: Data.Applicable@@ -29,6 +31,9 @@  import Data.List (genericIndex) import Data.Bifunctor (Bifunctor)+import Data.Ix+import Data.Data+import GHC.Generics  -- | A class for types whose values can be applied. --   Instances are required to be uniquely determined by the applied and applied-to type.@@ -41,7 +46,7 @@  -- | A wrapper for values. --   Can be applied to a function '(GHC.Types.->)', applying the function to the inner value.-newtype ApplyTo a = AppTo { unAppTo :: a } deriving (Eq, Ord, Show, Read, Functor)+newtype ApplyTo a = AppTo { unAppTo :: a } deriving (Generic, Data, Eq, Ord, Show, Read, Ix, Functor, Foldable, Traversable)  instance Applicable (ApplyTo a) (a -> b) b where   AppTo x $* f = f x@@ -55,21 +60,21 @@  -- | A wrapper for functions in an applicative functor. --   Can be applied to an 'Applicative' functor, '(<*>)'-ing it on it.-newtype ApplyAp f a b = AppAp { unAppAp :: f (a -> b) } deriving Functor+newtype ApplyAp f a b = AppAp { unAppAp :: f (a -> b) } deriving (Generic, Functor)  instance Applicative f => Applicable (ApplyAp f a b) (f a) (f b) where   AppAp f $* xa = f <*> xa  -- | A wrapper for 'Control.Arrow.Kleisli' arrows. --   Can be applied to a 'Monad', '(>>=)'-ing it on it.-newtype ApplyBind m a b = AppBind { unAppBind :: a -> m b } deriving Functor+newtype ApplyBind m a b = AppBind { unAppBind :: a -> m b } deriving (Generic, Functor)  instance Monad m => Applicable (ApplyBind m a b) (m a) (m b) where   AppBind f $* xa = xa >>= f  -- | A wrapper for 'Semigroup' members, representing the associated group action. --   Can be applied to another member, '(<>)'-ing them.-newtype GroupAction a = GrpAct { unGrpAct :: a } deriving (Eq, Ord, Show, Read, Functor)+newtype GroupAction a = GrpAct { unGrpAct :: a } deriving (Generic, Data, Eq, Ord, Show, Read, Ix, Functor, Foldable, Traversable)  instance Semigroup a => Applicable (GroupAction a) a a where   GrpAct a $* b = a <> b@@ -78,7 +83,7 @@ --   When applied to a value, uses the Church encoding of Booleans. --   The Church encoding of Booleans is a binary function --   that returns its first argument for 'True', and its second for 'False'.-newtype ChurchBool = ChBool { unChBool :: Bool } deriving (Eq, Ord, Show, Read, Enum, Bounded)+newtype ChurchBool = ChBool { unChBool :: Bool } deriving (Generic, Data, Eq, Ord, Show, Read, Ix)  instance Applicable ChurchBool a (a -> a) where   ($*) (ChBool True) t _ = t@@ -91,7 +96,7 @@ -- | A wrapper for natural numbers (Approximated by 'Integral'). --   When applied to a value, uses the Church encoding of natural numbers. --   Church numerals represent the number _n_ as a function that take another function and repeatedly applies it _n_ times.-newtype ChurchNumeral a = ChNum { unChNum :: a } deriving (Eq, Ord, Show, Read, Functor)+newtype ChurchNumeral a = ChNum { unChNum :: a } deriving (Generic, Data, Eq, Ord, Show, Read, Ix, Functor, Foldable, Traversable)  instance Integral a => Applicable (ChurchNumeral a) (a -> a) (a -> a) where   ($*) (ChNum n) f x = genericIndex (iterate f x) n@@ -99,7 +104,7 @@ -- | A wrapper for tuples '(,)'. --   When applied to a value, uses the Church encoding of tuples. --   The Church encoding of tuples applies a function to the values inside a tuple.-newtype ChurchTuple a b = ChTup { unChTup :: (a, b) } deriving (Eq, Ord, Show, Read, Functor, Bifunctor)+newtype ChurchTuple a b = ChTup { unChTup :: (a, b) } deriving (Generic, Data, Eq, Ord, Show, Read, Ix, Functor, Foldable, Traversable, Bifunctor)  instance Applicable (ChurchTuple a b) (a -> b -> c) c where   ChTup (x, y) $* f = f x y
README.md view
applicable.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               applicable-version:            0.2.0.0+version:            0.3.0.0 synopsis:           A class for things that can be applied description:        A class for things that can be applied, and utility newtypes homepage:           https://github.com/schuelermine/applicable