From e66d94505776ec13259bedde4e5342985322a482 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 8 May 2016 02:09:04 +0200 Subject: Feature completion --- src/Utils.hs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/Utils.hs') diff --git a/src/Utils.hs b/src/Utils.hs index cac88ac..b98359a 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -2,8 +2,6 @@ module Utils ( showEntity - , apply, apply' - , entities , takeR ) where @@ -24,23 +22,15 @@ import qualified Data.Set as Set import Data.Sequence (Seq, ViewR(..), (|>)) import qualified Data.Sequence as Seq +import Data.CaseInsensitive ( CI ) +import qualified Data.CaseInsensitive as CI + import Types showEntity :: Entity -> Text showEntity (Entity name number) - | (Just (show -> n)) <- number = name <> " № " <> Text.pack n - | otherwise = name - -apply' :: MonadState Context m => Alteration -> Comment -> m () -apply' alteration comment = modify $ onCtx (apply alteration comment) - where - onCtx f ctx = let (sequence', history') = f $ ctxSequence ctx in ctx { ctxSequence = sequence', ctxHistory = ctxHistory ctx <> history' } - -apply :: Alteration -> Comment -> Sequence -> (Sequence, History) -apply alteration comment seq = undefined - -entities :: MonadState Sequence m => m (Set Entity) -entities = Set.fromList . MaxPQueue.elems <$> get + | (Just (show -> n)) <- number = CI.original name <> " № " <> Text.pack n + | otherwise = CI.original name takeR :: Integer -> Seq a -> Seq a takeR _ (Seq.viewr -> EmptyR) = Seq.empty -- cgit v1.2.3