X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FUtils.hs;h=7dbb1162cbda616ae5eb57ce989bc481f813a9ac;hp=4db7c0555e1e05513052ef0573e4dfab2874fc24;hb=ece223c516e66223ef1d5d8e6bbe4054a235d983;hpb=9668dc27a02b59d7bfb1e9e40af3d2619700ad69 diff --git a/Network/HTTP/Lucu/Utils.hs b/Network/HTTP/Lucu/Utils.hs index 4db7c05..7dbb116 100644 --- a/Network/HTTP/Lucu/Utils.hs +++ b/Network/HTTP/Lucu/Utils.hs @@ -6,7 +6,6 @@ -- functions may be useful too for something else. module Network.HTTP.Lucu.Utils ( splitBy - , joinWith , quoteStr , parseWWWFormURLEncoded , splitPathInfo @@ -31,21 +30,9 @@ import Prelude.Unicode splitBy ∷ (a → Bool) → [a] → [[a]] {-# INLINEABLE splitBy #-} splitBy isSep src - = case break isSep src - of (last , [] ) → [last] - (first, _sep:rest) → first : splitBy isSep rest - --- |> joinWith ":" ["ab", "c", "def"] --- > ==> "ab:c:def" -joinWith ∷ Ascii → [AsciiBuilder] → AsciiBuilder -{-# INLINEABLE joinWith #-} -joinWith sep = flip go (∅) - where - go ∷ [AsciiBuilder] → AsciiBuilder → AsciiBuilder - {-# INLINE go #-} - go [] ab = ab - go (x:[]) ab = ab ⊕ x - go (x:xs) ab = go xs (ab ⊕ A.toAsciiBuilder sep ⊕ x) + = case break isSep src of + (last , [] ) → [last] + (first, _sep:rest) → first : splitBy isSep rest -- |> quoteStr "abc" -- > ==> "\"abc\""