diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-11 22:10:23 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-11 22:10:23 +0000 |
commit | 23952a7a6446ef5eee9dce11d3651d4a31979eec (patch) | |
tree | 43693e013ff4875412768561e71aec26ac8bb8c6 /server | |
parent | 501441e2e5c96c85dec68dc42992d91db055f092 (diff) | |
download | thermoprint-23952a7a6446ef5eee9dce11d3651d4a31979eec.tar thermoprint-23952a7a6446ef5eee9dce11d3651d4a31979eec.tar.gz thermoprint-23952a7a6446ef5eee9dce11d3651d4a31979eec.tar.bz2 thermoprint-23952a7a6446ef5eee9dce11d3651d4a31979eec.tar.xz thermoprint-23952a7a6446ef5eee9dce11d3651d4a31979eec.zip |
nicer Seq -> Set morphism
Diffstat (limited to 'server')
-rw-r--r-- | server/src/Thermoprint/Server/Queue.hs | 8 |
1 files changed, 4 insertions, 4 deletions
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 | |||
109 | (unPlain -> Current _ ) <= _ = True | 109 | (unPlain -> Current _ ) <= _ = True |
110 | 110 | ||
111 | fromZipper :: Queue -> Set QueueItem | 111 | fromZipper :: Queue -> Set QueueItem |
112 | fromZipper Queue{..} = Set.fromList . toList $ mconcat [ Seq.mapWithIndex Pending pending | 112 | fromZipper Queue{..} = foldr Set.insert Set.empty $ mconcat [ Seq.mapWithIndex Pending pending |
113 | , maybe Seq.empty (Seq.singleton . Current) current | 113 | , maybe Seq.empty (Seq.singleton . Current) current |
114 | , Seq.mapWithIndex (\i (a, e) -> History i a e) history | 114 | , Seq.mapWithIndex (\i (a, e) -> History i a e) history |
115 | ] | 115 | ] |
116 | 116 | ||
117 | toZipper :: Set QueueItem -> Queue | 117 | toZipper :: Set QueueItem -> Queue |
118 | toZipper = Set.foldl' (flip insert) def | 118 | toZipper = Set.foldl' (flip insert) def |