Try keeping lines within 80 columns

This commit is contained in:
Adithya Kumar 2021-02-04 15:41:03 +05:30
parent 78eda63a25
commit 60f88bb9fa
4 changed files with 25 additions and 13 deletions

View File

@ -1535,7 +1535,8 @@ distribute = foldr (teeWith (:)) (yield [])
{-# INLINE partitionByM #-}
partitionByM :: Monad m
=> (a -> m (Either b c)) -> Fold m b x -> Fold m c y -> Fold m a (x, y)
partitionByM f (Fold stepL beginL doneL cleanL) (Fold stepR beginR doneR cleanR) =
partitionByM f (Fold stepL beginL doneL cleanL)
(Fold stepR beginR doneR cleanR) =
Fold step begin done clean
where
@ -1747,7 +1748,8 @@ demuxDefaultWith f kv (Fold dstep dinitial dextract dclean) =
r <- initial1
return
$ case r of
Partial _ -> Right' (Fold step1 (return r) done1 clean1)
Partial _ ->
Right' (Fold step1 (return r) done1 clean1)
Done b -> Left' b
-- initialize folds in the kv map and separate the ones that are done
@ -1771,7 +1773,8 @@ demuxDefaultWith f kv (Fold dstep dinitial dextract dclean) =
else Done (doneMap, b)
{-# INLINE runFold #-}
runFold fPartial fDone doneMap runMap (Fold step1 initial1 done1 clean1) k a1 = do
runFold fPartial fDone doneMap runMap
(Fold step1 initial1 done1 clean1) k a1 = do
resi <- initial1
case resi of
Partial st -> do

View File

@ -380,7 +380,11 @@ mkAccumM_ step initial = mkAccumM step initial return
{-# INLINE mkFold #-}
mkFold :: Monad m => (s -> a -> Step s b) -> Step s b -> (s -> b) -> Fold m a b
mkFold step initial extract =
Fold (\s a -> return $ step s a) (return initial) (return . extract) nocleanup
Fold
(\s a -> return $ step s a)
(return initial)
(return . extract)
nocleanup
-- | Similar to 'mkFold' but the final state extracted is identical to the
-- intermediate state.
@ -590,7 +594,7 @@ instance Monad m => Applicative (Fold m a) where
--
{-# INLINE teeWith #-}
teeWith :: Monad m => (a -> b -> c) -> Fold m x a -> Fold m x b -> Fold m x c
teeWith f (Fold stepL beginL doneL cleanupL) (Fold stepR beginR doneR cleanupR) =
teeWith f (Fold stepL beginL doneL cleanL) (Fold stepR beginR doneR cleanR) =
Fold step begin done cleanup
where
@ -646,9 +650,9 @@ teeWith f (Fold stepL beginL doneL cleanupL) (Fold stepR beginR doneR cleanupR)
bR <- doneR sR
return $ f bL bR
cleanup (RunBoth sL sR) = cleanupL sL >> cleanupR sR
cleanup (RunLeft sL _) = cleanupL sL
cleanup (RunRight _ sR) = cleanupR sR
cleanup (RunBoth sL sR) = cleanL sL >> cleanR sR
cleanup (RunLeft sL _) = cleanL sL
cleanup (RunRight _ sR) = cleanR sR
-- | Like 'teeWith' but terminates when the first fold terminates.
--

View File

@ -436,7 +436,8 @@ alt (Parser stepL initialL extractL) (Parser stepR initialR extractR) =
--
{-# INLINE splitMany #-}
splitMany :: MonadCatch m => Fold m b c -> Parser m a b -> Parser m a c
splitMany (Fold fstep finitial fextract fclean) (Parser step1 initial1 extract1) =
splitMany (Fold fstep finitial fextract fclean)
(Parser step1 initial1 extract1) =
Parser step initial extract
where
@ -490,7 +491,8 @@ splitMany (Fold fstep finitial fextract fclean) (Parser step1 initial1 extract1)
--
{-# INLINE splitSome #-}
splitSome :: MonadCatch m => Fold m b c -> Parser m a b -> Parser m a c
splitSome (Fold fstep finitial fextract fclean) (Parser step1 initial1 extract1) =
splitSome (Fold fstep finitial fextract fclean)
(Parser step1 initial1 extract1) =
Parser step initial extract
where

View File

@ -1825,7 +1825,8 @@ splitOnSuffixSeq
-> Fold m a b
-> Stream m a
-> Stream m b
splitOnSuffixSeq withSep patArr (Fold fstep initial done clean) (Stream step state) =
splitOnSuffixSeq withSep patArr (Fold fstep initial done clean)
(Stream step state) =
Stream stepOuter SplitOnSuffixSeqInit
where
@ -2006,7 +2007,8 @@ splitOnSuffixSeq withSep patArr (Fold fstep initial done clean) (Stream step sta
then go SPEC (idx + 1) wrd1 s fs1
else if wrd1 .&. wordMask /= wordPat
then skip $ SplitOnSuffixSeqWordLoop wrd1 s fs1
else FL.finalExtract done clean fs >>= yieldProceed jump
else FL.finalExtract done clean fs
>>= yieldProceed jump
FL.Done b -> yieldProceed jump b
Skip s -> go SPEC idx wrd s fs
Stop -> skip $ SplitOnSuffixSeqWordDone idx fs wrd
@ -2032,7 +2034,8 @@ splitOnSuffixSeq withSep patArr (Fold fstep initial done clean) (Stream step sta
case r of
FL.Partial fs1 ->
if wrd1 .&. wordMask == wordPat
then FL.finalExtract done clean fs1 >>= yieldProceed jump
then FL.finalExtract done clean fs1
>>= yieldProceed jump
else go SPEC wrd1 s fs1
FL.Done b -> yieldProceed jump b
Skip s -> go SPEC wrd s fs