Skip to content

Add Explicit Args To Exercises - Part 3 #507

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 13 commits into from
Mar 20, 2017
4 changes: 2 additions & 2 deletions exercises/pov/src/POV.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module POV (fromPOV, tracePathBetween) where
import Data.Tree (Tree)

fromPOV :: Eq a => a -> Tree a -> Maybe (Tree a)
fromPOV = error "You need to implement this function."
fromPOV x tree = error "You need to implement this function."

tracePathBetween :: Eq a => a -> a -> Tree a -> Maybe [a]
tracePathBetween = error "You need to implement this function."
tracePathBetween from to tree = error "You need to implement this function."
9 changes: 6 additions & 3 deletions exercises/pythagorean-triplet/src/Triplet.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
module Triplet (isPythagorean, mkTriplet, pythagoreanTriplets) where

isPythagorean = error "You need to implement this function."
isPythagorean :: (Int, Int, Int) -> Bool
Copy link
Member

@petertseng petertseng Mar 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is done, then the reasoning in https://github.com/exercism/xhaskell/blob/master/exercises/pythagorean-triplet/.meta/DONT-TEST-STUB for why the tests would fail to build is false, so if we do this please delete that file so that the stub gets tested.

If we choose the type of mkTriplet as (Int, Int, Int) rather than letting the student choose, do we even need mkTriplet? Shouldn't we just delete mkTriplet then? I think the only point of it is to give the student the choice.

Why did we give this choice, anyway?

Copy link
Member

@petertseng petertseng Mar 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we give this choice, anyway?

I didn't see explanation given in exercism/exercism#741. I guess we can see that mkTriplet is invariant to ordering of the three numbers, since it will always order them in a consistent way.

So we still need mkTriplet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can consider redesigning this exercise without mkTriplet, @petertseng. The way it is now, I think it is over-specified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I left this exercise for last because I couldn't figure out a way to declare the types without over-specifying it :/

I was completely unaware of https://github.com/exercism/xhaskell/blob/master/exercises/pythagorean-triplet/.meta/DONT-TEST-STUB though

What about get rid of this commit so this exercise can get redesigned as suggested by @rbasso ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should stop things here because of that. We don't have anything ready yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool. I've applied the feedback for the POV exercise, so I'm just waiting for the decision here.

isPythagorean triplet = error "You need to implement this function."

mkTriplet = error "You need to implement this function."
mkTriplet :: Int -> Int -> Int -> (Int, Int, Int)
mkTriplet a b c = error "You need to implement this function."

pythagoreanTriplets = error "You need to implement this function."
pythagoreanTriplets :: Int -> Int -> [(Int, Int, Int)]
pythagoreanTriplets minFactor maxFactor = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/queen-attack/src/Queens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ boardString :: Maybe (Int, Int) -> Maybe (Int, Int) -> String
boardString white black = error "You need to implement this function."

canAttack :: (Int, Int) -> (Int, Int) -> Bool
canAttack = error "You need to implement this function."
canAttack queenA queenB = error "You need to implement this function."
3 changes: 2 additions & 1 deletion exercises/raindrops/src/Raindrops.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module Raindrops (convert) where

convert = error "You need to implement this function."
convert :: Int -> String
convert n = error "You need to implement this function."
4 changes: 2 additions & 2 deletions exercises/robot-name/src/Robot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mkRobot :: IO Robot
mkRobot = error "You need to implement this function."

resetName :: Robot -> IO ()
resetName = error "You need to implement this function."
resetName robot = error "You need to implement this function."

robotName :: Robot -> IO String
robotName = error "You need to implement this function."
robotName robot = error "You need to implement this function."
12 changes: 6 additions & 6 deletions exercises/robot-simulator/src/Robot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ data Bearing = North
data Robot = Dummy

bearing :: Robot -> Bearing
bearing = error "You need to implement this function."
bearing robot = error "You need to implement this function."

coordinates :: Robot -> (Integer, Integer)
coordinates = error "You need to implement this function."
coordinates robot = error "You need to implement this function."

mkRobot :: Bearing -> (Integer, Integer) -> Robot
mkRobot = error "You need to implement this function."
mkRobot direction coordinates = error "You need to implement this function."

simulate :: Robot -> String -> Robot
simulate = error "You need to implement this function."
simulate robot instructions = error "You need to implement this function."

turnLeft :: Bearing -> Bearing
turnLeft = error "You need to implement this function."
turnLeft direction = error "You need to implement this function."

turnRight :: Bearing -> Bearing
turnRight = error "You need to implement this function."
turnRight direction = error "You need to implement this function."
3 changes: 2 additions & 1 deletion exercises/roman-numerals/src/Roman.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module Roman (numerals) where

numerals = error "You need to implement this function."
numerals :: Integer -> Maybe String
numerals n = error "You need to implement this function."
4 changes: 2 additions & 2 deletions exercises/run-length-encoding/src/RunLength.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module RunLength (decode, encode) where

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

encode :: String -> String
encode = error "You need to implement this function."
encode text = error "You need to implement this function."
3 changes: 2 additions & 1 deletion exercises/saddle-points/src/Matrix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ module Matrix (saddlePoints) where

import Data.Array (Array)

saddlePoints = error "You need to implement this function."
saddlePoints :: Array i e -> [i]
saddlePoints matrix = error "You need to implement this function."
3 changes: 2 additions & 1 deletion exercises/say/src/Say.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module Say (inEnglish) where

inEnglish = error "You need to implement this function."
inEnglish :: Integer -> Maybe String
inEnglish n = error "You need to implement this function."
6 changes: 4 additions & 2 deletions exercises/scrabble-score/src/Scrabble.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Scrabble (scoreLetter, scoreWord) where

scoreLetter = error "You need to implement this function."
scoreLetter :: Char -> Integer
scoreLetter letter = error "You need to implement this function."

scoreWord = error "You need to implement this function."
scoreWord :: String -> Integer
scoreWord word = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/secret-handshake/src/SecretHandshake.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module SecretHandshake (handshake) where

handshake :: Int -> [String]
handshake = error "You need to implement this function."
handshake n = error "You need to implement this function."
2 changes: 1 addition & 1 deletion exercises/sgf-parsing/src/Sgf.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Data.Text (Text)
import Data.Tree (Tree)

parseSgf :: Text -> Maybe (Tree (Map Text [Text]))
parseSgf = error "You need to implement this function."
parseSgf sgf = error "You need to implement this function."