From 23952a7a6446ef5eee9dce11d3651d4a31979eec Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 11 Feb 2016 22:10:23 +0000 Subject: nicer Seq -> Set morphism --- server/src/Thermoprint/Server/Queue.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/src') diff --git a/server/src/Thermoprint/Server/Queue.hs b/server/src/Thermoprint/Server/Queue.hs index b752576..dcd4119 100644 --- a/server/src/Thermoprint/Server/Queue.hs +++ b/server/src/Thermoprint/Server/Queue.hs @@ -109,10 +109,10 @@ instance Ord PlainQueueItem where (unPlain -> Current _ ) <= _ = True fromZipper :: Queue -> Set QueueItem -fromZipper Queue{..} = Set.fromList . toList $ mconcat [ Seq.mapWithIndex Pending pending - , maybe Seq.empty (Seq.singleton . Current) current - , Seq.mapWithIndex (\i (a, e) -> History i a e) history - ] +fromZipper Queue{..} = foldr Set.insert Set.empty $ mconcat [ Seq.mapWithIndex Pending pending + , maybe Seq.empty (Seq.singleton . Current) current + , Seq.mapWithIndex (\i (a, e) -> History i a e) history + ] toZipper :: Set QueueItem -> Queue toZipper = Set.foldl' (flip insert) def -- cgit v1.2.3