diff --git a/exercises/anagram/Anagram.example b/exercises/anagram/Anagram.example index 6703041..c641751 100644 --- a/exercises/anagram/Anagram.example +++ b/exercises/anagram/Anagram.example @@ -6,8 +6,11 @@ import String exposing (toLower, toList) detect : String -> List String -> List String detect word candidates = let - original = toLower word - ref = normalize word + original = + toLower word + + ref = + normalize word in List.filter (\w -> normalize w == ref && toLower w /= original) candidates diff --git a/exercises/difference-of-squares/DifferenceOfSquares.example b/exercises/difference-of-squares/DifferenceOfSquares.example index 518c070..2d71d3e 100644 --- a/exercises/difference-of-squares/DifferenceOfSquares.example +++ b/exercises/difference-of-squares/DifferenceOfSquares.example @@ -4,7 +4,8 @@ module DifferenceOfSquares (..) where squareOfSum : Int -> Int squareOfSum n = let - sum = n * (n + 1) // 2 + sum = + n * (n + 1) // 2 in sum * sum diff --git a/exercises/raindrops/Raindrops.example b/exercises/raindrops/Raindrops.example index fc91fe1..79dfc82 100644 --- a/exercises/raindrops/Raindrops.example +++ b/exercises/raindrops/Raindrops.example @@ -1,4 +1,4 @@ -module Raindrops where +module Raindrops (..) where import String @@ -7,10 +7,20 @@ raindrops : Int -> String raindrops number = let drops = - [ if number % 3 == 0 then "Pling" else "" - , if number % 5 == 0 then "Plang" else "" - , if number % 7 == 0 then "Plong" else "" + [ if number % 3 == 0 then + "Pling" + else + "" + , if number % 5 == 0 then + "Plang" + else + "" + , if number % 7 == 0 then + "Plong" + else + "" ] + result = String.join "" drops in diff --git a/exercises/rna-transcription/RNATranscription.example b/exercises/rna-transcription/RNATranscription.example index cb94087..80c83b9 100644 --- a/exercises/rna-transcription/RNATranscription.example +++ b/exercises/rna-transcription/RNATranscription.example @@ -13,16 +13,29 @@ toRNA dna = |> Result.map (String.join "") + -- Copied from elm-result-extra + + resultExtraCombine : List (Result x a) -> Result x (List a) -resultExtraCombine = List.foldr (Result.map2 (::)) (Ok []) +resultExtraCombine = + List.foldr (Result.map2 (::)) (Ok []) toRNANucleotide : Char -> Result Char Char toRNANucleotide nuc = case nuc of - 'C' -> Ok 'G' - 'G' -> Ok 'C' - 'A' -> Ok 'U' - 'T' -> Ok 'A' - _ -> Err nuc + 'C' -> + Ok 'G' + + 'G' -> + Ok 'C' + + 'A' -> + Ok 'U' + + 'T' -> + Ok 'A' + + _ -> + Err nuc diff --git a/exercises/run-length-encoding/RunLengthEncoding.example b/exercises/run-length-encoding/RunLengthEncoding.example index ebacc07..8c6028b 100644 --- a/exercises/run-length-encoding/RunLengthEncoding.example +++ b/exercises/run-length-encoding/RunLengthEncoding.example @@ -5,11 +5,13 @@ import List exposing (head, tail) import Maybe exposing (withDefault) import Regex + {- To the unaware: this was written by a very green elmer, so don't consider it an idiomatic exemplar to emulate. -} + encode : String -> String encode string = String.toList string