Skip to content

Commit 561f36e

Browse files
committed
add branching.hs output
1 parent 9d9b8c1 commit 561f36e

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

branching.hs

+6-17
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import Data.Time
22

33
timeNow now =
4-
case
5-
(todHour (localTimeOfDay (zonedTimeToLocalTime now)) < 12)
6-
of
7-
True -> putStrLn "It's before noon"
8-
False -> putStrLn "It's after noon"
9-
4+
case todHour (localTimeOfDay (zonedTimeToLocalTime now)) < 12 of
5+
True -> putStrLn "It's before noon"
6+
False -> putStrLn "It's after noon"
107

118
data ServicePlan = Free | Monthly | Annual
129

@@ -16,29 +13,21 @@ billAmount plan =
1613
Monthly -> 5
1714
Annual -> billAmount Monthly * 12
1815

19-
2016
writeNumber i =
2117
case i of
2218
1 -> "one"
2319
2 -> "two"
2420
3 -> "three"
2521
_ -> "unknown number."
2622

27-
2823
main =
2924
do
3025
now <- getZonedTime
3126
timeNow now
3227

3328
let plan = Free
34-
putStrLn
35-
("Customer owes " ++ (show (billAmount plan)) ++ " dollars.")
29+
putStrLn ("Customer owes " ++ show (billAmount plan)
30+
++ " dollars.")
3631

3732
let i = 2
38-
putStrLn
39-
("Write " ++ show i ++ " as " ++ (writeNumber i))
40-
41-
42-
43-
44-
33+
putStrLn ("Write " ++ show i ++ " as " ++ (writeNumber i))

outputs/branching.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
It's ... noon
2+
Customer owes 0 dollars.
3+
Write 2 as two

tools/outputs.nix

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ let
2121
in
2222

2323
linkFarm "haskell-phrasebook-outputs" [
24+
(run' "branching.txt" ../branching.hs { sed = ["s!^It's .* noon$!It's ... noon!"]; })
2425
(run "common-types.txt" ../common-types.hs)
2526
(run "for-loops.txt" ../for-loops.hs)
2627
(run "hashing.txt" ../hashing.hs)

0 commit comments

Comments
 (0)