Skip to content

Instantly share code, notes, and snippets.

@voidlizard
Created November 5, 2019 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voidlizard/efbda838c4b44a605b578cce8937b1c6 to your computer and use it in GitHub Desktop.
Save voidlizard/efbda838c4b44a605b578cce8937b1c6 to your computer and use it in GitHub Desktop.
cutSectionSmart :: (Text -> Bool) -> (Text -> Bool) -> [Text] -> [Text]
cutSectionSmart a b txt = cutI
where
cutC = List.dropWhile (not . a) txt
cutI = List.takeWhile (not . b) cutC
cutSection :: Text -> Text -> [Text] -> [Text]
cutSection a b txt = cutI
where
cutC = List.dropWhile (\s -> not (normEq s a)) txt
cutI = List.takeWhile (\s -> not (normEq s b)) cutC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment