From 49847034c56b105763a9d6d369f68a7d433ca521 Mon Sep 17 00:00:00 2001
From: Gregor Kleen <gkleen@yggdrasil.li>
Date: Fri, 3 Jun 2016 01:02:26 +0200
Subject: Getter for tip of queue

---
 src/Main.hs           | 2 +-
 src/Sequence/Types.hs | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Main.hs b/src/Main.hs
index 903da05..ea663e8 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -38,7 +38,7 @@ main = do
   let
     description = initialShellDescription
                   { historyFile = Just historyFile
-                  , prompt = \st -> return $ maybe "" (++ " ") ((evalState ?? st) . toName . snd <$> (listToMaybe $ view priorityQueue st)) ++ "→ "
+                  , prompt = \st -> return $ maybe "" (++ " ") ((evalState ?? st) . toName <$> view tip st) ++ "→ "
                   , beforePrompt = gets stateOutline >>= (\str -> if null str then return () else shellPutStrLn str)
                   , commandStyle = OnlyCommands
                   , shellCommands = [ exitCommand "exit"
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