From 49847034c56b105763a9d6d369f68a7d433ca521 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 3 Jun 2016 01:02:26 +0200 Subject: Getter for tip of queue --- src/Sequence/Types.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Sequence') diff --git a/src/Sequence/Types.hs b/src/Sequence/Types.hs index afe1060..fd8d7ab 100644 --- a/src/Sequence/Types.hs +++ b/src/Sequence/Types.hs @@ -7,7 +7,7 @@ module Sequence.Types , Entity(..), eFaction, eSeqVal , EntityName(..), entityName , EntityIdentifier(..), entityId - , inhabitedFactions, priorityQueue + , inhabitedFactions, priorityQueue, tip ) where import Control.Lens @@ -99,3 +99,6 @@ priorityQueue = to priorityQueue' priorityQueue' (Map.toAscList . view gEntities -> entities) = sortBy (comparing $ Down . snd) . concat . map filter . map (over _1 $ view eSeqVal) . map swap $ entities filter (Nothing, _) = mempty filter (Just val, id) = pure (val, id) + +tip :: Getter GameState (Maybe EntityIdentifier) +tip = priorityQueue . to (fmap snd . listToMaybe) -- cgit v1.2.3