module Network.HTTP.Lucu.Utils
( splitBy -- (a -> Bool) -> [a] -> [[a]]
+ , joinWith -- [a] -> [[a]] -> [a]
, trim -- (a -> Bool) -> [a] -> [a]
, noCaseEq -- String -> String -> Bool
, isWhiteSpace -- Char -> Bool
)
where
+import Control.Monad.Trans
import Data.Char
import Data.List
+import Foreign
+import Foreign.C
splitBy :: (a -> Bool) -> [a] -> [[a]]
(first, sep:rest) -> first : splitBy isSeparator rest
+joinWith :: [a] -> [[a]] -> [a]
+joinWith separator xs
+ = foldr (++) [] $ intersperse separator xs
+
+
trim :: (a -> Bool) -> [a] -> [a]
trim p = trimTail . trimHead
where