summaryrefslogtreecommitdiff
path: root/src/Sequence/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Sequence/Utils.hs')
-rw-r--r--src/Sequence/Utils.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Sequence/Utils.hs b/src/Sequence/Utils.hs
index 9fc0ab2..517c3c2 100644
--- a/src/Sequence/Utils.hs
+++ b/src/Sequence/Utils.hs
@@ -1,7 +1,7 @@
1{-# LANGUAGE ViewPatterns, FlexibleContexts, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances, OverloadedStrings #-} 1{-# LANGUAGE ViewPatterns, FlexibleContexts, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances, OverloadedStrings #-}
2 2
3module Sequence.Utils 3module Sequence.Utils
4 ( withArg, withFocus 4 ( withArg, withFocus, withFocus'
5 , toName 5 , toName
6 , Argument(..) 6 , Argument(..)
7 , Completion(..) 7 , Completion(..)
@@ -48,9 +48,10 @@ withArg f (Completable str) = arg str >>= \a -> case a of
48 Just a -> f a 48 Just a -> f a
49 49
50withFocus :: (EntityIdentifier -> Sh GameState ()) -> Sh GameState () 50withFocus :: (EntityIdentifier -> Sh GameState ()) -> Sh GameState ()
51withFocus f = use gFocus >>= \focus -> case focus of 51withFocus f = use gFocus >>= maybe (shellPutErrLn $ "Currently not focusing any entity") f
52 Nothing -> shellPutErrLn $ "Currently not focusing any entity" 52
53 Just id -> f id 53withFocus' :: (Entity -> Sh GameState a) -> Sh GameState (Maybe a)
54withFocus' f = preuse gFocus' >>= maybe (Nothing <$ shellPutErrLn "Currently not focusing any entity") (fmap Just . f)
54 55
55unaligned = view faction' def 56unaligned = view faction' def
56 57