Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module Codeforces.Types
- data ResponseError
- handleAPI :: IO (Either ResponseError a) -> ExceptT CodeforcesError IO a
- getContests :: Bool -> IO (Either ResponseError [Contest])
- getContestStandings :: StandingsParams -> IO (Either ResponseError Standings)
- getContestStandings' :: StandingsParams -> IO (Either ResponseError (Standings, Map Handle RatingChange))
- data StandingsParams = StandingsParams {
- paramContestId :: ContestId
- paramFrom :: Maybe Int
- paramRowCount :: Maybe Int
- paramRoom :: Maybe Int
- paramUnofficial :: Bool
- paramHandles :: Maybe [Handle]
- getAllProblemData :: [ProblemTag] -> IO (Either ResponseError ProblemsResponse)
- getProblems :: [ProblemTag] -> IO (Either ResponseError [Problem])
- getProblemStats :: [ProblemTag] -> IO (Either ResponseError [ProblemStats])
- getContestProblems :: ContestId -> IO (Either ResponseError [Problem])
- getContestRatingChanges :: ContestId -> IO (Either ResponseError [RatingChange])
- getUserRatingHistory :: Handle -> IO (Either ResponseError [RatingChange])
- getContestSubmissions :: ContestId -> Handle -> IO (Either ResponseError [Submission])
- getUserStatus :: Handle -> Int -> Int -> IO (Either ResponseError [Submission])
- getUser :: Handle -> IO (Either ResponseError User)
- getUsers :: [Handle] -> IO (Either ResponseError [User])
- getFriends :: UserConfig -> IO (Either ResponseError [Handle])
- calculateVirtualResult :: ContestId -> Handle -> Points -> Int -> IO (Either ResponseError (User, Maybe VirtualResult))
- type Delta = Int
- type Seed = Float
- data VirtualResult = VirtualResult {
- virtualRank :: Int
- virtualDelta :: Delta
- virtualSeed :: Seed
- data UserConfig = UserConfig {}
Documentation
module Codeforces.Types
data ResponseError Source #
An error that could occur during the retrieval and inital parsing of data from the Codeforces API.
ApiFail String | Corresponds to a |
JsonError JSONException | Wrapper around |
HttpError HttpException | Wrapper around |
Instances
Show ResponseError Source # | |
Defined in Codeforces.Response showsPrec :: Int -> ResponseError -> ShowS # show :: ResponseError -> String # showList :: [ResponseError] -> ShowS # |
handleAPI :: IO (Either ResponseError a) -> ExceptT CodeforcesError IO a Source #
Contests
getContests :: Bool -> IO (Either ResponseError [Contest]) Source #
getContests
isGym
returns a list of contests that may or may not be gym
contests.
getContestStandings :: StandingsParams -> IO (Either ResponseError Standings) Source #
getContestStandings
standingsParams
returns information about the
contest and a part of the standings list.
getContestStandings' :: StandingsParams -> IO (Either ResponseError (Standings, Map Handle RatingChange)) Source #
Like getContestStandings
but returns the standings and the
RatingChange
s for each user participating.
data StandingsParams Source #
Query parameters for retrieving contest standings.
StandingsParams | |
|
Instances
Show StandingsParams Source # | |
Defined in Codeforces.API showsPrec :: Int -> StandingsParams -> ShowS # show :: StandingsParams -> String # showList :: [StandingsParams] -> ShowS # |
Problems
getAllProblemData :: [ProblemTag] -> IO (Either ResponseError ProblemsResponse) Source #
getAllProblemData
tags
returns a ProblemsResponse
filtered by the
tags
, if supplied.
getProblems :: [ProblemTag] -> IO (Either ResponseError [Problem]) Source #
getProblems
tags
returns a list of Problem
s containing the tags
, if
provided.
getProblemStats :: [ProblemTag] -> IO (Either ResponseError [ProblemStats]) Source #
Like getProblems
but returns a list of ProblemStats
.
getContestProblems :: ContestId -> IO (Either ResponseError [Problem]) Source #
getContestProblems
contestId
returns the list of problems for the given
contest.
This should be used instead of filtering results from getProblems
for two
main reasons:
problemContestId
can only refer to one contest, so problems appearing in multiple contests may not be filtered correctly.getProblems
returns larger output potentially affecting performance
Ratings and ranks
getContestRatingChanges :: ContestId -> IO (Either ResponseError [RatingChange]) Source #
getContestRatingChanges
contestId
returns a list of RatingChange
s
for the contest.
getUserRatingHistory :: Handle -> IO (Either ResponseError [RatingChange]) Source #
getUserRatingHistory
handle
returns a list of RatingChange
s for the
requested user
Problem submissions
getContestSubmissions :: ContestId -> Handle -> IO (Either ResponseError [Submission]) Source #
getContestSubmissions
contestId handle
returns the submissions made by
the user in the contest given by contestId
getUserStatus :: Handle -> Int -> Int -> IO (Either ResponseError [Submission]) Source #
getUserStatus
handle from count
returns the count
most recent
submissions by the user, starting from the from
-th one.
User details
getFriends :: UserConfig -> IO (Either ResponseError [Handle]) Source #
Virtual rating calculation
calculateVirtualResult :: ContestId -> Handle -> Points -> Int -> IO (Either ResponseError (User, Maybe VirtualResult)) Source #
calculateVirtualResult
contestId handle points penalty
computes the
rating change the user would gain had they competed in the contest live, and
their expected ranking for the contest.
Difference in rating between a user's current rating, and their rating following this contest.
The seed is the expected ranking for each participant before the contest begins.
A contestant's rating increases should they perform better than their seed, and decreases should they perform worse.
data VirtualResult Source #
A virtual participation result
VirtualResult | |
|
Instances
Show VirtualResult Source # | |
Defined in Codeforces.Virtual.Types showsPrec :: Int -> VirtualResult -> ShowS # show :: VirtualResult -> String # showList :: [VirtualResult] -> ShowS # |
Configuration options
data UserConfig Source #
Represents the user's configuration settings.
The API key must first be generated on
the Codeforces API page.
An API key consists of two parameters: key
and secret
.
To use the API key in a request, some parameters need to be generated from this configuration.
Instances
Show UserConfig Source # | |
Defined in Codeforces.Config showsPrec :: Int -> UserConfig -> ShowS # show :: UserConfig -> String # showList :: [UserConfig] -> ShowS # | |
ToJSON UserConfig Source # | |
Defined in Codeforces.Config toJSON :: UserConfig -> Value # toEncoding :: UserConfig -> Encoding # toJSONList :: [UserConfig] -> Value # toEncodingList :: [UserConfig] -> Encoding # | |
FromJSON UserConfig Source # | |
Defined in Codeforces.Config parseJSON :: Value -> Parser UserConfig # parseJSONList :: Value -> Parser [UserConfig] # |