| Copyright | (c) Justin Le 2019 |
|---|---|
| License | BSD3 |
| Maintainer | justin@jle.im |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Advent.Types
Description
Data types used for the underlying API.
Since: 0.2.3.0
Synopsis
- newtype Day = Day {}
- data Part
- data SubmitInfo = SubmitInfo {}
- data SubmitRes
- = SubCorrect (Maybe Integer)
- | SubIncorrect Int (Maybe String)
- | SubWait Int
- | SubInvalid
- | SubUnknown String
- showSubmitRes :: SubmitRes -> String
- newtype PublicCode = PublicCode {}
- data Leaderboard = LB {}
- data LeaderboardMember = LBM {
- lbmGlobalScore :: Integer
- lbmName :: Maybe Text
- lbmLocalScore :: Integer
- lbmId :: Integer
- lbmLastStarTS :: Maybe UTCTime
- lbmStars :: Int
- lbmCompletion :: Map Day (Map Part UTCTime)
- newtype Rank = Rank {}
- data DailyLeaderboard = DLB {}
- data DailyLeaderboardMember = DLBM {}
- newtype GlobalLeaderboard = GLB {}
- data GlobalLeaderboardMember = GLBM {}
- data NextDayTime
- mkDay :: Integer -> Maybe Day
- mkDay_ :: Integer -> Day
- dayInt :: Day -> Integer
- _DayInt :: (Choice p, Applicative f) => p Day (f Day) -> p Integer (f Integer)
- pattern DayInt :: Day -> Integer
- partInt :: Part -> Int
- partChar :: Part -> Char
- fullDailyBoard :: DailyLeaderboard -> Bool
- dlbmCompleteTime :: Integer -> Day -> NominalDiffTime -> ZonedTime
- dlbmTime :: Day -> NominalDiffTime -> NominalDiffTime
- challengeReleaseTime :: Integer -> Day -> ZonedTime
- parseSubmitRes :: Text -> SubmitRes
Types
Describes the day: a number between 1 and 25 inclusive.
Represented by a Finite ranging from 0 to 24 inclusive; you should
probably make one using the smart constructor mkDay.
Instances
| FromJSON Day Source # | |
| FromJSONKey Day Source # | |
Defined in Advent.Types | |
| ToJSON Day Source # | Since: 0.2.4.2 |
Defined in Advent.Types | |
| ToJSONKey Day Source # | Since: 0.2.4.2 |
Defined in Advent.Types | |
| Bounded Day Source # | |
| Enum Day Source # | |
| Generic Day Source # | |
| Show Day Source # | |
| Eq Day Source # | |
| Ord Day Source # | |
| ToHttpApiData Day Source # | |
Defined in Advent.Types Methods toUrlPiece :: Day -> Text # toEncodedUrlPiece :: Day -> Builder # toHeader :: Day -> ByteString # toQueryParam :: Day -> Text # toEncodedQueryParam :: Day -> Builder # | |
| type Rep Day Source # | |
Defined in Advent.Types | |
A given part of a problem. All Advent of Code challenges are two-parts.
You can usually get Part1 (if it is already released) with a nonsense
session key, but Part2 always requires a valid session key.
Instances
| FromJSON Part Source # | |
| FromJSONKey Part Source # | |
Defined in Advent.Types | |
| ToJSON Part Source # | Since: 0.2.4.2 |
Defined in Advent.Types | |
| ToJSONKey Part Source # | Since: 0.2.4.2 |
Defined in Advent.Types | |
| Bounded Part Source # | |
| Enum Part Source # | |
| Generic Part Source # | |
| Read Part Source # | |
| Show Part Source # | |
| Eq Part Source # | |
| Ord Part Source # | |
| ToHttpApiData Part Source # | |
Defined in Advent.Types Methods toUrlPiece :: Part -> Text # toEncodedUrlPiece :: Part -> Builder # toHeader :: Part -> ByteString # toQueryParam :: Part -> Text # toEncodedQueryParam :: Part -> Builder # | |
| type Rep Part Source # | |
data SubmitInfo Source #
Info required to submit an answer for a part.
Constructors
| SubmitInfo | |
Instances
The result of a submission.
Constructors
| SubCorrect (Maybe Integer) | Correct submission, including global rank (if reported, which usually happens if rank is under 1000) |
| SubIncorrect Int (Maybe String) | Incorrect submission. Contains the number of seconds you must
wait before trying again. The |
| SubWait Int | Submission was rejected because an incorrect submission was recently submitted. Contains the number of seconds you must wait before trying again. |
| SubInvalid | Submission was rejected because it was sent to an invalid question or part. Usually happens if you submit to a part you have already answered or have not yet unlocked. |
| SubUnknown String | Could not parse server response. Contains parse error. |
Instances
newtype PublicCode Source #
Member ID of public leaderboard (the first part of the registration code, before the hyphen). It can be found as the number in the URL:
https://adventofcode.com/2019/leaderboard/private/view/12345
(the 12345 above)
Constructors
| PublicCode | |
Fields | |
Instances
data Leaderboard Source #
Leaderboard type, representing private leaderboard information.
Constructors
| LB | |
Instances
data LeaderboardMember Source #
Leaderboard position for a given member.
Constructors
| LBM | |
Fields
| |
Instances
Ranking between 1 to 100, for daily and global leaderboards
Note that getRank interanlly stores a number from 0 to 99, so be sure
to add or subtract accordingly if you want to display or parse it.
Since: 0.2.3.0
data DailyLeaderboard Source #
Daily leaderboard, containing Star 1 and Star 2 completions
Since: 0.2.3.0
Constructors
| DLB | |
Fields | |
Instances
data DailyLeaderboardMember Source #
Single daily leaderboard position
Since: 0.2.3.0
Constructors
| DLBM | |
Fields
| |
Instances
newtype GlobalLeaderboard Source #
Global leaderboard for the entire event
Under each Rank is an Integer for the score at that rank, as well as
a non-empty list of all members who achieved that rank and score.
Since: 0.2.3.0
Instances
data GlobalLeaderboardMember Source #
Single global leaderboard position
Since: 0.2.3.0
Constructors
| GLBM | |
Instances
data NextDayTime Source #
The next day for a challenge in a given year, and also the number of seconds until the challenge is released.
Since: 0.2.8.0
Constructors
| NextDayTime Day Int | |
| NoNextDayTime |
Instances
Util
fullDailyBoard :: DailyLeaderboard -> Bool Source #
Check if a DailyLeaderboard is filled up or not.
Since: 0.2.4.0
dlbmCompleteTime :: Integer -> Day -> NominalDiffTime -> ZonedTime Source #
Turn a dlbmDecTime field into a ZonedTime for the actual
completion of the puzzle, based on the year and day of event.
Since: 0.2.7.0
dlbmTime :: Day -> NominalDiffTime -> NominalDiffTime Source #
Turn a dlbmDecTime field into a NominalDiffTime representing the
actual amount of time taken to complete the puzzle.
Since: 0.2.7.0
Prompt release time.
Changed from UTCTime to ZonedTime in v0.2.7.0. To use as
a UTCTime, use zonedTimeToUTC.