File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ import Prelude
113
113
import Control.Alt ((<|>))
114
114
import Control.Alternative (class Alternative )
115
115
import Control.Lazy (class Lazy , defer )
116
- import Control.Monad.Rec.Class (class MonadRec , Step (..), tailRecM2 , tailRec )
116
+ import Control.Monad.Rec.Class (class MonadRec , Step (..), tailRecM2 )
117
117
import Control.Monad.ST (pureST )
118
118
import Data.Array.ST (unsafeFreeze , emptySTArray , pushSTArray )
119
119
import Data.Array.ST.Iterator (iterator , iterate , pushWhile )
@@ -521,13 +521,13 @@ span p arr =
521
521
{ init: arr, rest: [] }
522
522
where
523
523
breakIndex = go 0
524
- go = tailRec \i ->
524
+ go i =
525
525
-- This looks like a good opportunity to use the Monad Maybe instance,
526
526
-- but it's important to write out an explicit case expression here in
527
527
-- order to ensure that TCO is triggered.
528
528
case index arr i of
529
- Just x -> if p x then Loop (i + 1 ) else Done ( Just i)
530
- Nothing -> Done Nothing
529
+ Just x -> if p x then go (i + 1 ) else Just i
530
+ Nothing -> Nothing
531
531
532
532
-- | Group equal, consecutive elements of an array into arrays.
533
533
-- |
You can’t perform that action at this time.
0 commit comments