Remove some Streaming

This commit is contained in:
2022-08-21 21:53:40 +01:00
parent f1ef75f511
commit cccab45650
8 changed files with 92 additions and 85 deletions
+18 -15
View File
@@ -1,19 +1,22 @@
module Bound where
module Bound (
boundPoints,
) where
import qualified Control.Foldl as L
import Control.Lens
import Geometry
import Control.Lens
import Streaming
import qualified Streaming.Prelude as S
import qualified Control.Foldl as L
-- NSEW
boundPoints :: Stream (Of Point2) Identity () -> Maybe (Float,Float,Float,Float)
---- NSEW
boundPoints :: [Point2] -> Maybe (Float, Float, Float, Float)
{-# INLINE boundPoints #-}
boundPoints = f . runIdentity . L.purely S.fold_ ((,,,)
<$> L.premap (^?! _2) L.maximum
<*> L.premap (^?! _2) L.minimum
<*> L.premap (^?! _1) L.maximum
<*> L.premap (^?! _1) L.minimum
)
boundPoints =
f
. L.fold
( (,,,)
<$> L.premap (^?! _2) L.maximum
<*> L.premap (^?! _2) L.minimum
<*> L.premap (^?! _1) L.maximum
<*> L.premap (^?! _1) L.minimum
)
where
f (mn,ms,me,mw) = (,,,) <$> mn <*> ms <*> me <*> mw
f (mn, ms, me, mw) = (,,,) <$> mn <*> ms <*> me <*> mw