Skip to content

Commit 766bb77

Browse files
authored
Merge pull request #504 from lpalma/add-explicit-args-to-exercises-p1
Add explicit args to Exercises - Part 1
2 parents 7b52f43 + 3223c18 commit 766bb77

File tree

16 files changed

+49
-49
lines changed

16 files changed

+49
-49
lines changed

exercises/allergies/src/Allergies.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data Allergen = Eggs
1111
deriving (Eq)
1212

1313
allergies :: Int -> [Allergen]
14-
allergies = error "You need to implement this function."
14+
allergies score = error "You need to implement this function."
1515

1616
isAllergicTo :: Allergen -> Int -> Bool
17-
isAllergicTo = error "You need to implement this function."
17+
isAllergicTo allergen score = error "You need to implement this function."

exercises/atbash-cipher/src/Atbash.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Atbash (decode, encode) where
22

33
decode :: String -> String
4-
decode = error "You need to implement this function."
4+
decode phrase = error "You need to implement this function."
55

66
encode :: String -> String
7-
encode = error "You need to implement this function."
7+
encode phrase = error "You need to implement this function."

exercises/bank-account/src/BankAccount.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ module BankAccount
99
data BankAccount = Dummy
1010

1111
closeAccount :: BankAccount -> IO ()
12-
closeAccount = error "You need to implement this function."
12+
closeAccount account = error "You need to implement this function."
1313

1414
getBalance :: BankAccount -> IO (Maybe Integer)
15-
getBalance = error "You need to implement this function."
15+
getBalance account = error "You need to implement this function."
1616

1717
incrementBalance :: BankAccount -> Integer -> IO (Maybe Integer)
18-
incrementBalance = error "You need to implement this function."
18+
incrementBalance account amount = error "You need to implement this function."
1919

2020
openAccount :: IO BankAccount
2121
openAccount = error "You need to implement this function."

exercises/binary-search-tree/src/BST.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ module BST
1313
data BST a = Dummy deriving (Eq, Show)
1414

1515
bstLeft :: BST a -> Maybe (BST a)
16-
bstLeft = error "You need to implement this function."
16+
bstLeft tree = error "You need to implement this function."
1717

1818
bstRight :: BST a -> Maybe (BST a)
19-
bstRight = error "You need to implement this function."
19+
bstRight tree = error "You need to implement this function."
2020

2121
bstValue :: BST a -> Maybe a
22-
bstValue = error "You need to implement this function."
22+
bstValue tree = error "You need to implement this function."
2323

2424
empty :: BST a
2525
empty = error "You need to implement this function."
2626

2727
fromList :: Ord a => [a] -> BST a
28-
fromList = error "You need to implement this function."
28+
fromList xs = error "You need to implement this function."
2929

3030
insert :: Ord a => a -> BST a -> BST a
31-
insert = error "You need to implement this function."
31+
insert x tree = error "You need to implement this function."
3232

3333
singleton :: a -> BST a
34-
singleton = error "You need to implement this function."
34+
singleton x = error "You need to implement this function."
3535

3636
toList :: BST a -> [a]
37-
toList = error "You need to implement this function."
37+
toList tree = error "You need to implement this function."

exercises/bowling/src/Bowling.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ data BowlingError = IncompleteGame
55
deriving (Eq, Show)
66

77
score :: [Int] -> Either BowlingError Int
8-
score = error "You need to implement this function."
8+
score rolls = error "You need to implement this function."
99

exercises/clock/src/Clock.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module Clock (clockHour, clockMin, fromHourMin, toString) where
33
data Clock = Dummy
44

55
clockHour :: Clock -> Int
6-
clockHour = error "You need to implement this function."
6+
clockHour clock = error "You need to implement this function."
77

88
clockMin :: Clock -> Int
9-
clockMin = error "You need to implement this function."
9+
clockMin clock = error "You need to implement this function."
1010

1111
fromHourMin :: Int -> Int -> Clock
12-
fromHourMin = error "You need to implement this function."
12+
fromHourMin hour min = error "You need to implement this function."
1313

1414
toString :: Clock -> String
15-
toString = error "You need to implement this function."
15+
toString clock = error "You need to implement this function."

exercises/connect/src/Connect.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ module Connect (Mark(..), winner) where
33
data Mark = Cross | Nought deriving (Eq, Show)
44

55
winner :: [String] -> Maybe Mark
6-
winner = error "You need to implement this function."
6+
winner board = error "You need to implement this function."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module CryptoSquare (encode) where
22

33
encode :: String -> String
4-
encode = error "You need to implement this function."
4+
encode xs = error "You need to implement this function."

exercises/custom-set/src/CustomSet.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,40 @@ import Prelude hiding (null)
1919
data CustomSet a = Dummy deriving (Eq, Show)
2020

2121
delete :: a -> CustomSet a -> CustomSet a
22-
delete = error "You need to implement this function."
22+
delete x set = error "You need to implement this function."
2323

2424
difference :: CustomSet a -> CustomSet a -> CustomSet a
25-
difference = error "You need to implement this function."
25+
difference setA setB = error "You need to implement this function."
2626

