From 2eba7118b9ae68c34b0f443f1783cc51bad5f8ca Mon Sep 17 00:00:00 2001 From: hasufell Date: Sat, 5 Sep 2015 00:51:12 +0200 Subject: [PATCH] Fix for new dequeue API --- Algorithms/PolygonIntersection.hs | 4 ++-- QueueEx.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Algorithms/PolygonIntersection.hs b/Algorithms/PolygonIntersection.hs index 33305b8..82bef6d 100644 --- a/Algorithms/PolygonIntersection.hs +++ b/Algorithms/PolygonIntersection.hs @@ -84,11 +84,11 @@ sortLexPolys (pA'@(_:_), pB'@(_:_)) = -- queue and traverse the rest. | ptCmpY (fromMaybe negInfPT (id' <$> Q.first pA)) (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) -- Same as above, except that the current point of polygon B -- 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) -- Compare the first and the last element of the queue according diff --git a/QueueEx.hs b/QueueEx.hs index d590ccc..28ea2e6 100644 --- a/QueueEx.hs +++ b/QueueEx.hs @@ -9,13 +9,13 @@ import Data.Maybe -- |Shift a queue to the left, such as: -- [1, 2, 3] -> [2, 3, 1] 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: -- [1, 2, 3] -> [3, 1, 2] 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.