extra loss.
* The word ``commenting`` followed by (whitespace and) another ``type``
- will permit the definitions of flags with argument ``!C`` which will
+ will permit the definitions of flags with argument ``!C``, which will
not influence the score at all and will not print out a score modifier
before the flag text in generated reports.
* The word ``zeroing`` followed by (whitespace and) another ``type``
- will permit the definitions of flags with argument ``!0`` which will
- set the section score to zero.
+ will permit the definitions of flags with score-modifier ``!0``, which
+ will set the section score to zero.
Some shorthands are defined:
score by that percentage of the maximum number of points available in
the section.
- * The literal string ``!0``. Engaging any whole number of flags so
- defined will set the section's score to zero.
-
-* For ``equal`` sections, the only permitted non-empty ``score-modifier``
- is ``!0``, which is interpreted as in ``simple`` sections. All other
- flags in this type of section should have an empty ``score-modifier``.
-
Text between the line beginning with ``:`` (or ``;``) and the dot on a line
by itself will be copied into student grade reports whenever the flag is
given in a grade data file. In many cases, there are many conditions that
text >=1.2 && <2,
trifecta >=1.5 && <2,
ansi-wl-pprint >= 0.6 && <1,
- wl-pprint-extras >=3.5 && <4
+ wl-pprint-extras >=3.5 && <3.6
executable grade
Main-Is: Grade.hs
filepath >= 1.4 && <2,
trifecta >=1.5 && <2,
ansi-wl-pprint >= 0.6 && <1,
- wl-pprint-extras >=3.5 && <4,
+ wl-pprint-extras >=3.5 && <3.6,
+ grade >=0.1
+
+executable phf-xml
+ Main-Is: phf-xml.hs
+ hs-source-dirs: prog
+ default-language: Haskell2010
+ other-extensions: CPP
+ build-depends: base >=4.6 && <5,
+ bytestring >=0.10 && <0.11,
+ cmdlib >= 0.3 && <1,
+ conduit >= 1.2 && <2,
+ conduit-extra >= 1.1 && <2,
+ containers >=0.5 && <1,
+ directory >= 1.2 && <2,
+ filepath >= 1.4 && <2,
+ lens >=4 && <5,
+ mtl >=2.2 && <3,
+ reducers >= 3.12 && <4,
+ resourcet >= 1 && <2,
+ text >=1.2 && <2,
+ transformers >=0.4 && <1,
+ trifecta >=1.5 && <2,
+ ansi-wl-pprint >= 0.6 && <1,
+ wl-pprint-extras >=3.5 && <3.6,
+ xml-conduit >=1.3 && <2,
+ xml-lens >=0.1 && <1,
grade >=0.1
-- Header -------------------------------------------------------------- {{{
module Grade.ParseUtils (
- toUtf8, sseof, word, hashComment, parseMapKeys
+ toUtf8, sseof, wordish, word, hashComment, parseMapKeys
) where
import Control.Applicative
sseof :: (T.TokenParsing f) => f ()
sseof = (T.someSpace <|> T.eof)
+wordish :: (T.DeltaParsing f) => f Text
+wordish = toUtf8 (T.sliced (some (T.notFollowedBy T.someSpace *> T.anyChar)))
+
-- | Grab a word in its entirety. Note that this is a little strange as
-- we check the 'notFollowedBy' condition *first*!
word :: (T.DeltaParsing f) => f Text
-word = toUtf8 (T.sliced (many $ T.notFollowedBy T.someSpace *> T.anyChar)) <* sseof
+word = wordish <* sseof
-- | Grab a comment beginning with # and going to end of line.
hashComment :: T.DeltaParsing f => f Text
, _dingd_multiple :: Bool
, _dingd_comment_lines :: [Text]
}
- deriving (Eq,Ord,{-Show-}Typeable)
+ deriving (Eq,Ord,{-Show,-}Typeable)
$(LTH.makeLenses ''DingDefn)
-data SecMeta sat sdt = SecMeta
- { -- | Title of the section as displayed to the user, not
- -- necessarily the internal name
- _sm_title :: Text
- , -- | Maximum score
- _sm_max :: Double
- , -- | Given a reduced sdsdum, format the score for presentation
- -- or indicate that there has been an error.
- _sm_scorefn :: sat -> sdt -> Either String Double
- , -- | Provide text for printing out the impact of a particular
- -- score adjustment.
- _sm_dingprinter :: sat -> sdt -> Maybe String
}
$(LTH.makeLenses ''SecMeta)
-- It also conains a section scoring function, which
-- reduces dingmods to a score.
data Section f sat sdt loc = Sec
- { _sec_meta :: SecMeta sat sdt
+ { -- | The section header, as displayed to the students
+ _sec_title :: Text
+ -- | The location in the defines file
, _sec_loc :: loc
+ -- | Is this section to be emitted into the skeleton?
, _sec_hidden :: Bool
+ -- | Comment lines preceeding the section definition.
, _sec_comment_lines :: [Text]
, _sec_ding_by_name :: Map DingName (DingDefn sdt loc)
, _sec_dings :: [(DingName, DingDefn sdt loc)]
deriving (Typeable)
$(LTH.makeLenses ''Section)
-{-
-instance (Show sdt, Show loc) => Show (Section sdt loc) where
- show (Sec t m h _ d c) = "Section "
- ++ (show t) ++ " "
- ++ (show m) ++ " "
- ++ (show h) ++ " "
- ++ "<fun> "
- ++ (show d) ++ " "
- ++ (show c)
--}
-
-- | Existentially quantify the section data type for a given section
data ExSection f loc = forall sat sdt . ({-Show sdt,-} Monoid sdt) => ExSec (Section f sat sdt loc)
-{-
-instance (Show loc) => Show (ExSection loc) where
- show es = case es of ExSec s -> show s
--}
-
-- | A Section Callback object, as returned by a section type parser
data SecCallback f sps sat sdt = SC
{ -- | Section header parser for data file. This allows one to
--
-- The String is for use by the skeleton generator.
sc_datline_parse :: (Maybe String, f sat)
+
, -- | Parse section-specific ding weights
sc_ding_parse :: f (sdt,sps)
+
, -- | Optional printout of the sdt data, given
-- the section's final sps.
sc_show_sdt :: sps -> sat -> sdt -> Maybe String
+
, -- | Scoring function, given section maximum
-- value and the monoidal summary of section-specific dings
sc_score :: sps -> sat -> sdt -> Either String Double
+
, -- | Maximum scoring function
sc_max :: sps -> Double
}
data ExSecCallback f = forall sps sat sdt . ({-Show sdt,-} Monoid sdt, Monoid sps)
=> ExSecCB (SecCallback f sps sat sdt)
+{-
+-- | We often want to modify the action of dings in a section. This is
+-- rather like a 'SecCallback' without the at-line types.
+data SecModCallback sps sdt = SMC
+ { -- | Parse a modified ding defintion. If this succeeds, the remainder
+ -- of the ding definition chain will not be considered for this ding.
+ --
+ -- XXX Could maybe have a Boolean indicating whether to continue
+ -- parsing at the next stage. We'd fan out the occurrence of the
+ -- ding to all subscribed stages, essentially...
+ --
+ -- XXX Also consider per-ding arguments in the *data* file...
+ smc_ding_parse :: f (sdt, sps)
+
+ , -- | Render a ding that was parsed by this section. Rather than taking
+ -- the section heading value, if any, these take the computed section
+ -- maximum.
+ smc_show_sdt :: sdt -> Double -> sdt -> Maybe String
+
+ , -- | Compute the new score after this modifier
+ smc_score :: sps -- ^ Cumulative section *parser* state
+ -> sdt -- ^ Cumulative section *ding* state
+ -> Double -- ^ Section maxiumum after all pipeline mods
+ -> Double -- ^ Section score from earlier stages
+ -> Either String Double -- ^ Resulting section score
+
+ , -- | Given the maximum as computed by earlier modules, possibly alter it
+ -- in light of the cumulative parser state
+ smc_max_mod :: sps -> Double -> Double
+ }
+-}
+
+{-
+data SecStatus sps sdt = SMC
+ { -- | The callback operations for this section
+ ss_smc :: SecModCallback sps sdt
+
+ , -- | The set of dings that have been claimed by this section.
+ ss_dings ::
+
+ -- | The section's parser state itself; this will be updated during
+ -- the parser's run as the callback accepts various dings.
+ , ss_sps :: sps
+ }
+-}
+
newtype SecName = SN { unSN :: Text }
deriving (Eq,Ord,Show,Typeable)