readable 0.3.0.1 → 0.3.1
raw patch · 3 files changed
+14/−5 lines, 3 filesdep ~bytestringdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bytestring, text
API changes (from Hackage documentation)
+ Data.Readable: instance Readable ByteString
+ Data.Readable: instance Readable Text
Files
- CHANGELOG.md +4/−0
- readable.cabal +1/−1
- src/Data/Readable.hs +9/−4
CHANGELOG.md view
@@ -1,3 +1,7 @@+0.4+---+* Reinstate Text and ByteString instances because some users require them.+ 0.3.0.1 ------- * Add yes/no and y/n parsing to the Bool instance
readable.cabal view
@@ -1,5 +1,5 @@ name: readable-version: 0.3.0.1+version: 0.3.1 synopsis: Reading from Text and ByteString description:
src/Data/Readable.hs view
@@ -36,7 +36,7 @@ -- 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.+ -- different behavior such as not decoding to UTF8. fromBS :: MonadPlus m => ByteString -> m a fromBS = fromText <=< hushPlus . decodeUtf8' @@ -53,9 +53,14 @@ | T.null rest = return a | otherwise = mzero --- We don't supply instances for Text or ByteString anymore because they're--- almost definitely not what the user would want. Users should use the--- appropriate encodeUtf8/decodeUtf8 functions instead.++-- Leaving out these instances breaks users who depend on having a unified+-- constraint for parsing, so we need to keep them around.+instance Readable ByteString where+ fromText = return . encodeUtf8+ fromBS = return+instance Readable Text where+ fromText = return instance Readable Int where fromText = either (const mzero) checkComplete . signed decimal