Skip to content

stubs: Substitute undefined by error message #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/accumulate/src/Accumulate.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Accumulate (accumulate) where

accumulate :: (a -> b) -> [a] -> [b]
accumulate = undefined
accumulate = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/all-your-base/src/Base.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Base (rebase) where

rebase :: Integral a => a -> a -> [a] -> Maybe [a]
rebase inputBase outputBase inputDigits = undefined
rebase inputBase outputBase inputDigits = error "You need to implement this function."
4 changes: 2 additions & 2 deletions exercises/allergies/src/Allergies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data Allergen = Eggs
deriving (Eq)

allergies :: Int -> [Allergen]
allergies = undefined
allergies = error "You need to implement this function."

isAllergicTo :: Allergen -> Int -> Bool
isAllergicTo = undefined
isAllergicTo = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/alphametics/src/Alphametics.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Alphametics (solve) where

solve :: String -> Maybe [(Char, Int)]
solve puzzle = undefined
solve puzzle = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/anagram/src/Anagram.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Anagram (anagramsFor) where

anagramsFor :: String -> [String] -> [String]
anagramsFor = undefined
anagramsFor = error "You need to implement this function."
4 changes: 2 additions & 2 deletions exercises/atbash-cipher/src/Atbash.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Atbash (decode, encode) where

decode :: String -> String
decode = undefined
decode = error "You need to implement this function."

encode :: String -> String
encode = undefined
encode = error "You need to implement this function."
8 changes: 4 additions & 4 deletions exercises/bank-account/src/BankAccount.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ module BankAccount
data BankAccount = Dummy

closeAccount :: BankAccount -> IO ()
closeAccount = undefined
closeAccount = error "You need to implement this function."

getBalance :: BankAccount -> IO (Maybe Integer)
getBalance = undefined
getBalance = error "You need to implement this function."

incrementBalance :: BankAccount -> Integer -> IO (Maybe Integer)
incrementBalance = undefined
incrementBalance = error "You need to implement this function."

openAccount :: IO BankAccount
openAccount = undefined
openAccount = error "You need to implement this function."
16 changes: 8 additions & 8 deletions exercises/binary-search-tree/src/BST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ module BST
data BST a = Dummy deriving (Eq, Show)

bstLeft :: BST a -> Maybe (BST a)
bstLeft = undefined
bstLeft = error "You need to implement this function."

bstRight :: BST a -> Maybe (BST a)
bstRight = undefined
bstRight = error "You need to implement this function."

bstValue :: BST a -> Maybe a
bstValue = undefined
bstValue = error "You need to implement this function."

empty :: BST a
empty = undefined
empty = error "You need to implement this function."

fromList :: Ord a => [a] -> BST a
fromList = undefined
fromList = error "You need to implement this function."

insert :: Ord a => a -> BST a -> BST a
insert = undefined
insert = error "You need to implement this function."

singleton :: a -> BST a
singleton = undefined
singleton = error "You need to implement this function."

toList :: BST a -> [a]
toList = undefined
toList = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/binary/src/Binary.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Binary (toDecimal) where

toDecimal = undefined
toDecimal = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/bob/src/Bob.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Bob (responseFor) where

responseFor :: String -> String
responseFor = undefined
responseFor = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/bowling/src/Bowling.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ data BowlingError = IncompleteGame
deriving (Eq, Show)

score :: [Int] -> Either BowlingError Int
score = undefined
score = error "You need to implement this function."

2 changes: 1 addition & 1 deletion exercises/change/src/Change.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Change (findFewestCoins) where

findFewestCoins :: Integer -> [Integer] -> Maybe [Integer]
findFewestCoins target coins = undefined
findFewestCoins target coins = error "You need to implement this function."
8 changes: 4 additions & 4 deletions exercises/clock/src/Clock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module Clock (clockHour, clockMin, fromHourMin, toString) where
data Clock = Dummy

clockHour :: Clock -> Int
clockHour = undefined
clockHour = error "You need to implement this function."

clockMin :: Clock -> Int
clockMin = undefined
clockMin = error "You need to implement this function."

