From c601fadf07e4b48c0bea7c2e081ba371cc60a4bc Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Mon, 22 Jul 2013 04:06:40 +0000
Subject: [PATCH 1/3] Do not use 'GHC.IOBase' and 'B.findSubstrings'.

* src/TorDNSEL/Util.hsc: Use 'GHC.IO.Handle.Types' and 'GHC.IORef'
  instead of 'GHC.IOBase'.
 (splitByDelimiter): Remove it.
---
 src/TorDNSEL/Util.hsc |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/TorDNSEL/Util.hsc b/src/TorDNSEL/Util.hsc
index 0ba7365..f71cf99 100644
--- a/src/TorDNSEL/Util.hsc
+++ b/src/TorDNSEL/Util.hsc
@@ -3,8 +3,6 @@
              UndecidableInstances, FlexibleInstances, MultiParamTypeClasses,
              GeneralizedNewtypeDeriving, FlexibleContexts #-}
 {-# OPTIONS_GHC -fno-warn-type-defaults -fno-warn-orphans -Wwarn #-}
---                                                        ^^^^^^
---                                    XXX: findSubstrings is deprecated
 
 -----------------------------------------------------------------------------
 -- |
@@ -59,7 +57,6 @@ module TorDNSEL.Util (
   , htonl
   , ntohl
   , hGetLineN
-  , splitByDelimiter
   , showException
   , showUTCTime
 
@@ -139,7 +136,8 @@ import System.Posix.Types (FileMode)
 import Text.Printf (printf)
 
 import GHC.IO.Handle (BufferMode(..))
-import GHC.IOBase (Handle, Handle__(..), readIORef, writeIORef)
+import GHC.IO.Handle.Types (Handle, Handle__(..))
+import GHC.IORef (readIORef, writeIORef)
 
 import Data.Binary (Binary(..))
 
@@ -374,16 +372,6 @@ hGetLineN handle eol n = do
   bStr <- B.hGet handle n
   return $ fst $ B.breakSubstring eol bStr
 
--- | Split @bs@ into pieces delimited by @delimiter@, consuming the delimiter.
--- The result for overlapping delimiters is undefined.
-splitByDelimiter :: ByteString -> ByteString -> [ByteString]
-splitByDelimiter delimiter bs = subst (-len : B.findSubstrings delimiter bs)
-  where
-    subst (x:xs@(y:_)) = B.take (y-x-len) (B.drop (x+len) bs) : subst xs
-    subst [x]          = [B.drop (x+len) bs]
-    subst []           = error "splitByDelimiter: empty list"
-    len = B.length delimiter
-
 -- | Convert an exception to a string given a list of functions for displaying
 -- dynamically typed exceptions.
 showException :: [Dynamic -> Maybe String] -> E.SomeException -> String
-- 
1.7.9.5

