remarks 0.1.0 → 0.1.1
raw patch · 3 files changed
+28/−25 lines, 3 files
Files
- README.md +20/−20
- remarks.cabal +1/−1
- src/Validator.hs +7/−4
README.md view
@@ -33,14 +33,31 @@ See [Issues](https://github.com/oleks/remarks/issues) for a roadmap. Feel free to add or fix some. +## Installation++[`remarks` is on Hackage](http://hackage.haskell.org/package/remarks), so you+can just use [Cabal](https://www.haskell.org/cabal/):++```+$ cabal install remarks+```++You can also clone this repository and use+[Stack](https://docs.haskellstack.org/en/stable/README/):++```+$ stack build+$ stack install+```+ ## Syntax A `.mrk` file is a list of judgements. A judgement starts with a header mark (a sequence of `#`), a title (followed by a `:`), given points (followed by `/`), and maximum points (followed by a line-break). The number of `#` determines the /depth/ of the header, and every file-/must/ start at depth 1, but may have multiple depth 1 judgements. Headings may+break). The number of `#` determines the _depth_ of the header, and every file+_must_ start at depth 1, but may have multiple depth 1 judgements. Headings may be arbitrarily nested, but must sum up correctly. For instance, here is a file containing only quantitative remarks: @@ -139,7 +156,7 @@ To support more exotic setups, `remarks` can also work with directories: * If supplied with a directory path, `remarks` looks for files ending in- `.mrk` inside that directory, and comprehends the files, as above, in+ `.mrk` inside that directory, and comprehends the files as above, in lexicographic filename order (e.g., [directory-with-mrk-files](samples/organization/directory-with-mrk-files)). @@ -174,21 +191,4 @@ $ remarks parse basic.mrk $ remarks parse directory-with-mrk-files $ remarks parse mixed-directory-```--## Installation--[`remarks` is on Hackage](http://hackage.haskell.org/package/remarks), so you-can just use [Cabal](https://www.haskell.org/cabal/):--```-$ cabal install remarks-```--You can also clone this repository and use-[Stack](https://docs.haskellstack.org/en/stable/README/):--```-$ stack build-$ stack install ```
remarks.cabal view
@@ -1,5 +1,5 @@ name: remarks-version: 0.1.0+version: 0.1.1 synopsis: A DSL for marking student work description: A DSL for marking student work; see README.md for further details. homepage: https://github.com/oleks/remarks#readme
src/Validator.hs view
@@ -28,10 +28,13 @@ validate j @ (Judgement (h @ (Header (_, p, maxP)), _, subjs)) = do try (p <= maxP) (PointsExceedMaxPoints h)- try ((sum $ map points subjs) ~= p)- (BadSubJudgementPointsSum j)- try ((sum $ map maxPoints subjs) ~= maxP)- (BadSubJudgementMaxPointsSum j)+ case subjs of+ [] -> return ()+ _ -> do+ try ((sum $ map points subjs) ~= p)+ (BadSubJudgementPointsSum j)+ try ((sum $ map maxPoints subjs) ~= maxP)+ (BadSubJudgementMaxPointsSum j) forM_ subjs validate points :: Judgement -> Double