fromHourMin :: Int -> Int -> Clock
fromHourMin = undefined
fromHourMin = error "You need to implement this function."

toString :: Clock -> String
toString = undefined
toString = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/connect/src/Connect.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module Connect (Mark(..), winner) where
data Mark = Cross | Nought deriving (Eq, Show)

winner :: [String] -> Maybe Mark
winner = undefined
winner = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/crypto-square/src/CryptoSquare.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CryptoSquare (encode) where

encode :: String -> String
encode = undefined
encode = error "You need to implement this function."
26 changes: 13 additions & 13 deletions exercises/custom-set/src/CustomSet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,40 @@ import Prelude hiding (null)
data CustomSet a = Dummy deriving (Eq, Show)

delete :: a -> CustomSet a -> CustomSet a
delete = undefined
delete = error "You need to implement this function."

difference :: CustomSet a -> CustomSet a -> CustomSet a
difference = undefined
difference = error "You need to implement this function."

empty :: CustomSet a
empty = undefined
empty = error "You need to implement this function."

fromList :: [a] -> CustomSet a
fromList = undefined
fromList = error "You need to implement this function."

insert :: a -> CustomSet a -> CustomSet a
insert = undefined
insert = error "You need to implement this function."

intersection :: CustomSet a -> CustomSet a -> CustomSet a
intersection = undefined
intersection = error "You need to implement this function."

isDisjointFrom :: CustomSet a -> CustomSet a -> Bool
isDisjointFrom = undefined
isDisjointFrom = error "You need to implement this function."

isSubsetOf :: CustomSet a -> CustomSet a -> Bool
isSubsetOf = undefined
isSubsetOf = error "You need to implement this function."

member :: a -> CustomSet a -> Bool
member = undefined
member = error "You need to implement this function."

null :: CustomSet a -> Bool
null = undefined
null = error "You need to implement this function."

size :: CustomSet a -> Int
size = undefined
size = error "You need to implement this function."

toList :: CustomSet a -> [a]
toList = undefined
toList = error "You need to implement this function."

union :: CustomSet a -> CustomSet a -> CustomSet a
union = undefined
union = error "You need to implement this function."
6 changes: 3 additions & 3 deletions exercises/difference-of-squares/src/Squares.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Squares (difference, squareOfSums, sumOfSquares) where

difference :: Integral a => a -> a
difference = undefined
difference = error "You need to implement this function."

squareOfSums :: Integral a => a -> a
squareOfSums = undefined
squareOfSums = error "You need to implement this function."

sumOfSquares :: Integral a => a -> a
sumOfSquares = undefined
sumOfSquares = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/dominoes/src/Dominoes.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Dominoes (chain) where

chain :: [(Int, Int)] -> Maybe [(Int, Int)]
chain dominoes = undefined
chain dominoes = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/etl/src/ETL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module ETL (transform) where
import Data.Map (Map)

transform :: Map a String -> Map Char a
transform = undefined
transform = error "You need to implement this function."
6 changes: 3 additions & 3 deletions exercises/forth/src/Forth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ data ForthError
data ForthState = Dummy

empty :: ForthState
empty = undefined
empty = error "You need to implement this function."

evalText :: Text -> ForthState -> Either ForthError ForthState
evalText = undefined
evalText = error "You need to implement this function."

toList :: ForthState -> [Int]
toList = undefined
toList = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/gigasecond/src/Gigasecond.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module Gigasecond (fromDay) where
import Data.Time.Clock (UTCTime)

fromDay :: UTCTime -> UTCTime
fromDay = undefined
fromDay = error "You need to implement this function."
4 changes: 2 additions & 2 deletions exercises/go-counting/src/Counting.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data Color = Black | White deriving (Eq, Ord, Show)
type Coord = (Int, Int)

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

territoryFor :: [String] -> Coord -> Maybe (Set Coord, Maybe Color)
territoryFor = undefined
territoryFor = error "You need to implement this function."
8 changes: 4 additions & 4 deletions exercises/grade-school/src/School.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module School (School, add, empty, grade, sorted) where
data School = Dummy

