From 4ec9cc5e6e1c71184c0537fb2fbd4387f27b3ac2 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Thu, 28 Apr 2016 17:25:01 -0400 Subject: remove kikid, moved to separate repo --- Codec/LineReady.hs | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 Codec/LineReady.hs (limited to 'Codec/LineReady.hs') diff --git a/Codec/LineReady.hs b/Codec/LineReady.hs deleted file mode 100644 index a6961ca..0000000 --- a/Codec/LineReady.hs +++ /dev/null @@ -1,23 +0,0 @@ -module Codec.LineReady where - -import qualified Data.ByteString.Char8 as B -import Data.Monoid -import Data.List (foldl') -import Data.Maybe - -toLineReady :: B.ByteString -> B.ByteString -toLineReady blob = - let as = zip [0..] (B.unpack blob) - bs = filter ((=='\n') . snd) as - is = map fst bs - in B.pack (show is) <> foldl' (replaceCharStrIndex '#') blob is - -replaceCharStrIndex :: Char -> B.ByteString -> Int -> B.ByteString -replaceCharStrIndex c str i = a <> B.singleton c <> B.drop 1 b - where (a,b) = B.splitAt i str - -fromLineReady :: B.ByteString -> B.ByteString -fromLineReady str = foldl' (replaceCharStrIndex '\n') (B.drop 1 str') is - where is = map fst . mapMaybe B.readInt $ - B.groupBy (\c d -> (c/=',')&&(d/=',')) ls - (ls,str') = B.break (==']') (B.drop 1 str) -- cgit v1.2.3