2727
empty :: CustomSet a
2828
empty = error "You need to implement this function."
2929

3030
fromList :: [a] -> CustomSet a
31-
fromList = error "You need to implement this function."
31+
fromList xs = error "You need to implement this function."
3232

3333
insert :: a -> CustomSet a -> CustomSet a
34-
insert = error "You need to implement this function."
34+
insert x set = error "You need to implement this function."
3535

3636
intersection :: CustomSet a -> CustomSet a -> CustomSet a
37-
intersection = error "You need to implement this function."
37+
intersection setA setB = error "You need to implement this function."
3838

3939
isDisjointFrom :: CustomSet a -> CustomSet a -> Bool
40-
isDisjointFrom = error "You need to implement this function."
40+
isDisjointFrom setA setB = error "You need to implement this function."
4141

4242
isSubsetOf :: CustomSet a -> CustomSet a -> Bool
43-
isSubsetOf = error "You need to implement this function."
43+
isSubsetOf setA setB = error "You need to implement this function."
4444

4545
member :: a -> CustomSet a -> Bool
46-
member = error "You need to implement this function."
46+
member x set = error "You need to implement this function."
4747

4848
null :: CustomSet a -> Bool
49-
null = error "You need to implement this function."
49+
null set = error "You need to implement this function."
5050

5151
size :: CustomSet a -> Int
52-
size = error "You need to implement this function."
52+
size set = error "You need to implement this function."
5353

5454
toList :: CustomSet a -> [a]
55-
toList = error "You need to implement this function."
55+
toList set = error "You need to implement this function."
5656

5757
union :: CustomSet a -> CustomSet a -> CustomSet a
58-
union = error "You need to implement this function."
58+
union setA setB = error "You need to implement this function."
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module Squares (difference, squareOfSums, sumOfSquares) where
22

33
difference :: Integral a => a -> a
4-
difference = error "You need to implement this function."
4+
difference n = error "You need to implement this function."
55

66
squareOfSums :: Integral a => a -> a
7-
squareOfSums = error "You need to implement this function."
7+
squareOfSums n = error "You need to implement this function."
88

99
sumOfSquares :: Integral a => a -> a
10-
sumOfSquares = error "You need to implement this function."
10+
sumOfSquares n = error "You need to implement this function."

exercises/etl/src/ETL.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ module ETL (transform) where
33
import Data.Map (Map)
44

55
transform :: Map a String -> Map Char a
6-
transform = error "You need to implement this function."
6+
transform legacyData = error "You need to implement this function."

exercises/forth/src/Forth.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ empty :: ForthState
2323
empty = error "You need to implement this function."
2424

2525
evalText :: Text -> ForthState -> Either ForthError ForthState
26-
evalText = error "You need to implement this function."
26+
evalText text stack = error "You need to implement this function."
2727

2828
toList :: ForthState -> [Int]
29-
toList = error "You need to implement this function."
29+
toList stack = error "You need to implement this function."

exercises/go-counting/src/Counting.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data Color = Black | White deriving (Eq, Ord, Show)
1010
type Coord = (Int, Int)
1111

1212
territories :: [String] -> [(Set Coord, Maybe Color)]
13-
territories = error "You need to implement this function."
13+
territories board = error "You need to implement this function."
1414

1515
territoryFor :: [String] -> Coord -> Maybe (Set Coord, Maybe Color)
16-
territoryFor = error "You need to implement this function."
16+
territoryFor board coord = error "You need to implement this function."

exercises/kindergarten-garden/src/Garden.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ data Plant = Clover
1414
deriving (Eq, Show)
1515

1616
defaultGarden :: String -> Map String [Plant]
17-
defaultGarden = error "You need to implement this function."
17+
defaultGarden plants = error "You need to implement this function."
1818

1919
garden :: [String] -> String -> Map String [Plant]
20-
garden = error "You need to implement this function."
20+
garden students plants = error "You need to implement this function."
2121

2222
lookupPlants :: String -> Map String [Plant] -> [Plant]
23-
lookupPlants = error "You need to implement this function."
23+
lookupPlants student garden = error "You need to implement this function."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module Series (largestProduct) where
22

33
largestProduct :: Int -> String -> Maybe Integer
4-
largestProduct = error "You need to implement this function."
4+
largestProduct series digits = error "You need to implement this function."

exercises/lens-person/src/Person.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ data Address = Address { _street :: String
3131
}
3232

3333
bornStreet :: Born -> String
34-
bornStreet = error "You need to implement this function."
34+
bornStreet born = error "You need to implement this function."
3535

3636
setCurrentStreet :: String -> Person -> Person
37-
setCurrentStreet = error "You need to implement this function."
37+
setCurrentStreet street person = error "You need to implement this function."
3838

3939
setBirthMonth :: Int -> Person -> Person
40-
setBirthMonth = error "You need to implement this function."
40+
setBirthMonth month person = error "You need to implement this function."
4141

4242
renameStreets :: (String -> String) -> Person -> Person
43-
renameStreets = error "You need to implement this function."
43+
renameStreets f person = error "You need to implement this function."

0 commit comments

Comments
 (0)