-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTemplate.elm
102 lines (62 loc) · 1.46 KB
/
Template.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
module YearXXX.DayXXX exposing (Input1, Input2, Output1, Output2, compute1, compute2, input_, main, parse1, parse2, tests1, tests2)
import Advent
exposing
( Test
-- , unsafeToInt
-- , unsafeMaybe
)
-- 1. TYPES (what is the best representation of the problem?)
type alias Input1 =
Int
type alias Input2 =
Int
type alias Output1 =
Int
type alias Output2 =
Int
-- 2. PARSE (mangle the input string into the representation we decided on)
parse1 : String -> Input1
parse1 string =
-1
parse2 : String -> Input2
parse2 string =
parse1 string
-- 3. COMPUTE (actually solve the problem)
compute1 : Input1 -> Output1
compute1 input =
input
|> Debug.log "input"
|> always -1
compute2 : Input2 -> Output2
compute2 input =
-1
-- 4. TESTS (uh-oh, is this problem a hard one?)
tests1 : List (Test Input1 Output1)
tests1 =
[{- Test "example"
"input"
Nothing -- Just "parsed-input"
-1
-}
]
tests2 : List (Test Input2 Output2)
tests2 =
[]
-- BOILERPLATE (shouldn't have to touch this)
input_ : String
input_ =
"""
InputXXX
"""
|> Advent.removeNewlinesAtEnds
main : Program () ( Output1, Output2 ) Never
main =
Advent.program
{ input = input_
, parse1 = parse1
, parse2 = parse2
, compute1 = compute1
, compute2 = compute2
, tests1 = tests1
, tests2 = tests2
}