moss
Safe HaskellNone
LanguageHaskell2010

Stanford.Moss

Synopsis

Documentation

data MossCfg Source #

Represents configurations for a Moss connection.

Instances

Instances details
Show MossCfg Source # 
Instance details

Defined in Stanford.Moss

Eq MossCfg Source # 
Instance details

Defined in Stanford.Moss

Methods

(==) :: MossCfg -> MossCfg -> Bool #

(/=) :: MossCfg -> MossCfg -> Bool #

defaultMossCfg :: MossCfg Source #

defaultMossCfg is the default configuration for a Moss connection.

data Language Source #

Enumerates programming languages supported by Moss.

Instances

Instances details
Enum Language Source # 
Instance details

Defined in Stanford.Moss

Show Language Source # 
Instance details

Defined in Stanford.Moss

Eq Language Source # 
Instance details

Defined in Stanford.Moss

type Moss = StateT MossSt IO Source #

The type of computations which use a connection to Moss.

liftIO :: MonadIO m => IO a -> m a #

Lift a computation from the IO monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. IO is the base monad for the stack).

Example

Expand
import Control.Monad.Trans.State -- from the "transformers" library

printState :: Show s => StateT s IO ()
printState = do
  state <- get
  liftIO $ print state

Had we omitted liftIO, we would have ended up with this error:

• Couldn't match type ‘IO’ with ‘StateT s IO’
 Expected type: StateT s IO ()
   Actual type: IO ()

The important part here is the mismatch between StateT s IO () and IO ().

Luckily, we know of a function that takes an IO a and returns an (m a): liftIO, enabling us to run the program and see the expected results:

> evalStateT printState "hello"
"hello"

> evalStateT printState 3
3

withMoss :: MossCfg -> Moss a -> IO a Source #

withMoss cfg m runs a computation m using a Moss connection whose configuration is reprsented by cfg.

addBaseFile :: String -> FilePath -> Moss () Source #

addBaseFile file adds file as part of the skeleton code.

addFile :: String -> FilePath -> Moss () Source #

addFile name file adds file as a submission to Moss with name.

addFilesForStudent :: [(String, FilePath)] -> Moss () Source #

addFilesForStudent filesWithNames uploads multiple files for the same student. I.e. in the Moss submission they will share the same ID.

query :: ByteString -> Moss (Maybe ByteString) Source #

query comment runs the plagiarism check on all submitted files. The URL of the report is returned if Moss was able to perform the checks successfully.