-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Library to process and search large files or a collection of files
--   
--   Library to process and search large files or a collection of files
@package fileplow
@version 0.1.0.0

module Data.FilePlow
class PlowHandle hdl
pSeek :: PlowHandle hdl => hdl -> SeekMode -> Integer -> IO ()
pTell :: PlowHandle hdl => hdl -> IO Integer
pGetChar :: PlowHandle hdl => hdl -> IO Char
pGetLine :: PlowHandle hdl => hdl -> IO ByteString
pIsEOF :: PlowHandle hdl => hdl -> IO Bool
pFileSize :: PlowHandle hdl => hdl -> IO Integer

-- | Haskell defines operations to read and write characters from and to
--   files, represented by values of type <tt>Handle</tt>. Each value of
--   this type is a <i>handle</i>: a record used by the Haskell run-time
--   system to <i>manage</i> I/O with file system objects. A handle has at
--   least the following properties:
--   
--   <ul>
--   <li>whether it manages input or output or both;</li>
--   <li>whether it is <i>open</i>, <i>closed</i> or
--   <i>semi-closed</i>;</li>
--   <li>whether the object is seekable;</li>
--   <li>whether buffering is disabled, or enabled on a line or block
--   basis;</li>
--   <li>a buffer (whose length may be zero).</li>
--   </ul>
--   
--   Most handles will also have a current I/O position indicating where
--   the next input or output operation will occur. A handle is
--   <i>readable</i> if it manages only input or both input and output;
--   likewise, it is <i>writable</i> if it manages only output or both
--   input and output. A handle is <i>open</i> when first allocated. Once
--   it is closed it can no longer be used for either input or output,
--   though an implementation cannot re-use its storage while references
--   remain to it. Handles are in the <a>Show</a> and <a>Eq</a> classes.
--   The string produced by showing a handle is system dependent; it should
--   include enough information to identify the handle for debugging. A
--   handle is equal according to <a>==</a> only to itself; no attempt is
--   made to compare the internal state of different handles for equality.
data Handle

-- | A mode that determines the effect of <tt>hSeek</tt> <tt>hdl mode
--   i</tt>.
data SeekMode

-- | the position of <tt>hdl</tt> is set to <tt>i</tt>.
AbsoluteSeek :: SeekMode

-- | the position of <tt>hdl</tt> is set to offset <tt>i</tt> from the
--   current position.
RelativeSeek :: SeekMode

-- | the position of <tt>hdl</tt> is set to offset <tt>i</tt> from the end
--   of the file.
SeekFromEnd :: SeekMode

-- | Seek until a certain charater is reached
seekUntil :: PlowHandle hdl => hdl -> (Char -> Bool) -> IO Bool

-- | Seek until a certain charater is reached in reverse
seekUntilRev :: PlowHandle hdl => hdl -> (Char -> Bool) -> IO Bool
data MultiHandle h
withMultiHandle :: [FilePath] -> (MultiHandle Handle -> IO a) -> IO a
instance Data.FilePlow.PlowHandle h => Data.FilePlow.PlowHandle (Data.FilePlow.MultiHandle h)
instance Data.FilePlow.PlowHandle GHC.IO.Handle.Types.Handle

module Data.FilePlow.Ordered

-- | place the file handling to a specific <a>SeekTarget</a> provided a
--   function that extracts a value/entry at a specific position
data SeekTarget b

-- | put the handle to the first entry that is larger than the provided
--   value. Useful for files with entries in ASCending order
StLargerThan :: !b -> SeekTarget b

-- | put the handle to the first entry that is smaller than the provided
--   value. Useful for files with entries in DESCending order
StSmallerThan :: !b -> SeekTarget b
seekTo :: (Ord b, Eq b, PlowHandle hdl) => hdl -> SeekTarget b -> (hdl -> IO b) -> IO Bool
instance GHC.Classes.Eq b => GHC.Classes.Eq (Data.FilePlow.Ordered.SeekTarget b)
instance GHC.Show.Show b => GHC.Show.Show (Data.FilePlow.Ordered.SeekTarget b)
