Skip to content

Commit

Permalink
rename function to arePaired
Browse files Browse the repository at this point in the history
  • Loading branch information
lpalma committed Apr 6, 2017
1 parent e9cad1b commit c25f3d2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Brackets (isPaired) where
module Brackets (arePaired) where

data BracketType = Opening | Closing
data Stack a = Empty | Elem a (Stack a)
Expand All @@ -10,8 +10,8 @@ pop :: Stack Char -> Stack Char
pop Empty = Empty
pop (Elem _ stack) = stack

isPaired :: String -> Bool
isPaired xs = checkBalance xs Empty
arePaired :: String -> Bool
arePaired xs = checkBalance xs Empty

checkBalance :: String -> Stack Char -> Bool
checkBalance [] Empty = True
Expand Down
6 changes: 3 additions & 3 deletions exercises/bracket-push/src/Brackets.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Brackets (isPaired) where
module Brackets (arePaired) where

isPaired :: String -> Bool
isPaired xs = error "You need to implement this function."
arePaired :: String -> Bool
arePaired xs = error "You need to implement this function."
4 changes: 2 additions & 2 deletions exercises/bracket-push/test/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Data.Foldable (for_)
import Test.Hspec (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)

import Brackets (isPaired)
import Brackets (arePaired)

main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs
Expand All @@ -13,7 +13,7 @@ specs :: Spec
specs = describe "bracket-push" $
describe "isPaired" $ for_ cases test
where
test Case{..} = it description $ isPaired input `shouldBe` expected
test Case{..} = it description $ arePaired input `shouldBe` expected

-- Adapted from
-- Source: exercism/x-common/exercises/bracket-push/canonical-data.json
Expand Down

0 comments on commit c25f3d2

Please sign in to comment.