module Issue.Text ( stripIssueMarkers, issueMarkers, ) where import Control.Arrow (first) import Data.Text qualified as T issueMarkers :: [T.Text] issueMarkers = [ "TODO", "FIXME", "QUESTION" ] stripIssueMarkers :: T.Text -> ([T.Text], T.Text) stripIssueMarkers text = case [marker | marker <- issueMarkers, T.isPrefixOf marker text] of (marker : _) -> first (marker :) . stripIssueMarkers $ T.stripStart (T.drop (T.length marker) text) [] -> ([], text)