katt-0.2.0.3: Client for the Kattis judge system.

Safe HaskellNone

Utils.Katt.Utils

Description

Contains shared type declarations and various utility functions.

Synopsis

Documentation

type ConfigEnvInternal m = StateT ConfigState mSource

Configuration layer consisting of configuration state.

type ConfigEnv m = EitherT ErrorDesc (ConfigEnvInternal m)Source

Configuration layer wrapped with error handling.

type Submission = (KattisProblem, [FilePath])Source

Submissions consist of a problem identifier and a set of file paths.

type ErrorDesc = ByteStringSource

Error description alias.

type SubmissionId = IntegerSource

Submissions are identified with an integer id.

type ProblemSession = IntegerSource

Problem sessions are identified with an integer id.

type ProjectState = KattisProblemSource

Project-specific state consists of the problem name.

data ConfigState Source

Global configuration, initialized from the .kattisrc file.

Constructors

ConfigState 

Fields

user :: ByteString

Username.

apiKey :: ByteString

API token (hash).

host :: ByteString

Host to be considered as service.

loginPage :: ByteString

URL to login page, relative host.

submitPage :: ByteString

URL to submit page, relative host.

project :: Maybe ProjectState

Project-specific state, optionally loaded.

Instances

type Session = (Session, ByteString)Source

HTTP client session and the host path.

data KattisProblem Source

A Kattis problem.

Constructors

ProblemId Integer

Problem ID, unique.

ProblemName ByteString

Associated name of the problem.

data KattisLanguage Source

Language used in submission.

Constructors

LangCplusplus

C++.

LangJava

Java.

LangC

C.

LangHaskell

Haskell.

loginSuccess :: ByteStringSource

Server response indicating successful login.

inputTestExtension :: FilePathSource

Extension of input test files.

outputTestExtension :: FilePathSource

Extension of reference ouput test files.

programName :: ByteStringSource

Name of this program.

configDir :: ByteStringSource

Relative path to project-specific configuration directory.

testFolder :: FilePathSource

Relative path to folder containing tests.

problemAddress :: ByteStringSource

URL to page with problem information, relative to host.

unWrapTrans :: (Monad m, MonadTrans t) => EitherT e m a -> EitherT e (t m) aSource

Lift some error monad one layer.

tryIO :: MonadIO m => IO a -> EitherT ErrorDesc m aSource

Execute an IO action and catch any exceptions.

tryIOMsg :: MonadIO m => ByteString -> IO a -> EitherT ErrorDesc m aSource

Execute an IO action and catch any exceptions, tagged with description.

terminateOnFailure :: MonadIO m => ErrorDesc -> EitherT ErrorDesc m a -> m aSource

Evaluate an error action and terminate process upon failure.

defaultOpts :: OptionsSource

Default HTTP options.

retrievePublicPage :: ByteString -> ConfigEnv IO ByteStringSource

Retrieve a publicly available page, using HTTP GET.

retrievePrivatePage :: Session -> ByteString -> EitherT ErrorDesc IO ByteStringSource

Retrieve a page requiring authentication, using HTTP GET.

buildURL :: ByteString -> ByteString -> StringSource

Construct URL from host path (e.g. http:\/x.com/) and path (e.g. ).

withAuth :: (Session -> EitherT ErrorDesc IO a) -> ConfigEnv IO aSource

Authenticate and run the provided action.

retrieveProblemId :: KattisProblem -> IO IntegerSource

Retrieve problem ID of a Kattis problem.

retrieveProblemName :: KattisProblem -> IO ByteStringSource

Retrieve problem name of a Kattis problem.