Fix for new dequeue API

This commit is contained in:
hasufell 2015-09-05 00:51:12 +02:00
parent d8651ced4c
commit 2eba7118b9
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 4 additions and 4 deletions

View File

@ -84,11 +84,11 @@ sortLexPolys (pA'@(_:_), pB'@(_:_)) =
-- queue and traverse the rest. -- queue and traverse the rest.
| ptCmpY (fromMaybe negInfPT (id' <$> Q.first pA)) | ptCmpY (fromMaybe negInfPT (id' <$> Q.first pA))
(fromMaybe negInfPT (id' <$> Q.first pB)) == GT (fromMaybe negInfPT (id' <$> Q.first pB)) == GT
= Q.pushFront (go (maybeShift . snd . Q.popFront $ pA) pB) = Q.pushFront (go (maybeShift . snd . fromJust . Q.popFront $ pA) pB)
(fromJust . Q.first $ pA) (fromJust . Q.first $ pA)
-- Same as above, except that the current point of polygon B -- Same as above, except that the current point of polygon B
-- is higher. -- is higher.
| otherwise = Q.pushFront (go pA (maybeShift . snd . Q.popFront $ pB)) | otherwise = Q.pushFront (go pA (maybeShift . snd . fromJust . Q.popFront $ pB))
(fromJust . Q.first $ pB) (fromJust . Q.first $ pB)
-- Compare the first and the last element of the queue according -- Compare the first and the last element of the queue according

View File

@ -9,13 +9,13 @@ import Data.Maybe
-- |Shift a queue to the left, such as: -- |Shift a queue to the left, such as:
-- [1, 2, 3] -> [2, 3, 1] -- [1, 2, 3] -> [2, 3, 1]
shiftQueueLeft :: BankersDequeue a -> BankersDequeue a shiftQueueLeft :: BankersDequeue a -> BankersDequeue a
shiftQueueLeft = (\(b, nq) -> Q.pushBack nq (fromJust b)) <$> Q.popFront shiftQueueLeft = (\(Just (b, nq)) -> Q.pushBack nq b) <$> Q.popFront
-- |Shift a queue to the right, such as: -- |Shift a queue to the right, such as:
-- [1, 2, 3] -> [3, 1, 2] -- [1, 2, 3] -> [3, 1, 2]
shiftQueueRight :: BankersDequeue a -> BankersDequeue a shiftQueueRight :: BankersDequeue a -> BankersDequeue a
shiftQueueRight = (\(b, nq) -> Q.pushFront nq (fromJust b)) <$> Q.popBack shiftQueueRight = (\(Just (b, nq)) -> Q.pushFront nq b) <$> Q.popBack
-- |Convert a Queue back to a list. -- |Convert a Queue back to a list.