on master help sign in
rename: id => identity
af987b1Evan Czaplicki
changelog.md+1
@@ -17,6 +17,7 @@
17
17
18#### Breaking Changes:
18#### Breaking Changes:
19
19
20+ * Rename Basics.id to Basics.identity
20 * Rename Basics.div to (//)
21 * Rename Basics.div to (//)
21 * Rename Basics.mod to (%)
22 * Rename Basics.mod to (%)
22 * Rename Maybe.maybe to Maybe.extract
23 * Rename Maybe.maybe to Maybe.extract
libraries/Basics.elm+6−4
@@ -46,7 +46,7 @@ which happen to be radians.
46@docs fst, snd
46@docs fst, snd
47
47
48# Higher-Order Helpers
48# Higher-Order Helpers
49−@docs id, always, (<|), (|>), (.), flip, curry, uncurry
49+@docs identity, always, (<|), (|>), (.), flip, curry, uncurry
50
50
51-}
51-}
52
52
@@ -356,9 +356,11 @@ infixr 9 .
356infixr 0 <|
356infixr 0 <|
357infixl 0 |>
357infixl 0 |>
358
358
359−{-| Given a value, returns exactly the same value. -}
359+{-| Given a value, returns exactly the same value. This is called
360−id : a -> a
360+[the identity function](http://en.wikipedia.org/wiki/Identity_function).
361−id x = x
361+-}
362+identity : a -> a
363+identity x = x
362
364
363{-| Creates a [constant function](http://en.wikipedia.org/wiki/Constant_function),
365{-| Creates a [constant function](http://en.wikipedia.org/wiki/Constant_function),
364a function that *always* returns the same value regardless of what input you give.
366a 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.
33import Basics (..)
33import Basics (..)
34import List
34import List
35import Either (Either(Left, Right))
35import Either (Either(Left, Right))
36−import Transform2D (Transform2D, identity)
36+import Transform2D (Transform2D)
37+import Transform2D as T
37import Native.Graphics.Collage
38import Native.Graphics.Collage
38import Graphics.Element (Element)
39import Graphics.Element (Element)
39import Color (Color, black, Gradient)
40import Color (Color, black, Gradient)
@@ -153,7 +154,7 @@ toForm e = form (FElement e)
153as a single unit, making it possible to build small, modular components.
154as a single unit, making it possible to build small, modular components.
154-}
155-}
155group : [Form] -> Form
156group : [Form] -> Form
156−group fs = form (FGroup identity fs)
157+group fs = form (FGroup T.identity fs)
157
158
158{-| Flatten many forms into a single `Form` and then apply a matrix
159{-| Flatten many forms into a single `Form` and then apply a matrix
159transformation.
160transformation.
tests/libraries/Test/Array.elm+2−2
@@ -20,10 +20,10 @@ tests : Test
20tests =
20tests =
21 let creationTests = suite "Creation"
21 let creationTests = suite "Creation"
22 [ test "empty" <| assertEqual Array.empty (Array.fromList [])
22 [ 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])
24 , test "initialize 2" <| assertEqual (Array.initialize 4 (\n -> n*n)) (Array.fromList [0,1,4,9])
24 , test "initialize 2" <| assertEqual (Array.initialize 4 (\n -> n*n)) (Array.fromList [0,1,4,9])
25 , test "initialize 3" <| assertEqual (Array.initialize 4 (always 0)) (Array.fromList [0,0,0,0])
25 , 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
27 , test "initialize 4" <| assertEqual (Array.initialize 2 (always 0)) (Array.fromList [0,0])
27 , test "initialize 4" <| assertEqual (Array.initialize 2 (always 0)) (Array.fromList [0,0])
28 , test "repeat" <| assertEqual (Array.repeat 5 40) (Array.fromList [40,40,40,40,40])
28 , test "repeat" <| assertEqual (Array.repeat 5 40) (Array.fromList [40,40,40,40,40])
29 , test "repeat 2" <| assertEqual (Array.repeat 5 0) (Array.fromList [0,0,0,0,0])
29 , 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 (..)
8tests : Test
8tests : Test
9tests =
9tests =
10 let partitionTests =
10 let partitionTests =
11− let p1 = id
11+ let p1 = identity
12 p2 x = x < 3
12 p2 x = x < 3
13 isEven n = n % 2 == 0
13 isEven n = n % 2 == 0
14 in suite "partition Tests" [ test "simple partition" <| assertEqual ([True],[False]) (List.partition p1 [False, True]),
14 in suite "partition Tests" [ test "simple partition" <| assertEqual ([True],[False]) (List.partition p1 [False, True]),