antagonist 0.1.0.19 → 0.1.0.22
raw patch · 4 files changed
+14/−14 lines, 4 filesdep +chatty-utilsdep ~antisplicedep ~chatty
Dependencies added: chatty-utils
Dependency ranges changed: antisplice, chatty
Files
- antagonist.cabal +3/−3
- ironforge-yesod.hs +1/−1
- server/Web/Antagonist/Server.hs +6/−6
- server/Web/Antagonist/Server/Data.hs +4/−4
antagonist.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.19+version: 0.1.0.22 -- A short (one-line) description of the package. synopsis: A web interface to Antisplice dungeons.@@ -48,7 +48,7 @@ library exposed-modules: Web.Antagonist.Server, Web.Antagonist.Server.Data- build-depends: base >=4.6 && <4.7, yesod >=1.2 && <1.3, antisplice >=0.16 && <0.17, text >=0.11 && <0.12, chatty >=0.5.4 && <0.6, shakespeare-text >=1.0 && <1.1, hamlet >=1.1 && <1.2, mtl >=2.1 && <2.2, shakespeare-css >=1.0 && <1.1, shakespeare-js >=1.2 && <1.3, time >=1.4 && <1.5, old-locale >=1.0 && <1.1+ build-depends: base >=4.6 && <4.7, yesod >=1.2 && <1.3, antisplice >=0.17 && <0.18, text >=0.11 && <0.12, chatty >=0.6 && <0.7, chatty-utils >=0.7 && <0.8, shakespeare-text >=1.0 && <1.1, hamlet >=1.1 && <1.2, mtl >=2.1 && <2.2, shakespeare-css >=1.0 && <1.1, shakespeare-js >=1.2 && <1.3, time >=1.4 && <1.5, old-locale >=1.0 && <1.1 default-language: Haskell2010 hs-source-dirs: shared, server, . @@ -63,7 +63,7 @@ -- other-extensions: -- Other library packages from which modules are imported.- build-depends: base >=4.6 && <4.7, yesod >=1.2 && <1.3, antisplice >=0.16 && <0.17, text >=0.11 && <0.12, chatty >=0.5.4 && <0.6, shakespeare-text >=1.0 && <1.1, hamlet >=1.1 && <1.2, mtl >=2.1 && <2.2, shakespeare-css >=1.0 && <1.1, shakespeare-js >=1.2 && <1.3, ironforge >=0.1 && <0.2, time >=1.4 && <1.5, old-locale >=1.0 && <1.1+ build-depends: base >=4.6 && <4.7, yesod >=1.2 && <1.3, antisplice >=0.17 && <0.18, text >=0.11 && <0.12, chatty >=0.6 && <0.7, chatty-utils >=0.7 && <0.8, shakespeare-text >=1.0 && <1.1, hamlet >=1.1 && <1.2, mtl >=2.1 && <2.2, shakespeare-css >=1.0 && <1.1, shakespeare-js >=1.2 && <1.3, ironforge >=0.1 && <0.2, time >=1.4 && <1.5, old-locale >=1.0 && <1.1 -- Directories containing source files. hs-source-dirs: shared, server, .
ironforge-yesod.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies, MultiParamTypeClasses #-} import Game.Antisplice.Dungeon.Ironforge-import Game.Antisplice.Utils.AVL import Web.Antagonist.Server+import Data.Chatty.AVL import Data.IORef import Text.Hamlet import Yesod
server/Web/Antagonist/Server.hs view
@@ -1,12 +1,12 @@-{-# LANGUAGE QuasiQuotes, TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, OverloadedStrings, RankNTypes, FlexibleContexts, TupleSections #-}+{-# LANGUAGE QuasiQuotes, TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, OverloadedStrings, RankNTypes, FlexibleContexts, TupleSections, ConstraintKinds #-} -- | A subsite serving a single-user dungeon. module Web.Antagonist.Server ( module Web.Antagonist.Server.Data ) where +import Data.Chatty.AVL import Game.Antisplice-import Game.Antisplice.Utils.AVL import Web.Antagonist.Server.Data import Text.Chatty.Printer import Text.Chatty.Extended.Printer@@ -137,13 +137,13 @@ putDungeonState ds{timeTriggersOf=foldr avlRemove (timeTriggersOf ds) $ map fst ts} forM_ ts (runHandler . snd) -runSession :: (MonadIO m,MonadClock m,MonadRandom m,MonadPrinter m) => Constructor () -> SessionState -> ChattyDungeonM a -> m (a,SessionState)+runSession :: (MonadIO m,ChClock m,ChRandom m,ChPrinter m) => Constructor () -> SessionState -> ChattyDungeonM a -> m (a,SessionState) runSession ctor ss m = do x <- withSession ss m case x of Right r -> return r Left e -> do- eprintLn (Vivid Red) $ case e of+ runHtmlPrinterT $ eprintLn (Vivid Red) $ case e of VerbMustFirstError -> "Please start with a verb." UnintellegibleError -> "I don't understand that." CantWalkThereError -> "I can't walk there."@@ -163,7 +163,7 @@ QuitError -> liftM (undefined,) $ startSession ctor _ -> return (undefined,ss) -withSession :: (MonadIO m,MonadClock m,MonadRandom m,MonadPrinter m) => SessionState -> ChattyDungeonM a -> m (Either SplErr (a,SessionState))+withSession :: (MonadIO m,ChClock m,ChRandom m,ChPrinter m) => SessionState -> ChattyDungeonM a -> m (Either SplErr (a,SessionState)) withSession ((((s,ts),as),c),es) m = runJoinerT $ runNullExpanderT $@@ -176,7 +176,7 @@ flip runDungeonT s m where unjust (Just j) = j -startSession :: (MonadIO m,MonadClock m,MonadRandom m,MonadPrinter m) => Constructor () -> m SessionState+startSession :: (MonadIO m,ChClock m,ChRandom m,ChPrinter m) => Constructor () -> m SessionState startSession init = do Right (_,x) <- withSession ((((none,defVocab),none),0),none) $ do init
server/Web/Antagonist/Server/Data.hs view
@@ -3,10 +3,10 @@ -- | Datatypes for a subsite serving a single-user dungeon. module Web.Antagonist.Server.Data where -import Data.Dynamic+import Data.Chatty.Atoms+import Data.Chatty.AVL+import Data.Chatty.TST import Game.Antisplice-import Game.Antisplice.Utils.AVL-import Game.Antisplice.Utils.TST import Game.Antisplice.Monad.Dungeon import Game.Antisplice.Monad.Vocab import Text.Chatty.Expansion@@ -16,7 +16,7 @@ import Yesod -- | Server-side session state. Everything we need to know about the dungeon.-type SessionState = ((((DungeonState,TST Token),AVL (Int,Dynamic)),Int),[(String,EnvVar)])+type SessionState = ((((DungeonState,TST Token),AVL (Int,Container)),Int),[(String,EnvVar)]) -- | Subsite foundation type, containing the dungeon constructor and the session states. data SingleUserSub = SingleUserSub { currentCounter :: IORef Int, dungeonStates :: IORef (AVL (Int,SessionState,String,NominalDiffTime)), constructor :: Constructor () }