on master help sign in
rename: id => identity
commitaf987b18a5aa5dc53061bb5a36612878962b7c43 authorEvan Czaplicki <info@elm-lang.org> dateTue 12 Aug 2014, 14:40 (12 years ago) parentb183f17
5 files changed+13−9
changelog.md+1 libraries/Basics.elm+6−4 libraries/Graphics/Collage.elm+3−2 tests/libraries/Test/Array.elm+2−2 tests/libraries/Test/List.elm+1−1
changelog.md+1
@@ -17,6 +17,7 @@
1717
1818#### Breaking Changes:
1919
20+ * Rename Basics.id to Basics.identity
2021 * Rename Basics.div to (//)
2122 * Rename Basics.mod to (%)
2223 * Rename Maybe.maybe to Maybe.extract
libraries/Basics.elm+6−4
@@ -46,7 +46,7 @@ which happen to be radians.
4646@docs fst, snd
4747
4848# Higher-Order Helpers
49−@docs id, always, (<|), (|>), (.), flip, curry, uncurry
49+@docs identity, always, (<|), (|>), (.), flip, curry, uncurry
5050
5151-}
5252
@@ -356,9 +356,11 @@ infixr 9 .
356356infixr 0 <|
357357infixl 0 |>
358358
359−{-| Given a value, returns exactly the same value. -}
360−id : a -> a
361−id x = x
359+{-| Given a value, returns exactly the same value. This is called
360+[the identity function](http://en.wikipedia.org/wiki/Identity_function).
361+-}
362+identity : a -> a
363+identity x = x
362364
363365{-| Creates a [constant function](http://en.wikipedia.org/wiki/Constant_function),
364366a function that *always* returns the same value regardless of what input you give.
libraries/Graphics/Collage.elm+3−2
@@ -33,7 +33,8 @@ it as a single unit.
3333import Basics (..)
3434import List
3535import Either (Either(Left, Right))
36−import Transform2D (Transform2D, identity)
36+import Transform2D (Transform2D)
37+import Transform2D as T
3738import Native.Graphics.Collage
3839import Graphics.Element (Element)
3940import Color (Color, black, Gradient)
@@ -153,7 +154,7 @@ toForm e = form (FElement e)
153154as a single unit, making it possible to build small, modular components.
154155-}
155156group : [Form] -> Form
156−group fs = form (FGroup identity fs)
157+group fs = form (FGroup T.identity fs)
157158
158159{-| Flatten many forms into a single `Form` and then apply a matrix
159160transformation.
tests/libraries/Test/Array.elm+2−2
@@ -20,10 +20,10 @@ tests : Test
2020tests =
2121 let creationTests = suite "Creation"
2222 [ test "empty" <| assertEqual Array.empty (Array.fromList [])
23− , test "initialize" <| assertEqual (Array.initialize 4 id) (Array.fromList [0,1,2,3])
23+ , test "initialize" <| assertEqual (Array.initialize 4 identity) (Array.fromList [0,1,2,3])
2424 , test "initialize 2" <| assertEqual (Array.initialize 4 (\n -> n*n)) (Array.fromList [0,1,4,9])
2525 , test "initialize 3" <| assertEqual (Array.initialize 4 (always 0)) (Array.fromList [0,0,0,0])
26− , test "initialize Empty" <| assertEqual (Array.initialize 0 id) Array.empty
26+ , test "initialize Empty" <| assertEqual (Array.initialize 0 identity) Array.empty
2727 , test "initialize 4" <| assertEqual (Array.initialize 2 (always 0)) (Array.fromList [0,0])
2828 , test "repeat" <| assertEqual (Array.repeat 5 40) (Array.fromList [40,40,40,40,40])
2929 , test "repeat 2" <| assertEqual (Array.repeat 5 0) (Array.fromList [0,0,0,0,0])
tests/libraries/Test/List.elm+1−1
@@ -8,7 +8,7 @@ import ElmTest.Test (..)
88tests : Test
99tests =
1010 let partitionTests =
11− let p1 = id
11+ let p1 = identity
1212 p2 x = x < 3
1313 isEven n = n % 2 == 0
1414 in suite "partition Tests" [ test "simple partition" <| assertEqual ([True],[False]) (List.partition p1 [False, True]),