diff --git a/exercises/diamond/examples/success-standard/src/Diamond.hs b/exercises/diamond/examples/success-standard/src/Diamond.hs index e287ef94a..24267b478 100644 --- a/exercises/diamond/examples/success-standard/src/Diamond.hs +++ b/exercises/diamond/examples/success-standard/src/Diamond.hs @@ -9,8 +9,8 @@ oneRow :: Char -> (Int, Int) -> String oneRow c (0, y) = pad y ++ [c] ++ pad y oneRow c (x, y) = pad y ++ [c] ++ pad x ++ [c] ++ pad y -diamond :: Char -> [String] -diamond = (\x -> x ++ tail (reverse x)) . mkTop . subtract 64 . ord +diamond :: Char -> Maybe [String] +diamond = Just . (\x -> x ++ tail (reverse x)) . mkTop . subtract 64 . ord where rows x = zip (0 : take (x-1) [1, 3..]) [x-1, x-2..0] mkTop = zipWith oneRow abc . rows abc = map chr [65..90] diff --git a/exercises/diamond/package.yaml b/exercises/diamond/package.yaml index ade7c5419..9c121dc79 100644 --- a/exercises/diamond/package.yaml +++ b/exercises/diamond/package.yaml @@ -1,5 +1,5 @@ name: diamond -version: 1.1.0.2 +version: 1.1.0.3 dependencies: - base diff --git a/exercises/diamond/src/Diamond.hs b/exercises/diamond/src/Diamond.hs index 21d8ccc8b..f31dee3fe 100644 --- a/exercises/diamond/src/Diamond.hs +++ b/exercises/diamond/src/Diamond.hs @@ -1,4 +1,4 @@ module Diamond (diamond) where -diamond :: Char -> [String] +diamond :: Char -> Maybe [String] diamond = error "You need to implement this function" diff --git a/exercises/diamond/test/Tests.hs b/exercises/diamond/test/Tests.hs index f83a60017..f50a85619 100644 --- a/exercises/diamond/test/Tests.hs +++ b/exercises/diamond/test/Tests.hs @@ -14,7 +14,7 @@ specs = describe "diamond" $ for_ cases test test Case{..} = it description assertion where - assertion = diamond input `shouldBe` expected + assertion = diamond input `shouldBe` Just expected data Case = Case { description :: String