packages feed

natural-transformation 0.3 → 0.3.1

raw patch · 3 files changed

+23/−7 lines, 3 filesdep ~natural-transformation

Dependency ranges changed: natural-transformation

Files

CHANGELOG.md view
@@ -1,3 +1,6 @@+# 0.3.1+* Adding `run` and `nat`.+ # 0.3 * Adding Object * Rolled Control.Transformation into Control.Natural
natural-transformation.cabal view
@@ -1,5 +1,5 @@ name:                natural-transformation-version:             0.3+version:             0.3.1 synopsis:            A natural transformation package. description:         A natural transformation transforms a container @f a@ into another                      container @g a@. Natural transformations act as functor morphisms@@ -40,7 +40,7 @@   main-is:             Properties.hs   build-depends:       base                   >= 4.7 && < 5                      , containers             >= 0.1 && < 0.6-                     , natural-transformation == 0.3+                     , natural-transformation == 0.3.1                      , quickcheck-instances   >= 0.1 && < 0.4                      , tasty                  >= 0.8 && < 0.12                      , tasty-quickcheck       >= 0.8 && < 0.9
src/Control/Natural.hs view
@@ -19,10 +19,13 @@ A data type and class for natural transformations. -} module Control.Natural-  ( -- * Type Synonym for a Natural Transformation-    type (~>)-    -- * Newtype for a Natural Transformation-  , (:~>)(..)+  ( -- * Newtype for a Natural Transformation+    (:~>)(..)+    -- * Type Synonym for a Natural Transformation+  , type (~>)+    -- * Conversion functions between the newtype and the synonym+  , run+  , nat     -- * Class for Natural Transformations   , Transformation(..)   ) where@@ -72,7 +75,17 @@ -- on abstract data types. class Transformation f g t | t -> f g where     -- | The invocation method for a natural transformation.-    (#) :: t -> f a -> g a+    (#) :: t -> forall a . f a -> g a  instance Transformation f g (f :~> g) where     Nat f # g = f g++-- | 'run' is the nonfix version of @#@. It is used to break natural+--   transformation wrappers, including ':~>'.+run :: Transformation f g t => t -> (forall a . f a -> g a)+run = (#)++-- | 'nat' builds our natural transformation abstraction out of+--    a natural transformation function.+nat :: (forall a . f a -> g a) -> f :~> g+nat = Nat