From 99b12580b0ef0592dbfb5da04070114314e9b7f8 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 8 May 2016 00:00:20 +0200 Subject: framework for command parsing --- src/Utils.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Utils.hs') diff --git a/src/Utils.hs b/src/Utils.hs index 2254fde..945c6b7 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -3,16 +3,23 @@ module Utils ( showEntity , apply, apply' + , entities ) where import Data.Text (Text) import qualified Data.Text as Text +import Data.PQueue.Prio.Max (MaxPQueue) +import qualified Data.PQueue.Prio.Max as MaxPQueue + import Data.Monoid (Monoid(..), (<>)) import Control.Monad.State.Class import Control.Monad.Writer.Class +import Data.Set (Set) +import qualified Data.Set as Set + import Types showEntity :: Entity -> Text @@ -28,3 +35,6 @@ apply' alteration = do apply :: Alteration -> Sequence -> (Sequence, History) apply alteration seq = undefined + +entities :: MonadState Sequence m => m (Set Entity) +entities = Set.fromList . MaxPQueue.keys <$> get -- cgit v1.2.3