Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stanford.Moss
Synopsis
- data MossCfg = MossCfg {}
- defaultMossCfg :: MossCfg
- data Language
- type Moss = StateT MossSt IO
- liftIO :: MonadIO m => IO a -> m a
- withMoss :: MossCfg -> Moss a -> IO a
- addBaseFile :: String -> FilePath -> Moss ()
- addFile :: String -> FilePath -> Moss ()
- addFilesForStudent :: [(String, FilePath)] -> Moss ()
- query :: ByteString -> Moss (Maybe ByteString)
Documentation
Represents configurations for a Moss connection.
Constructors
MossCfg | |
Fields
|
defaultMossCfg :: MossCfg Source #
defaultMossCfg
is the default configuration for a Moss connection.
Enumerates programming languages supported by Moss.
Constructors
C | |
CPP | |
Java | |
CSharp | |
Python | |
VisualBasic | |
Javascript | |
FORTRAN | |
ML | |
Haskell | |
Lisp | |
Scheme | |
Pascal | |
Modula2 | |
Ada | |
Perl | |
TCL | |
Matlab | |
VHDL | |
Verilog | |
Spice | |
MIPS | |
A8086 | |
HCL2 | |
ASCII | |
Prolog | |
PLSQL |
Instances
Enum Language Source # | |
Show Language Source # | |
Eq Language Source # | |
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
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
, we would have ended up with this error:liftIO
• 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
and returns an IO
a(m a)
:
,
enabling us to run the program and see the expected results:liftIO
> 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.