diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-09-20 23:31:00 -0700 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-22 16:07:00 -0500 |
commit | a1bbb56f40b679f4841f0b044c0f5445ff6d3c5b (patch) | |
tree | 3d45011584fa680ef71c0f468dd3275acaed94f0 /libraries/base/Data/Traversable.hs | |
parent | 9f3e22b9eb2e67323f965b652c37fdd73628b007 (diff) | |
download | haskell-a1bbb56f40b679f4841f0b044c0f5445ff6d3c5b.tar.gz |
Doc-only fixes
* laws are capitalized definition lists, no emphasis on the labels
* adds missing hyperlinks
* fixes other misc. Haddock markup issues.
Diffstat (limited to 'libraries/base/Data/Traversable.hs')
-rw-r--r-- | libraries/base/Data/Traversable.hs | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/libraries/base/Data/Traversable.hs b/libraries/base/Data/Traversable.hs index 93c42258e2..a8647fdb28 100644 --- a/libraries/base/Data/Traversable.hs +++ b/libraries/base/Data/Traversable.hs @@ -76,27 +76,29 @@ import qualified GHC.List as List ( foldr ) -- -- A definition of 'traverse' must satisfy the following laws: -- --- [/naturality/] +-- [Naturality] -- @t . 'traverse' f = 'traverse' (t . f)@ -- for every applicative transformation @t@ -- --- [/identity/] --- @'traverse' Identity = Identity@ +-- [Identity] +-- @'traverse' 'Identity' = 'Identity'@ -- --- [/composition/] --- @'traverse' (Compose . 'fmap' g . f) = Compose . 'fmap' ('traverse' g) . 'traverse' f@ +-- [Composition] +-- @'traverse' ('Data.Functor.Compose.Compose' . 'fmap' g . f) +-- = 'Data.Functor.Compose.Compose' . 'fmap' ('traverse' g) . 'traverse' f@ -- -- A definition of 'sequenceA' must satisfy the following laws: -- --- [/naturality/] +-- [Naturality] -- @t . 'sequenceA' = 'sequenceA' . 'fmap' t@ -- for every applicative transformation @t@ -- --- [/identity/] --- @'sequenceA' . 'fmap' Identity = Identity@ +-- [Identity] +-- @'sequenceA' . 'fmap' 'Identity' = 'Identity'@ -- --- [/composition/] --- @'sequenceA' . 'fmap' Compose = Compose . 'fmap' 'sequenceA' . 'sequenceA'@ +-- [Composition] +-- @'sequenceA' . 'fmap' 'Data.Functor.Compose.Compose' +-- = 'Data.Functor.Compose.Compose' . 'fmap' 'sequenceA' . 'sequenceA'@ -- -- where an /applicative transformation/ is a function -- @@ -104,30 +106,14 @@ import qualified GHC.List as List ( foldr ) -- -- preserving the 'Applicative' operations, i.e. -- --- * @t ('pure' x) = 'pure' x@ --- --- * @t (x '<*>' y) = t x '<*>' t y@ --- --- and the identity functor @Identity@ and composition of functors @Compose@ --- are defined as --- --- > newtype Identity a = Identity a --- > --- > instance Functor Identity where --- > fmap f (Identity x) = Identity (f x) --- > --- > instance Applicative Identity where --- > pure x = Identity x --- > Identity f <*> Identity x = Identity (f x) --- > --- > newtype Compose f g a = Compose (f (g a)) --- > --- > instance (Functor f, Functor g) => Functor (Compose f g) where --- > fmap f (Compose x) = Compose (fmap (fmap f) x) --- > --- > instance (Applicative f, Applicative g) => Applicative (Compose f g) where --- > pure x = Compose (pure (pure x)) --- > Compose f <*> Compose x = Compose ((<*>) <$> f <*> x) +-- @ +-- t ('pure' x) = 'pure' x +-- t (f '<*>' x) = t f '<*>' t x +-- @ +-- +-- and the identity functor 'Identity' and composition functors +-- 'Data.Functor.Compose.Compose' are from "Data.Functor.Identity" and +-- "Data.Functor.Compose". -- -- (The naturality law is implied by parametricity.) -- |