packages feed

natural-transformation 0.1 → 0.2

raw patch · 5 files changed

+38/−26 lines, 5 filesdep ~basedep ~natural-transformationPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, natural-transformation

API changes (from Hackage documentation)

+ Control.Natural: type (~>) f g = forall x. f x -> g x
- Control.Natural: ($$) :: (:~>) f g -> forall x. f x -> g x
+ Control.Natural: ($$) :: (:~>) f g -> f ~> g
- Control.Natural: Nat :: (forall x. f x -> g x) -> (:~>) f g
+ Control.Natural: Nat :: f ~> g -> (:~>) f g

Files

CHANGELOG.md view
@@ -1,2 +1,6 @@+# 0.2+* Require GHC 7.6 or greater+* Exposed `~>` type synonym+ # 0.1 * Initial commit
natural-transformation.cabal view
@@ -1,5 +1,5 @@ name:                natural-transformation-version:             0.1+version:             0.2 synopsis:            A natural transformation package. description:         A natural transformation transforms a container @f a@ into another                      container @g a@ while preserving the internal structure. Natural@@ -24,7 +24,7 @@ library   exposed-modules:     Control.Natural                        Control.Transformation-  build-depends:       base >= 3 && < 5+  build-depends:       base >= 4.6 && < 5   hs-source-dirs:      src   default-language:    Haskell2010   ghc-options:         -Wall@@ -32,9 +32,9 @@ test-suite natural-transformation-properties   type:                exitcode-stdio-1.0   main-is:             Properties.hs-  build-depends:       base                   >= 4.5 && < 5+  build-depends:       base                   >= 4.6 && < 5                      , containers             >= 0.1 && < 0.6-                     , natural-transformation == 0.1+                     , natural-transformation == 0.2                      , quickcheck-instances   >= 0.1 && < 0.4                      , tasty                  >= 0.8 && < 0.11                      , tasty-quickcheck       >= 0.8 && < 0.9
src/Control/Natural.hs view
@@ -1,23 +1,21 @@-{-# LANGUAGE CPP, FlexibleInstances, RankNTypes, TypeFamilies, TypeOperators #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE TypeOperators #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 && MIN_VERSION_base(4,7,0)+#if MIN_VERSION_base(4,7,0) # define LANGUAGE_PolyKinds {-# LANGUAGE PolyKinds #-} #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708+#if __GLASGOW_HASKELL__ >= 708 # define LANGUAGE_DeriveDataTypeable {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE Safe #-} #else {-# LANGUAGE ScopedTypeVariables #-}-#endif--#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-# if defined(LANGUAGE_DeriveDataTypeable)-{-# LANGUAGE Safe #-}-# else {-# LANGUAGE Trustworthy #-}-# endif #endif  {-|@@ -29,7 +27,7 @@  A data type for natural transformations. -}-module Control.Natural ((:~>)(..)) where+module Control.Natural ((~>)(), (:~>)(..)) where  #if defined(LANGUAGE_PolyKinds) import qualified Control.Category as C (Category(..))@@ -44,9 +42,13 @@ -- Code adapted, with permission, from Edward Kmett's @indexed@ package. --------------------------------------------------------------------------- -infixr 0 :~>, $$+infixr 0 ~> -- | A natural transformation from @f@ to @g@.-newtype f :~> g = Nat { ($$) :: forall x. f x -> g x }+type f ~> g = forall x. f x -> g x++infixr 0 :~>, $$+-- | A natural transformation suitable for storing in a container.+newtype f :~> g = Nat { ($$) :: f ~> g } #if defined(LANGUAGE_DeriveDataTypeable)   deriving Typeable #else
src/Control/Transformation.hs view
@@ -1,14 +1,14 @@-{-# LANGUAGE CPP, FlexibleInstances, FunctionalDependencies,-             MultiParamTypeClasses, TypeOperators #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE Safe #-}+{-# LANGUAGE TypeOperators #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 && MIN_VERSION_base(4,7,0)+#if MIN_VERSION_base(4,7,0) {-# LANGUAGE PolyKinds #-} #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Safe #-}-#endif- {-| Module:      Control.Transformation Copyright:   (C) 2015 The University of Kansas@@ -27,11 +27,16 @@ -- (typically 'Functor's). --  -- The order of arguments allows the use of @GeneralizedNewtypeDeriving@ to wrap--- a 'Natural', but maintain the 'Transformation' constraint. Thus, '#' can be used+-- a ':~>', but maintain the 'Transformation' constraint. Thus, @#@ can be used -- 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++-- {-# RULES "natural free theorem" [~] +--     forall h (r :: (Functor f, Functor g, Transformation f g t) => t) . +--     fmap h . (r #) = (r #) . fmap h +--   #-}  instance Transformation f g (f :~> g) where     Nat f # g = f g
tests/Properties.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE CPP, TypeOperators #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE TypeOperators #-} {-| Module:      Main Copyright:   (C) 2015 The University of Kansas