stripPrefix "foo" "foobar" == Just "bar" stripPrefix "" "baz" == Just "baz" stripPrefix "foo" "quux" == NothingThis is particularly useful with the ViewPatterns extension to GHC, as follows:
{-# LANGUAGE ViewPatterns #-} import Data.Text as T fnordLength :: JSString -> Int fnordLength (stripPrefix "fnord" -> Just suf) = T.length suf fnordLength _ = -1