packages feed

moss 0.1.0.0 → 0.2.0.0

raw patch · 4 files changed

+54/−26 lines, 4 files

Files

ChangeLog.md view
@@ -1,3 +1,9 @@ # Changelog for moss -## Unreleased changes+## 0.2++- Add more languages supported by MOSS ([#2](https://github.com/mbg/moss/pull/2))++## 0.1++- Initial release
README.md view
@@ -1,16 +1,20 @@-# moss+# Haskell client library for Moss -Haskell client library for [Moss](https://theory.stanford.edu/~aiken/moss/).+![GitHub](https://img.shields.io/github/license/mbg/moss)+![CI](https://github.com/mbg/moss/workflows/CI/badge.svg)+[![Hackage](https://img.shields.io/hackage/v/moss)](https://hackage.haskell.org/package/moss) +Haskell client library for [Moss](https://theory.stanford.edu/~aiken/moss/) which is an online service for checking for code similarity, primarily aimed at detecting plagiarism. + ## Example -In order to use Moss, you need to register on the Moss website. Once you have your access token, using the library is fairly easy:+In order to use Moss, you need to register on the [Moss website](https://theory.stanford.edu/~aiken/moss/). Once you have your access token, using the library is fairly easy:  ```haskell import Stanford.Moss  cfg :: MossCfg-cfg = defaultMossCfg {+cfg = defaultMossCfg{     mossLanguage = Haskell,     mossUser = "[YOUR ACCESS TOKEN HERE]" }
moss.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.0.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: 242278afc3ff26ab06aac60f132d9b70b071d6757c7763d6bf804c6cf8260412+-- hash: cdb107d0caf11126d5eefa6f4edb3750c1846dbd80ea9e7df483e783c4bbdac9  name:           moss-version:        0.1.0.0+version:        0.2.0.0 synopsis:       Haskell client for Moss description:    Please see the README on Github at <https://github.com/mbg/moss#readme> category:       Web
src/Stanford/Moss.hs view
@@ -35,7 +35,7 @@  -------------------------------------------------------------------------------- --- | Represents the configuration for a Moss connection.+-- | Represents configurations for a Moss connection. data MossCfg = MossCfg {     mossServer     :: HostName,     mossPort       :: ServiceName,@@ -45,7 +45,7 @@     mossMaxMatches :: Int,     mossShow       :: Bool,     mossLanguage   :: Language-}+} deriving (Eq, Show)  -- | 'defaultMossCfg' is the default configuration for a Moss connection. defaultMossCfg :: MossCfg@@ -88,19 +88,38 @@     | MIPS     | A8086     | HCL2-    deriving (Enum)+    | ASCII+    | Prolog+    | PLSQL+    deriving (Eq, Enum)  instance Show Language where-    show C       = "c"-    show CPP     = "cc"-    show Java    = "java"-    show ML      = "ml"-    show Pascal  = "pascal"-    show Ada     = "ada"-    show Lisp    = "lisp"-    show Scheme  = "scheme"-    show Haskell = "haskell"+    show C = "c"+    show CPP = "cc"+    show Java = "java"+    show CSharp = "csharp"+    show Python = "python"+    show VisualBasic = "vb"+    show Javascript = "javascript"     show FORTRAN = "fortran"+    show ML = "ml"+    show Haskell = "haskell"+    show Lisp = "lisp"+    show Scheme = "scheme"+    show Pascal = "pascal"+    show Modula2 = "modula2"+    show Ada = "ada"+    show Perl = "perl"+    show TCL = "tcl"+    show Matlab = "matlab"+    show VHDL = "vhdl"+    show Verilog = "verilog"+    show Spice = "spice"+    show MIPS = "mips"+    show A8086 = "a8086"+    show ASCII = "ascii"+    show Prolog = "prolog"+    show PLSQL = "plsql"  -------------------------------------------------------------------------------- @@ -109,8 +128,9 @@     mossSocket  :: Socket,     mossCounter :: Int,     mossCfg     :: MossCfg-}+} deriving (Eq, Show) +-- | The type of computations which use a connection to Moss. type Moss = StateT MossSt IO  -- | 'sendCmd' @socket bytestring@ sends @bytestring@ as a command over the@@ -144,10 +164,6 @@                 sendCmd s "end"                 return r -{-send = withSocketsDo $ do-    h <- connectTo mossServer mossPort-    hClose h-}- -- | 'uploadFile' @index name path@ uploads a file located at @path@ to Moss -- and assigns it to the collection of files at @index@ (e.g. representing -- a student) with the name given by @name@.@@ -187,7 +203,9 @@         uploadFile (mossCounter st) dn fn     put $ st { mossCounter = mossCounter st + 1 } --- | 'query' @comment@ runs the plagiarism check on all submitted files+-- | '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. query :: BS.ByteString -> Moss (Maybe BS.ByteString) query cmt = do     s <- gets mossSocket