Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides a powerful language for user input evaluation
- processMask :: (Append m (Cons EnsureLineEnd Nil) s, CallMask s r, Append r Nil r, Tuplify r t) => m -> [String] -> DungeonM t
- tryMask :: (Append m (Cons EnsureLineEnd Nil) s, Append r Nil r, CallMask s r) => m -> [String] -> DungeonM (Either ReError r)
- class CallMask cm l | cm -> l where
- usemask :: (MonadRoom m, MonadPlayer m) => cm -> StateT [(String, Token)] m (Either ReError l)
- verbosemask :: cm -> String
- class PredMask rm im where
- usepmask :: rm -> im -> ChattyDungeonM (Maybe ReError)
- class PostMask pm im rm | pm im -> rm where
- usepost :: pm -> im -> ChattyDungeonM rm
- class CombiMask cm rm pm pom | cm rm -> pm pom where
- data EnsureLineEnd = EnsureLineEnd
- data CatchByType
- data CatchToken
- data CatchOrd = CatchOrd
- data Remaining = Remaining
- data CatchObj
- data Which a = Which [a]
- data Optional a = Optional a
- data Ignore = Ignore
- data Pass = Pass
Using call masks
processMask :: (Append m (Cons EnsureLineEnd Nil) s, CallMask s r, Append r Nil r, Tuplify r t) => m -> [String] -> DungeonM t Source
Use a mask on a list of tokens and tuplify the result. Dispatch errors to the underlying monad.
tryMask :: (Append m (Cons EnsureLineEnd Nil) s, Append r Nil r, CallMask s r) => m -> [String] -> DungeonM (Either ReError r) Source
Try to use a mask on a list of tokens.
Mask classes
class CallMask cm l | cm -> l where Source
Typeclass for input masks (either single modules or lists of modules)
usemask :: (MonadRoom m, MonadPlayer m) => cm -> StateT [(String, Token)] m (Either ReError l) Source
verbosemask :: cm -> String Source
CallMask String Nil | |
CallMask Nil Nil | |
CallMask Token Nil | |
CallMask Ignore Nil | |
CallMask EnsureLineEnd Nil | |
CallMask CatchObj (Cons (Titled ObjectState) Nil) | |
CallMask Remaining (Cons [String] Nil) | |
CallMask CatchOrd (Cons Int Nil) | |
CallMask CatchToken (Cons Token Nil) | |
CallMask CatchByType (Cons String Nil) | |
(CallMask a ar, IntoMaybe ar am, Append am Nil am) => CallMask (Optional a) am | |
(CallMask a r, Append (Cons a Nil) r ar) => CallMask (Which a) ar | |
(CallMask x r, CallMask xs rs, Append r rs rx) => CallMask (Cons x xs) rx |
class PredMask rm im where Source
Typeclass for evaluation result predicate masks
usepmask :: rm -> im -> ChattyDungeonM (Maybe ReError) Source
class PostMask pm im rm | pm im -> rm where Source
Typeclass for evaluation result post-processing masks
usepost :: pm -> im -> ChattyDungeonM rm Source
class CombiMask cm rm pm pom | cm rm -> pm pom where Source
Typeclass for evaluation result combi masks
CombiMask Nil Nil Nil Nil | |
CombiMask Pass a Ignore Pass | |
CombiMask Ignore a Ignore Ignore | |
CombiMask (a -> Either ReError b) a (a -> Maybe ReError) (a -> b) | |
CombiMask (a -> Maybe b, String) a (a -> Bool, String) (a -> b) | |
(CombiMask m i p po, CombiMask ms is ps pos) => CombiMask (Cons m ms) (Cons i is) (Cons p ps) (Cons po pos) |
Mask segments
data EnsureLineEnd Source
Ensures that the end of the input is reached
data CatchByType Source
Catches the string of a token matching the given token type
data CatchToken Source
Catches an entire token
Catches the remaining part of the line
Catches an available, carried or seen object
Provide multiple alternatives and catch the first matching one as well as its result
Which [a] |
Provide an optional mask part
Optional a |
Ignore a token or result