summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Util.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-22 10:14:12 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-22 10:14:12 +0100
commitce2cef43509f7912089443c0a651cb334fd9bcc5 (patch)
tree3a60c24d41c8681a7b042acf053c932ec3727a71 /src/Text/Hakyll/Util.hs
parent137bf6880558603fbbf918e2977b88231065b8a8 (diff)
downloadhakyll-ce2cef43509f7912089443c0a651cb334fd9bcc5.tar.gz
Slightly cleaner split function.
Diffstat (limited to 'src/Text/Hakyll/Util.hs')
-rw-r--r--src/Text/Hakyll/Util.hs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs
index aaa2952..6076dc4 100644
--- a/src/Text/Hakyll/Util.hs
+++ b/src/Text/Hakyll/Util.hs
@@ -6,6 +6,7 @@ module Text.Hakyll.Util
import Data.Char
import Data.List
+import Text.Regex
-- | Trim a string (drop spaces and tabs at both sides).
trim :: String -> String
@@ -23,10 +24,5 @@ stripHTML str = let (beforeTag, rest) = break (== '<') str
tail' xs = tail xs
-- | Split a list at a certain element.
-split :: (Eq a) => a -> [a] -> [[a]]
-split element = unfoldr splitOnce
- where splitOnce l = let r = break (== element) l
- in case r of ([], []) -> Nothing
- (x, xs) -> if null xs
- then Just (x, [])
- else Just (x, tail xs)
+split :: String -> String -> [String]
+split pattern = splitRegex (mkRegex pattern)