From da75a819f81e04f81ceda0bc38eb4f78f80b86b4 Mon Sep 17 00:00:00 2001 From: Erik Simmler Date: Sat, 17 Dec 2016 17:15:34 -0500 Subject: [PATCH] Update elm files to 0.18 --- exercises/allergies/Allergies.example.elm | 4 ++-- exercises/bob/Tests.elm | 2 +- .../DifferenceOfSquares.example.elm | 2 +- .../grade-school/GradeSchool.example.elm | 2 +- exercises/list-ops/Tests.elm | 24 +++++++++---------- exercises/robot-simulator/Tests.elm | 4 ++-- .../RunLengthEncoding.example.elm | 4 ++-- exercises/strain/Tests.elm | 2 +- exercises/sublist/Tests.elm | 6 ++--- .../SumOfMultiples.example.elm | 2 +- exercises/triangle/Triangle.example.elm | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/exercises/allergies/Allergies.example.elm b/exercises/allergies/Allergies.example.elm index 7da7552..c1c1c70 100644 --- a/exercises/allergies/Allergies.example.elm +++ b/exercises/allergies/Allergies.example.elm @@ -12,9 +12,9 @@ isAllergicTo name score = toList : Int -> List String toList score = allergies - |> List.indexedMap (\i n -> ( Bitwise.shiftLeft 1 i, n )) + |> List.indexedMap (\i n -> ( Bitwise.shiftLeftBy i 1, n )) |> List.filter (\( s, n ) -> Bitwise.and s score > 0) - |> List.map snd + |> List.map Tuple.second allergies : List String diff --git a/exercises/bob/Tests.elm b/exercises/bob/Tests.elm index d55e7aa..eec7564 100644 --- a/exercises/bob/Tests.elm +++ b/exercises/bob/Tests.elm @@ -137,7 +137,7 @@ listOfCharacters length characterList = gibberish : Int -> Random.Generator Char -> String gibberish length characterList = - fst (Random.step (Random.map String.fromList (listOfCharacters length characterList)) (Random.initialSeed 424242)) + Tuple.first (Random.step (Random.map String.fromList (listOfCharacters length characterList)) (Random.initialSeed 424242)) uppercaseGibberish : Int -> String diff --git a/exercises/difference-of-squares/DifferenceOfSquares.example.elm b/exercises/difference-of-squares/DifferenceOfSquares.example.elm index b1cec55..5fb3888 100644 --- a/exercises/difference-of-squares/DifferenceOfSquares.example.elm +++ b/exercises/difference-of-squares/DifferenceOfSquares.example.elm @@ -12,7 +12,7 @@ squareOfSum n = sumOfSquares : Int -> Int sumOfSquares n = - List.sum (List.map (\m -> m * m) [0..n]) + List.sum (List.map (\m -> m * m) (List.range 0 n)) difference : Int -> Int diff --git a/exercises/grade-school/GradeSchool.example.elm b/exercises/grade-school/GradeSchool.example.elm index df1e6c3..460a2c1 100644 --- a/exercises/grade-school/GradeSchool.example.elm +++ b/exercises/grade-school/GradeSchool.example.elm @@ -37,4 +37,4 @@ studentsInGrade grade school = allStudents : School -> List ( Grade, List Student ) allStudents school = - Dict.toList school |> List.sortBy fst + Dict.toList school |> List.sortBy Tuple.first diff --git a/exercises/list-ops/Tests.elm b/exercises/list-ops/Tests.elm index 2336eeb..325acdf 100644 --- a/exercises/list-ops/Tests.elm +++ b/exercises/list-ops/Tests.elm @@ -14,57 +14,57 @@ tests = [ test "empty list" <| \() -> Expect.equal 0 (ListOps.length []) , test "non-empty list" <| - \() -> Expect.equal 4 (ListOps.length [1..4]) + \() -> Expect.equal 4 (ListOps.length (List.range 1 4)) ] , describe "reverse" [ test "empty list" <| \() -> Expect.equal [] (ListOps.reverse []) , test "non-empty list" <| - \() -> Expect.equal [ 4, 3, 2, 1 ] (ListOps.reverse [1..4]) + \() -> Expect.equal [ 4, 3, 2, 1 ] (ListOps.reverse (List.range 1 4)) ] , describe "map" [ test "empty list" <| \() -> Expect.equal [] (ListOps.map ((+) 1) []) , test "non-empty list" <| - \() -> Expect.equal [2..5] (ListOps.map ((+) 1) [1..4]) + \() -> Expect.equal (List.range 2 5) (ListOps.map ((+) 1) (List.range 1 4)) ] , describe "filter" [ test "empty list" <| \() -> Expect.equal [] (ListOps.filter (\_ -> True) []) , test "non-empty list" <| - \() -> Expect.equal [ 2, 4 ] (ListOps.filter (\x -> x % 2 == 0) [1..4]) + \() -> Expect.equal [ 2, 4 ] (ListOps.filter (\x -> x % 2 == 0) (List.range 1 4)) ] , describe "foldl" [ test "empty list" <| \() -> Expect.equal 0 (ListOps.foldl (+) 0 []) , test "non-empty list" <| - \() -> Expect.equal 10 (ListOps.foldl (+) 0 [1..4]) + \() -> Expect.equal 10 (ListOps.foldl (+) 0 (List.range 1 4)) , test "direction" <| - \() -> Expect.equal [ 4, 3, 2, 1 ] (ListOps.foldl (::) [] [1..4]) + \() -> Expect.equal [ 4, 3, 2, 1 ] (ListOps.foldl (::) [] (List.range 1 4)) ] , describe "foldr" [ test "empty list" <| \() -> Expect.equal 0 (ListOps.foldr (+) 0 []) , test "non-empty list" <| - \() -> Expect.equal 10 (ListOps.foldr (+) 0 [1..4]) + \() -> Expect.equal 10 (ListOps.foldr (+) 0 (List.range 1 4)) , test "direction" <| - \() -> Expect.equal [1..4] (ListOps.foldr (::) [] [1..4]) + \() -> Expect.equal (List.range 1 4) (ListOps.foldr (::) [] (List.range 1 4)) ] , describe "append" [ test "empty lists" <| \() -> Expect.equal [] (ListOps.append [] []) , test "empty and non-empty lists" <| - \() -> Expect.equal [1..4] (ListOps.append [] [1..4]) + \() -> Expect.equal (List.range 1 4) (ListOps.append [] (List.range 1 4)) , test "non-empty and empty lists" <| - \() -> Expect.equal [1..4] (ListOps.append [1..4] []) + \() -> Expect.equal (List.range 1 4) (ListOps.append (List.range 1 4) []) , test "non-empty lists" <| - \() -> Expect.equal [1..8] (ListOps.append [1..4] [5..8]) + \() -> Expect.equal (List.range 1 8) (ListOps.append (List.range 1 4) (List.range 5 8)) ] , describe "concat" [ test "empty list" <| \() -> Expect.equal [] (ListOps.concat []) , test "list of lists" <| - \() -> Expect.equal [1..10] (ListOps.concat [ [1..3], [], [4..7], [8..10] ]) + \() -> Expect.equal (List.range 1 10) (ListOps.concat [ List.range 1 3, [], List.range 4 7, List.range 8 10 ]) ] ] diff --git a/exercises/robot-simulator/Tests.elm b/exercises/robot-simulator/Tests.elm index b25a192..804de7d 100644 --- a/exercises/robot-simulator/Tests.elm +++ b/exercises/robot-simulator/Tests.elm @@ -33,7 +33,7 @@ tests = ] ) , describe "turn right" - ([1..3] + ((List.range 1 3) |> List.scanl (\_ r -> turnRight r) defaultRobot |> List.map .bearing |> assertionList [ North, East, South, West ] @@ -41,7 +41,7 @@ tests = ) , describe "turn left" - ([1..3] + ((List.range 1 3) |> List.scanl (\_ r -> turnLeft r) defaultRobot |> List.map .bearing |> assertionList [ North, West, South, East ] diff --git a/exercises/run-length-encoding/RunLengthEncoding.example.elm b/exercises/run-length-encoding/RunLengthEncoding.example.elm index 0e23b03..a300988 100644 --- a/exercises/run-length-encoding/RunLengthEncoding.example.elm +++ b/exercises/run-length-encoding/RunLengthEncoding.example.elm @@ -37,7 +37,7 @@ countChars current counted = [ ( 1, current ) ] -stringifyCounts : ( number, Char ) -> String +stringifyCounts : ( comparable, Char ) -> String stringifyCounts ( count, char ) = if count > 1 then toString count ++ fromChar char @@ -51,7 +51,7 @@ decode string = |> Regex.find Regex.All (Regex.regex "(\\d+)|(\\D)") |> List.map .match |> List.foldl expandCounts ( "", Nothing ) - |> fst + |> Tuple.first expandCounts : String -> ( String, Maybe Int ) -> ( String, Maybe Int ) diff --git a/exercises/strain/Tests.elm b/exercises/strain/Tests.elm index cf0daa6..2d89227 100644 --- a/exercises/strain/Tests.elm +++ b/exercises/strain/Tests.elm @@ -23,7 +23,7 @@ isFirstLetter letter word = (String.left 1 word) == letter -lessThanTen : number -> Bool +lessThanTen : comparable -> Bool lessThanTen num = num < 10 diff --git a/exercises/sublist/Tests.elm b/exercises/sublist/Tests.elm index 01fd846..892e93e 100644 --- a/exercises/sublist/Tests.elm +++ b/exercises/sublist/Tests.elm @@ -31,9 +31,9 @@ tests = , test "partially matching sublist at start" <| \() -> Expect.equal Sublist (sublist [ 1, 1, 2 ] [ 1, 1, 1, 2 ]) , test "sublist early in huge list" <| - \() -> Expect.equal Sublist (sublist [ 3, 4, 5 ] [1..100000]) + \() -> Expect.equal Sublist (sublist [ 3, 4, 5 ] (List.range 1 100000)) , test "huge sublist not in list" <| - \() -> Expect.equal Unequal (sublist [10..5001] [1..5000]) + \() -> Expect.equal Unequal (sublist (List.range 10 5001) (List.range 1 5000)) , test "superlist at start" <| \() -> Expect.equal Superlist (sublist [ 1, 2, 3, 4, 5 ] [ 1, 2, 3 ]) , test "superlist in middle" <| @@ -43,7 +43,7 @@ tests = , test "partially matching superlist at start" <| \() -> Expect.equal Superlist (sublist [ 1, 1, 1, 2 ] [ 1, 1, 2 ]) , test "superlist early in huge list" <| - \() -> Expect.equal Superlist (sublist [1..100000] [ 3, 4, 5 ]) + \() -> Expect.equal Superlist (sublist (List.range 1 100000) [ 3, 4, 5 ]) , test "recurring values sublist" <| \() -> Expect.equal Sublist (sublist [ 1, 2, 1, 2, 3 ] [ 1, 2, 3, 1, 2, 1, 2, 3, 2, 1 ]) , test "recurring values unequal" <| diff --git a/exercises/sum-of-multiples/SumOfMultiples.example.elm b/exercises/sum-of-multiples/SumOfMultiples.example.elm index 940413d..59a4cff 100644 --- a/exercises/sum-of-multiples/SumOfMultiples.example.elm +++ b/exercises/sum-of-multiples/SumOfMultiples.example.elm @@ -3,7 +3,7 @@ module SumOfMultiples exposing (..) sumOfMultiples : List Int -> Int -> Int sumOfMultiples multiples limit = - List.sum (List.filter (inMultiples multiples) [1..(limit - 1)]) + List.sum (List.filter (inMultiples multiples) (List.range 1 (limit - 1))) inMultiples : List Int -> Int -> Bool diff --git a/exercises/triangle/Triangle.example.elm b/exercises/triangle/Triangle.example.elm index 84b129d..6eb77e1 100644 --- a/exercises/triangle/Triangle.example.elm +++ b/exercises/triangle/Triangle.example.elm @@ -14,7 +14,7 @@ version = 2 -triangleKind : number -> number -> number -> Result String Triangle +triangleKind : comparable -> comparable -> comparable -> Result String Triangle triangleKind x y z = if x <= 0 || y <= 0 || z <= 0 then Err "Invalid lengths"