Skip to content

Commit 2f11d6f

Browse files
committed
Rename id to identity
1 parent 6b142a5 commit 2f11d6f

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

src/Control/Applicative.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Data.Unit (Unit, unit)
2525
-- | Instances must satisfy the following laws in addition to the `Apply`
2626
-- | laws:
2727
-- |
28-
-- | - Identity: `(pure id) <*> v = v`
28+
-- | - Identity: `(pure identity) <*> v = v`
2929
-- | - Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`
3030
-- | - Homomorphism: `(pure f) <*> (pure x) = pure (f x)`
3131
-- | - Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`

src/Control/Apply.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Control.Apply
88

99
import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
1010
import Data.Function (const)
11-
import Control.Category (id)
11+
import Control.Category (identity)
1212

1313
-- | The `Apply` class provides the `(<*>)` which is used to apply a function
1414
-- | to an argument under a type constructor.
@@ -53,7 +53,7 @@ infixl 4 applyFirst as <*
5353

5454
-- | Combine two effectful actions, keeping only the result of the second.
5555
applySecond :: forall a b f. Apply f => f a -> f b -> f b
56-
applySecond a b = const id <$> a <*> b
56+
applySecond a b = const identity <$> a <*> b
5757

5858
infixl 4 applySecond as *>
5959

src/Control/Bind.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Control.Bind
1313

1414
import Control.Applicative (class Applicative, liftA1, pure, unless, when)
1515
import Control.Apply (class Apply, apply, (*>), (<*), (<*>))
16-
import Control.Category (id)
16+
import Control.Category (identity)
1717

1818
import Data.Function (flip)
1919
import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
@@ -81,7 +81,7 @@ instance discardUnit :: Discard Unit where
8181

8282
-- | Collapse two applications of a monadic type constructor into one.
8383
join :: forall a m. Bind m => m (m a) -> m a
84-
join m = m >>= id
84+
join m = m >>= identity
8585

8686
-- | Forwards Kleisli composition.
8787
-- |

src/Control/Category.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Control.Category
2-
( class Category, id
2+
( class Category, identity
33
, module Control.Semigroupoid
44
) where
55

@@ -12,9 +12,9 @@ import Control.Semigroupoid (class Semigroupoid, compose, (<<<), (>>>))
1212
-- | Instances must satisfy the following law in addition to the
1313
-- | `Semigroupoid` law:
1414
-- |
15-
-- | - Identity: `id <<< p = p <<< id = p`
15+
-- | - Identity: `identity <<< p = p <<< identity = p`
1616
class Semigroupoid a <= Category a where
17-
id :: forall t. a t t
17+
identity :: forall t. a t t
1818

1919
instance categoryFn :: Category (->) where
20-
id x = x
20+
identity x = x

src/Control/Semigroupoid.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Control.Semigroupoid where
22

33
-- | A `Semigroupoid` is similar to a [`Category`](#category) but does not
4-
-- | require an identity element `id`, just composable morphisms.
4+
-- | require an identity element `identity`, just composable morphisms.
55
-- |
66
-- | `Semigroupoid`s must satisfy the following law:
77
-- |

src/Data/Function.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Data.Function
88
, module Control.Category
99
) where
1010

11-
import Control.Category (id, compose, (<<<), (>>>))
11+
import Control.Category (identity, compose, (<<<), (>>>))
1212
import Data.Boolean (otherwise)
1313
import Data.Ord ((<=))
1414
import Data.Ring ((-))

src/Data/Functor.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Data.Unit (Unit, unit)
1919
-- |
2020
-- | Instances must satisfy the following laws:
2121
-- |
22-
-- | - Identity: `map id = id`
22+
-- | - Identity: `map identity = identity`
2323
-- | - Composition: `map (f <<< g) = map f <<< map g`
2424
class Functor f where
2525
map :: forall a b. (a -> b) -> f a -> f b

src/Data/Monoid/Endo.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Prelude
99
-- |
1010
-- | ``` purescript
1111
-- | Endo f <> Endo g == Endo (f <<< g)
12-
-- | mempty :: Endo _ == Endo id
12+
-- | mempty :: Endo _ == Endo identity
1313
-- | ```
1414
newtype Endo c a = Endo (c a a)
1515

@@ -26,4 +26,4 @@ instance semigroupEndo :: Semigroupoid c => Semigroup (Endo c a) where
2626
append (Endo a) (Endo b) = Endo (a <<< b)
2727

2828
instance monoidEndo :: Category c => Monoid (Endo c a) where
29-
mempty = Endo id
29+
mempty = Endo identity

src/Prelude.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Prelude
3131
import Control.Applicative (class Applicative, pure, liftA1, unless, when)
3232
import Control.Apply (class Apply, apply, (*>), (<*), (<*>))
3333
import Control.Bind (class Bind, bind, class Discard, discard, ifM, join, (<=<), (=<<), (>=>), (>>=))
34-
import Control.Category (class Category, id)
34+
import Control.Category (class Category, identity)
3535
import Control.Monad (class Monad, ap, liftM1, unlessM, whenM)
3636
import Control.Semigroupoid (class Semigroupoid, compose, (<<<), (>>>))
3737

0 commit comments

Comments
 (0)