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

Safe HaskellNone

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 tSource

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 whereSource

Typeclass for input masks (either single modules or lists of modules)

class PredMask rm im whereSource

Typeclass for evaluation result predicate masks

Methods

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

class PostMask pm im rm | pm im -> rm whereSource

Typeclass for evaluation result post-processing masks

Methods

usepost :: pm -> im -> ChattyDungeonM rmSource

Instances

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

class CombiMask cm rm pm pom | cm rm -> pm pom whereSource

Typeclass for evaluation result combi masks

Methods

ctopred :: cm -> rm -> pmSource

ctopost :: cm -> rm -> pomSource

Instances

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

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 

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 

data Ignore Source

Ignore a token or result

Constructors

Ignore 

data Pass Source

Pass-through a result

Constructors

Pass