urlencoded 0.4.1 → 0.4.2.0
raw patch · 3 files changed
+42/−28 lines, 3 filesdep +urlencodeddep ~QuickCheckdep ~basedep ~mtl
Dependencies added: urlencoded
Dependency ranges changed: QuickCheck, base, mtl, network, network-uri
Files
- src/Data/URLEncoded.hs +12/−1
- test/TestDriver.hs +3/−5
- urlencoded.cabal +27/−22
src/Data/URLEncoded.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances #-}+{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances, CPP #-} -- |Implements a data type for constructing and destructing -- x-www-urlencoded strings. See -- <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1>@@ -41,15 +41,26 @@ import Data.List.Split ( splitOn ) import Control.Monad ( liftM ) import Control.Arrow ( (>>>) )+#if MIN_VERSION_base(4,8,0)+import Control.Monad.Except ( MonadError )+#else import Control.Monad.Error ( MonadError )+#endif import Network.URI ( unEscapeString, escapeURIString, isUnreserved, URI(uriQuery) ) import Data.Monoid ( Monoid, mappend )+#if MIN_VERSION_base(4,9,0)+import Data.Semigroup ( Semigroup )+#endif import Data.List ( intercalate ) import Data.Maybe ( fromMaybe ) -- | A container for URLEncoded data newtype URLEncoded = URLEncoded { pairs :: [(String, String)] }+#if MIN_VERSION_base(4,9,0)+ deriving (Semigroup, Monoid, Eq)+#else deriving (Monoid, Eq)+#endif class AddURLEncoded a where (%?) :: URLEncode args => a -> args -> a
test/TestDriver.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Main where -import Control.Monad ( liftM, replicateM, liftM2 )+import Control.Monad ( liftM, replicateM ) import Data.Monoid ( mconcat ) import Data.Maybe ( isJust )@@ -19,11 +19,9 @@ arbitrary = do numPairs <- sized $ \n -> choose (0, n) importList `liftM` replicateM numPairs (two arbitraryQueryArg)- coarbitrary = undefined -instance Applicative Gen where- (<*>) = liftM2 ($)- pure = return+two :: Gen b -> Gen (b, b)+two = fmap (\[x,y] -> (x,y)) . vectorOf 2 arbitraryQueryArg :: Gen String arbitraryQueryArg = do
urlencoded.cabal view
@@ -1,6 +1,6 @@ name: urlencoded-Cabal-Version: >= 1.6-version: 0.4.1+Cabal-Version: >= 1.8+version: 0.4.2.0 synopsis: Generate or process x-www-urlencoded data description: Generate or process x-www-urlencoded data as it@@ -8,44 +8,49 @@ <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1> category: Web-homepage: https://github.com/pheaver/urlencoded+homepage: https://github.com/fgaz/urlencoded stability: alpha license: BSD3 license-file: LICENSE author: Josh Hoyt, Philip Weaver-maintainer: philip.weaver@gmail.com-build-type: Custom+maintainer: francygazz@gmail.com+build-type: Simple -Flag Test- Description: Build the test executable- Default: False+source-repository head+ type: git+ location: git://github.com/fgaz/urlencoded.git Flag network-uri description: Get Network.URI from the network-uri package default: True Library- build-depends: base == 4.*, mtl >= 1.1, split == 0.2.*+ build-depends: base >= 4.7 && <4.12+ , mtl >= 1.1 && <2.3+ , split == 0.2.* if flag(network-uri)- build-depends: network-uri >= 2.6, network >= 2.6+ build-depends: network-uri >= 2.6+ , network >= 2.6 else- build-depends: network-uri < 2.6, network < 2.6 && >= 2.2+ build-depends: network-uri < 2.6+ , network < 2.6 && >= 2.2 ghc-options: -Wall hs-source-dirs: src exposed-modules: Data.URLEncoded --- This executable is not installed by the (custom) Setup program. It is--- used by the test hook (cabal test)-Executable test- if flag(test)- Buildable: True- build-depends:- QuickCheck >= 1.2 && < 1.3-+Test-suite test+ type: exitcode-stdio-1.0+ build-depends: base+ , QuickCheck >= 2.11 && < 2.12+ , urlencoded+ if flag(network-uri)+ build-depends: network-uri >= 2.6+ , network >= 2.6 else- Buildable: False+ build-depends: network-uri < 2.6+ , network < 2.6 && >= 2.2 GHC-Options: -Wall Main-is: TestDriver.hs- HS-Source-Dirs: src, test- X-Test-Executable: true+ HS-Source-Dirs: test+