antisplice-0.17.1.1: An engine for text-based dungeons.

Safe HaskellNone
LanguageHaskell2010

Game.Antisplice.Call

Contents

Description

Provides a powerful language for user input evaluation

Synopsis

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 PredMask rm im where Source

Typeclass for evaluation result predicate masks

Methods

usepmask :: rm -> im -> ChattyDungeonM (Maybe ReError) Source

class PostMask pm im rm | pm im -> rm where Source

Typeclass for evaluation result post-processing masks

Methods

usepost :: pm -> im -> ChattyDungeonM rm Source

Instances

PostMask Nil Nil Nil Source 
PostMask Ignore a Nil Source 
PostMask Pass a (Cons a Nil) Source 
PostMask (a -> b) a (Cons b Nil) Source 
PostMask (a -> b) (Titled a) (Cons b Nil) Source 
(PostMask m i r, PostMask ms is rs, Append r rs rx) => PostMask (Cons m ms) (Cons i is) rx Source 

class CombiMask cm rm pm pom | cm rm -> pm pom where Source

Typeclass for evaluation result combi masks

Methods

ctopred :: cm -> rm -> pm Source

ctopost :: cm -> rm -> pom Source

Instances

CombiMask Nil Nil Nil Nil Source 
CombiMask Pass a Ignore Pass Source 
CombiMask Ignore a Ignore Ignore Source 
CombiMask (a -> Either ReError b) a (a -> Maybe ReError) (a -> b) Source 
CombiMask (a -> Maybe b, String) a (a -> Bool, String) (a -> b) Source 
(CombiMask m i p po, CombiMask ms is ps pos) => CombiMask (Cons m ms) (Cons i is) (Cons p ps) (Cons po pos) Source 

Mask segments

data EnsureLineEnd Source

Ensures that the end of the input is reached

Constructors

EnsureLineEnd 

data CatchByType Source

Catches the string of a token matching the given token type

data CatchToken Source

Catches an entire token

Constructors

CatchToken 
CatchNounc 

data CatchOrd Source

Catches the number of an Ordn token

Constructors

CatchOrd 

data Remaining Source

Catches the remaining part of the line

Constructors

Remaining 

data CatchObj Source

Catches an available, carried or seen object

data Which a Source

Provide multiple alternatives and catch the first matching one as well as its result

Constructors

Which [a] 

Instances

(CallMask a r, Append (Cons a Nil) r ar) => CallMask (Which a) ar Source 

data Optional a Source

Provide an optional mask part

Constructors

Optional a 

Instances

(CallMask a ar, IntoMaybe ar am, Append am Nil am) => CallMask (Optional a) am Source 

data Pass Source

Pass-through a result

Constructors

Pass