Skip to content

Commit 3de0a0c

Browse files
committed
Add low-level types, parser module, and test harness
1 parent d4f9524 commit 3de0a0c

6 files changed

Lines changed: 60 additions & 1 deletion

File tree

icfpc-y2026.cabal

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ source-repository head
2525
library
2626
exposed-modules:
2727
Lib
28+
Parser.LL
29+
Types.LL
2830
other-modules:
2931
Paths_icfpc_y2026
3032
hs-source-dirs:
@@ -50,11 +52,14 @@ test-suite icfpc-y2026-test
5052
type: exitcode-stdio-1.0
5153
main-is: Spec.hs
5254
other-modules:
55+
Test.Parser.LL
5356
Paths_icfpc_y2026
5457
hs-source-dirs:
5558
test
5659
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
5760
build-depends:
5861
base >=4.7 && <5
5962
, icfpc-y2026
63+
, tasty
64+
, tasty-hunit
6065
default-language: Haskell2010

package.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ tests:
5757
- -with-rtsopts=-N
5858
dependencies:
5959
- icfpc-y2026
60+
- tasty
61+
- tasty-hunit

src/Parser/LL.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Parser.LL (
2+
parse
3+
)
4+
where
5+
6+
import Types.LL
7+
8+
parse :: String -> Maybe ManProgram
9+
parse = const Nothing

src/Types/LL.hs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module Types.LL (
2+
Point(..)
3+
, Room(..)
4+
, Pipe(..)
5+
, ManProgram(..)
6+
)
7+
where
8+
9+
-- | (0, 0) is top left.
10+
data Point = Point {
11+
x :: Int
12+
, y :: Int
13+
}
14+
15+
data Room = Room {
16+
topleft :: Point
17+
, width :: Int
18+
, height :: Int
19+
, ops :: [[Char]]
20+
}
21+
22+
data Pipe = Pipe {
23+
start :: Point
24+
, end :: Point
25+
}
26+
27+
data ManProgram = ManProgram {
28+
rooms :: [Room]
29+
, pipes :: [Pipe]
30+
}

test/Spec.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
import Test.Tasty
2+
3+
import qualified Test.Parser.LL (tests)
4+
15
main :: IO ()
2-
main = putStrLn "Test suite not yet implemented"
6+
main = defaultMain tests
7+
8+
tests :: TestTree
9+
tests = testGroup "Tests" [Test.Parser.LL.tests]

test/Test/Parser/LL.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Test.Parser.LL (tests) where
2+
3+
import Test.Tasty
4+
5+
tests :: TestTree
6+
tests = testGroup "Parser.LL" []

0 commit comments

Comments
 (0)