Copyright | (c) Justin Le 2018 |
---|---|
License | BSD3 |
Maintainer | justin@jle.im |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Template Haskell for discovering all named challenges in a given directory.
Synopsis
- mkChallengeMap :: [(Finite 25, (Part, SomeSolution))] -> ChallengeMap
- solutionList :: FilePath -> Q (TExp [(Finite 25, (Part, SomeSolution))])
- type ChallengeMap = Map (Finite 25) (Map Part SomeSolution)
- data ChallengeSpec = CS {}
- dayToInt :: Finite 25 -> Int
- solSpec :: Name -> ChallengeSpec
- charPart :: Char -> Maybe Part
Documentation
mkChallengeMap :: [(Finite 25, (Part, SomeSolution))] -> ChallengeMap Source #
Meant to be called like:
mkChallengeMap $$(solutionList "src/AOC/Challenge")
solutionList :: FilePath -> Q (TExp [(Finite 25, (Part, SomeSolution))]) Source #
Template Haskell splice to produce a list of all named solutions in
a directory. Expects solutions as function names following the format
dayDDp
, where DD
is a two-digit zero-added day, and p
is
a lower-case letter corresponding to the part of the challenge.
See mkChallengeMap
for a description of usage.
type ChallengeMap = Map (Finite 25) (Map Part SomeSolution) Source #
A map of days to parts to solutions.
data ChallengeSpec Source #
A specification for a specific challenge. Should consist of a day and a lowercase character.
Instances
Eq ChallengeSpec Source # | |
Defined in AOC.Discover (==) :: ChallengeSpec -> ChallengeSpec -> Bool # (/=) :: ChallengeSpec -> ChallengeSpec -> Bool # | |
Ord ChallengeSpec Source # | |
Defined in AOC.Discover compare :: ChallengeSpec -> ChallengeSpec -> Ordering # (<) :: ChallengeSpec -> ChallengeSpec -> Bool # (<=) :: ChallengeSpec -> ChallengeSpec -> Bool # (>) :: ChallengeSpec -> ChallengeSpec -> Bool # (>=) :: ChallengeSpec -> ChallengeSpec -> Bool # max :: ChallengeSpec -> ChallengeSpec -> ChallengeSpec # min :: ChallengeSpec -> ChallengeSpec -> ChallengeSpec # | |
Show ChallengeSpec Source # | |
Defined in AOC.Discover showsPrec :: Int -> ChallengeSpec -> ShowS # show :: ChallengeSpec -> String # showList :: [ChallengeSpec] -> ShowS # |
dayToInt :: Finite 25 -> Int Source #
Turn a day represented by a
into an integer day (1
- 25).Finite
25
solSpec :: Name -> ChallengeSpec Source #
Get a ChallengeSpec
from a given reified solution (name).
solSpec 'day02a == CS { _csDay = 1, _csPart = a
}