Skip to content

Commit

Permalink
Resolve ku-fpg#11. Rename run to unwrapNT and nat to wrapNT
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Oct 20, 2016
1 parent 265efd3 commit 8e900d2
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/Control/Natural.hs
Expand Up @@ -24,8 +24,8 @@ module Control.Natural
-- * Type Synonym for a Natural Transformation
, type (~>)
-- * Conversion functions between the newtype and the synonym
, run
, nat
, wrapNT
, unwrapNT
-- * Class for Natural Transformations
, Transformation(..)
) where
Expand Down Expand Up @@ -76,12 +76,15 @@ class Transformation f g t | t -> f g where
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 = (#)
-- | 'wrapNT' builds our natural transformation abstraction out of
-- a natural transformation function.
--
-- An alias to 'NT' provided for symmetry with 'unwrapNT'.
--
wrapNT :: (forall a . f a -> g a) -> f :~> g
wrapNT = Nat

-- | 'nat' builds our natural transformation abstraction out of
-- a natural transformation function.
nat :: (forall a . f a -> g a) -> f :~> g
nat = Nat
-- | 'applyNT' is the nonfix version of @#@. It is used to break natural
-- transformation wrappers, including ':~>'.
unwrapNT :: Transformation f g t => t -> (forall a . f a -> g a)
unwrapNT = (#)

0 comments on commit 8e900d2

Please sign in to comment.