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


-- | Reading from Text and ByteString
--   
--   Provides a Readable type class for reading data types from ByteString
--   and Text. Also includes efficient implementations for common data
--   types.
@package readable
@version 0.3.1


-- | The Read type class is very useful for building data types from String
--   representations. But String has high overhead, so sometimes it isn't
--   suitable for applications where space usage and performance are
--   important. This library provides a simpler version of Read's
--   functionality for Text and ByteStrings.
module Data.Readable

-- | ByteString and Text reading using MonadPlus to handle parse failure.
--   On error, fromText and fromBS will return mzero. You can use mplus to
--   provide fallback defaults.
class Readable a

-- | Reads data from a Text representation.
fromText :: (Readable a, MonadPlus m) => Text -> m a

-- | Reads data from a UTF8 encoded ByteString. The default implementation
--   of this function simply decodes with UTF-8 and then calls the fromText
--   function. If decoding fails, mzero will be returned. You can provide
--   your own implementation if you need different behavior such as not
--   decoding to UTF8.
fromBS :: (Readable a, MonadPlus m) => ByteString -> m a
instance Data.Readable.Readable Data.ByteString.Internal.Type.ByteString
instance Data.Readable.Readable Data.Text.Internal.Text
instance Data.Readable.Readable GHC.Types.Int
instance Data.Readable.Readable GHC.Num.Integer.Integer
instance Data.Readable.Readable GHC.Types.Float
instance Data.Readable.Readable GHC.Types.Double
instance Data.Readable.Readable GHC.Types.Bool
instance Data.Readable.Readable GHC.Int.Int8
instance Data.Readable.Readable GHC.Int.Int16
instance Data.Readable.Readable GHC.Int.Int32
instance Data.Readable.Readable GHC.Int.Int64
instance Data.Readable.Readable GHC.Word.Word8
instance Data.Readable.Readable GHC.Word.Word16
instance Data.Readable.Readable GHC.Word.Word32
instance Data.Readable.Readable GHC.Word.Word64
