Skip to content

Instantly share code, notes, and snippets.

@dustin
Last active December 1, 2021 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustin/4d931cc3d57acf9b107e0d30d40a7f8e to your computer and use it in GitHub Desktop.
Save dustin/4d931cc3d57acf9b107e0d30d40a7f8e to your computer and use it in GitHub Desktop.
Template for AoC
{-# START_FILE stack.yaml #-}
resolver: lts-18.18
packages:
- '.'
extra-deps:
- astar-0.3.0.0@sha256:8bf6350542e9db9451490e8993560ee843dc48a61d46a206985430f9b62461c8,967
- git: https://github.com/dustin/aoc.git
commit: 60b4a01f9c09863d16833bcd766daf8855281d26
nix:
packages: [zlib]
{-# START_FILE package.yaml #-}
name: {{name}}
version: 0.1.0.0
github: "{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}"
license: BSD3
author: "{{author-name}}{{^author-name}}Author name here{{/author-name}}"
maintainer: "{{author-email}}{{^author-email}}example@example.com{{/author-email}}"
copyright: "{{copyright}}{{^copyright}}{{year}}{{^year}}2019{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}"
extra-source-files:
- README.md
- ChangeLog.md
# Metadata used when publishing your package
# synopsis: Short description of your package
# category: {{category}}{{^category}}Web{{/category}}
# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description: Please see the README on GitHub at <https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme>
dependencies:
- base >= 4.7 && < 5
- aoc
- megaparsec
- text
- containers
- extra
- cryptohash
- bytestring
- byteable
- parallel
- array
- lens
- aeson
- mtl
- transformers
- lens-aeson
- scientific
- these
- vector
library:
source-dirs: src
ghc-options:
- -Wall
default-extensions:
- OverloadedStrings
- RecordWildCards
- NamedFieldPuns
executables:
{{name}}:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -Wall
dependencies:
- {{name}}
tests:
{{name}}-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- {{name}}
- HUnit
- tasty
- tasty-hunit
- tasty-quickcheck
{-# START_FILE Setup.hs #-}
import Distribution.Simple
main = defaultMain
{-# START_FILE test/Spec.hs #-}
import Test.Tasty
import qualified Day10Tests
import qualified Day11Tests
import qualified Day12Tests
import qualified Day13Tests
import qualified Day14Tests
import qualified Day15Tests
import qualified Day16Tests
import qualified Day17Tests
import qualified Day18Tests
import qualified Day19Tests
import qualified Day1Tests
import qualified Day20Tests
import qualified Day21Tests
import qualified Day22Tests
import qualified Day23Tests
import qualified Day24Tests
import qualified Day25Tests
import qualified Day2Tests
import qualified Day3Tests
import qualified Day4Tests
import qualified Day5Tests
import qualified Day6Tests
import qualified Day7Tests
import qualified Day8Tests
import qualified Day9Tests
tests :: [TestTree]
tests = [
testGroup "day1" Day1Tests.tests,
testGroup "day2" Day2Tests.tests,
testGroup "day3" Day3Tests.tests,
testGroup "day4" Day4Tests.tests,
testGroup "day5" Day5Tests.tests,
testGroup "day6" Day6Tests.tests,
testGroup "day7" Day7Tests.tests,
testGroup "day8" Day8Tests.tests,
testGroup "day9" Day9Tests.tests,
testGroup "day10" Day10Tests.tests,
testGroup "day11" Day11Tests.tests,
testGroup "day12" Day12Tests.tests,
testGroup "day13" Day13Tests.tests,
testGroup "day14" Day14Tests.tests,
testGroup "day15" Day15Tests.tests,
testGroup "day16" Day16Tests.tests,
testGroup "day17" Day17Tests.tests,
testGroup "day18" Day18Tests.tests,
testGroup "day19" Day19Tests.tests,
testGroup "day20" Day20Tests.tests,
testGroup "day21" Day21Tests.tests,
testGroup "day22" Day22Tests.tests,
testGroup "day23" Day23Tests.tests,
testGroup "day24" Day24Tests.tests,
testGroup "day25" Day25Tests.tests
]
main :: IO ()
main = defaultMain $ testGroup "All Tests" tests
{-# START_FILE test/Day1Tests.hs #-}
module Day1Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day1
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day1.hs #-}
module Day1 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day2Tests.hs #-}
module Day2Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day2
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day2.hs #-}
module Day2 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day3Tests.hs #-}
module Day3Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day3
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day3.hs #-}
module Day3 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day4Tests.hs #-}
module Day4Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day4
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day4.hs #-}
module Day4 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day5Tests.hs #-}
module Day5Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day5
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day5.hs #-}
module Day5 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day6Tests.hs #-}
module Day6Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day6
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day6.hs #-}
module Day6 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day7Tests.hs #-}
module Day7Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day7
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day7.hs #-}
module Day7 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day8Tests.hs #-}
module Day8Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day8
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day8.hs #-}
module Day8 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day9Tests.hs #-}
module Day9Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day9
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day9.hs #-}
module Day9 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day10Tests.hs #-}
module Day10Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day10
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day10.hs #-}
module Day10 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day11Tests.hs #-}
module Day11Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day11
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day11.hs #-}
module Day11 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day12Tests.hs #-}
module Day12Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day12
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day12.hs #-}
module Day12 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day13Tests.hs #-}
module Day13Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day13
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day13.hs #-}
module Day13 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day14Tests.hs #-}
module Day14Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day14
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day14.hs #-}
module Day14 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day15Tests.hs #-}
module Day15Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day15
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day15.hs #-}
module Day15 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day16Tests.hs #-}
module Day16Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day16
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day16.hs #-}
module Day16 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day17Tests.hs #-}
module Day17Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day17
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day17.hs #-}
module Day17 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day18Tests.hs #-}
module Day18Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day18
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day18.hs #-}
module Day18 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day19Tests.hs #-}
module Day19Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day19
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day19.hs #-}
module Day19 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day20Tests.hs #-}
module Day20Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day20
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day20.hs #-}
module Day20 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day21Tests.hs #-}
module Day21Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day21
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day21.hs #-}
module Day21 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day22Tests.hs #-}
module Day22Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day22
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day22.hs #-}
module Day22 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day23Tests.hs #-}
module Day23Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day23
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day23.hs #-}
module Day23 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day24Tests.hs #-}
module Day24Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day24
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day24.hs #-}
module Day24 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE test/Day25Tests.hs #-}
module Day25Tests where
import Test.Tasty
import Test.Tasty.HUnit
import Day25
testPart1 :: Assertion
testPart1 = assertEqual "" 0 =<< part1
testPart2 :: Assertion
testPart2 = assertEqual "" 0 =<< part2
tests :: [TestTree]
tests = [
testCase "part1" testPart1,
testCase "part2" testPart2
]
{-# START_FILE src/Day25.hs #-}
module Day25 where
getInput :: IO ()
getInput = pure ()
part1 :: IO Int
part1 = pure 0
part2 :: IO Int
part2 = pure 0
{-# START_FILE app/Main.hs #-}
module Main where
main :: IO ()
main = undefined
{-# START_FILE README.md #-}
# {{name}}
{-# START_FILE ChangeLog.md #-}
# Changelog for {{name}}
## Unreleased changes
{-# START_FILE LICENSE #-}
Copyright {{author-name}}{{^author-name}}Author name here{{/author-name}} (c) {{year}}{{^year}}2019{{/year}}
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of {{author-name}}{{^author-name}}Author name here{{/author-name}} nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{-# START_FILE .gitignore #-}
.stack-work/
{{name}}.cabal
*~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment