uri-bytestring 0.2.3.3 → 0.3.0.0
raw patch · 5 files changed
+33/−5 lines, 5 filesdep +fail
Dependencies added: fail
Files
- README.md +1/−0
- changelog.md +4/−0
- src/URI/ByteString/Internal.hs +12/−2
- test/URI/ByteString/Arbitrary.hs +14/−2
- uri-bytestring.cabal +2/−1
README.md view
@@ -16,3 +16,4 @@ * [Michael Hatfield](https://github.com/mikehat) * [reactormonk](https://github.com/reactormonk) * [Oleg Grenrus](https://github.com/phadej)+* [Edward Betts](https://github.com/EdwardBetts)
changelog.md view
@@ -1,3 +1,7 @@+0.3.0.0+* Add MonadFail instance.+* Correct haddock spelling mistake.+ 0.2.3.3 * Make buildable on GHC 8.2.1.
src/URI/ByteString/Internal.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-}@@ -11,9 +12,10 @@ import qualified Blaze.ByteString.Builder.Char.Utf8 as BB import Control.Applicative import Control.Monad+import qualified Control.Monad.Fail as F import Data.Attoparsec.ByteString import qualified Data.Attoparsec.ByteString as A-import qualified Data.Attoparsec.ByteString.Char8 as A ( decimal )+import qualified Data.Attoparsec.ByteString.Char8 as A (decimal) import Data.Bits import Data.ByteString (ByteString) import qualified Data.ByteString as BS@@ -794,6 +796,14 @@ , Monoid) +instance F.MonadFail (Parser' e) where+#if MIN_VERSION_attoparsec(0,13,1)+ fail e = Parser' (F.fail e)+#else+ fail e = Parser' (fail e)+#endif++ ------------------------------------------------------------------------------- -- | Use with caution. Catch a parser failing and return Nothing. mParse :: Parser' e a -> Parser' e (Maybe a)@@ -804,7 +814,7 @@ -- | If the first parser succeeds, discard the result and use the -- second parser (which may fail). If the first parser fails, return -- Nothing. This is used to check a benign precondition that indicates--- the presence of a parsible token, i.e. ? preceeding a query.+-- the presence of a parsible token, i.e. ? preceding a query. thenJust :: Parser' e a -> Parser' e b -> Parser' e (Maybe b) thenJust p1 p2 = p1 *> (Just <$> p2) <|> pure Nothing
test/URI/ByteString/Arbitrary.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -9,6 +11,7 @@ import Control.Applicative import Data.Proxy (Proxy (..)) import qualified Generics.SOP as SOP+import qualified Generics.SOP.Constraint as SOP import qualified Generics.SOP.GGP as SOP import GHC.Generics (Generic) import Test.QuickCheck@@ -22,11 +25,20 @@ -- this workaround can go away when -- <https://github.com/nick8325/quickcheck/pull/40> is merged.-sopArbitrary :: (Generic a, SOP.GTo a, SOP.All SOP.SListI (SOP.GCode a), SOP.All2 Arbitrary (SOP.GCode a)) => Gen a+sopArbitrary+ :: ( SOP.SListI (SOP.GCode b)+ , Generic b+ , SOP.GTo b+ , SOP.AllF SOP.SListI (SOP.GCode b)+ , SOP.AllF (SOP.All Arbitrary) (SOP.GCode b)+ )+ => Gen b sopArbitrary = fmap SOP.gto sopArbitrary' -sopArbitrary' :: (SOP.All SOP.SListI xss, SOP.All2 Arbitrary xss) => Gen (SOP.SOP SOP.I xss)+sopArbitrary'+ :: (SOP.SListI xs, SOP.AllF (SOP.All Arbitrary) xs, SOP.AllF SOP.SListI xs)+ => Gen (SOP.SOP SOP.I xs) sopArbitrary' = oneof (map SOP.hsequence $ SOP.apInjs_POP $ SOP.hcpure p arbitrary) where p :: Proxy Arbitrary
uri-bytestring.cabal view
@@ -1,5 +1,5 @@ name: uri-bytestring-version: 0.2.3.3+version: 0.3.0.0 synopsis: Haskell URI parsing as ByteStrings description: uri-bytestring aims to be an RFC3986 compliant URI parser that uses efficient ByteStrings for parsing and representing the URI data. license: BSD3@@ -41,6 +41,7 @@ attoparsec >= 0.12 && < 0.14 , base >= 4.6 && < 5+ , fail >= 4.9 && < 5 , bytestring >= 0.9.1 && < 0.11 , blaze-builder >= 0.3.0.0 && < 0.5 , template-haskell >= 2.9 && < 2.13