add :: Int -> String -> School -> School
add gradeNum student school = undefined
add gradeNum student school = error "You need to implement this function."

empty :: School
empty = undefined
empty = error "You need to implement this function."

grade :: Int -> School -> [String]
grade gradeNum school = undefined
grade gradeNum school = error "You need to implement this function."

sorted :: School -> [(Int, [String])]
sorted school = undefined
sorted school = error "You need to implement this function."
4 changes: 2 additions & 2 deletions exercises/grains/src/Grains.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Grains (square, total) where

square :: Integer -> Maybe Integer
square n = undefined
square n = error "You need to implement this function."

total :: Integer
total = undefined
total = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/hamming/src/Hamming.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Hamming (distance) where

distance = undefined
distance = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/hexadecimal/src/Hexadecimal.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Hexadecimal (hexToInt) where

hexToInt = undefined
hexToInt = error "You need to implement this function."
6 changes: 3 additions & 3 deletions exercises/kindergarten-garden/src/Garden.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ data Plant = Clover
deriving (Eq, Show)

defaultGarden :: String -> Map String [Plant]
defaultGarden = undefined
defaultGarden = error "You need to implement this function."

garden :: [String] -> String -> Map String [Plant]
garden = undefined
garden = error "You need to implement this function."

lookupPlants :: String -> Map String [Plant] -> [Plant]
lookupPlants = undefined
lookupPlants = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/largest-series-product/src/Series.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Series (largestProduct) where

largestProduct :: Int -> String -> Maybe Integer
largestProduct = undefined
largestProduct = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/leap/src/LeapYear.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module LeapYear (isLeapYear) where

isLeapYear :: Integer -> Bool
isLeapYear year = undefined
isLeapYear year = error "You need to implement this function."
8 changes: 4 additions & 4 deletions exercises/lens-person/src/Person.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ data Address = Address { _street :: String
}

bornStreet :: Born -> String
bornStreet = undefined
bornStreet = error "You need to implement this function."

setCurrentStreet :: String -> Person -> Person
setCurrentStreet = undefined
setCurrentStreet = error "You need to implement this function."

setBirthMonth :: Int -> Person -> Person
setBirthMonth = undefined
setBirthMonth = error "You need to implement this function."

renameStreets :: (String -> String) -> Person -> Person
renameStreets = undefined
renameStreets = error "You need to implement this function."
10 changes: 5 additions & 5 deletions exercises/linked-list/src/Deque.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ module Deque (Deque, mkDeque, pop, push, shift, unshift) where
data Deque a = Dummy

mkDeque :: IO (Deque a)
mkDeque = undefined
mkDeque = error "You need to implement this function."

pop :: Deque a -> IO (Maybe a)
pop = undefined
pop = error "You need to implement this function."

push :: Deque a -> a -> IO ()
push = undefined
push = error "You need to implement this function."

unshift :: Deque a -> a -> IO ()
unshift = undefined
unshift = error "You need to implement this function."

shift :: Deque a -> IO (Maybe a)
shift = undefined
shift = error "You need to implement this function."
16 changes: 8 additions & 8 deletions exercises/list-ops/src/ListOps.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ import Prelude hiding
( length, reverse, map, filter, foldr, (++), concat )

foldl' :: (b -> a -> b) -> b -> [a] -> b
foldl' = undefined
foldl' = error "You need to implement this function."

foldr :: (a -> b -> b) -> b -> [a] -> b
foldr = undefined
foldr = error "You need to implement this function."

length :: [a] -> Int
length = undefined
length = error "You need to implement this function."

reverse :: [a] -> [a]
reverse = undefined
reverse = error "You need to implement this function."

map :: (a -> b) -> [a] -> [b]
map = undefined
map = error "You need to implement this function."

filter :: (a -> Bool) -> [a] -> [a]
filter = undefined
filter = error "You need to implement this function."

(++) :: [a] -> [a] -> [a]
xs ++ ys = undefined
xs ++ ys = error "You need to implement this function."

concat :: [[a]] -> [a]
concat = undefined
concat = error "You need to implement this function."
Loading