myTakeWhile_fold :: (a -> Bool) -> [a] -> [a]
myTakeWhile_fold f = fst . foldr step ([], True)
  where
    step _ r@(_, False)    = r
    step a (l, True) | f a = (l ++ [a], True)
    step _ r@(_, True)     = r

-- Supports infinite lists lazily
myTakeWhile_fold :: (a -> Bool) -> [a] -> [a]
myTakeWhile_fold f = fst . foldr step ([], True)
  where
    step _ r@(_, False)    = r
    step a (l, True) | f a = (l ++ [a], True)
    step _ r@(_, True)     = r

-- Supports infinite lists lazily
myTakeWhile_fold f = fst . foldr step ([], True)
  where
    step _ r@(_, False)    = r
    step a (l, True) | f a = (l ++ [a], True)
    step _ r@(_, True)     = r

-- Supports infinite lists lazily