git.iko.soy/typeable/http-api-data
on master help sign in
Move Form-related stuff to Web.FormUrlEncoded
commit4233ec927755e5dc1774e7e4be696de7a448db8c authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateMon 29 Aug 2016, 15:00 (10 years ago) parent7c3d63b
8 files changed+37−29
http-api-data.cabal+6−5 src/Web/FormUrlEncoded.hs+17 src/Web/HttpApiData.hs+1−11 src/Web/HttpApiData/Internal/FormUrlEncoded.hs → src/Web/Internal/FormUrlEncoded.hs+2−2 src/Web/HttpApiData/Internal/HttpApiData.hs → src/Web/Internal/HttpApiData.hs+1−1 test/Web/HttpApiData/Internal/FormUrlEncodedSpec.hs → test/Web/Internal/FormUrlEncodedSpec.hs+4−4 test/Web/HttpApiData/Internal/HttpApiDataSpec.hs → test/Web/Internal/HttpApiDataSpec.hs+3−3 test/Web/HttpApiData/Internal/TestInstances.hs → test/Web/Internal/TestInstances.hs+3−3
http-api-data.cabal+6−5
@@ -36,8 +36,9 @@ library
3636 build-depends: text-show >= 2
3737 exposed-modules:
3838 Web.HttpApiData
39− Web.HttpApiData.Internal.FormUrlEncoded
40− Web.HttpApiData.Internal.HttpApiData
39+ Web.FormUrlEncoded
40+ Web.Internal.FormUrlEncoded
41+ Web.Internal.HttpApiData
4142 ghc-options: -Wall
4243 default-language: Haskell2010
4344
@@ -45,9 +46,9 @@ test-suite spec
4546 type: exitcode-stdio-1.0
4647 main-is: Spec.hs
4748 other-modules:
48− Web.HttpApiData.Internal.FormUrlEncodedSpec
49− Web.HttpApiData.Internal.HttpApiDataSpec
50− Web.HttpApiData.Internal.TestInstances
49+ Web.Internal.FormUrlEncodedSpec
50+ Web.Internal.HttpApiDataSpec
51+ Web.Internal.TestInstances
5152 hs-source-dirs: test
5253 ghc-options: -Wall
5354 default-language: Haskell2010
src/Web/FormUrlEncoded.hsnew file+17
@@ -0,0 +1,17 @@
1+-- |
2+-- Convert Haskell values to and from @application/xxx-form-urlencoded@ format.
3+module Web.FormUrlEncoded (
4+ -- * Classes
5+ ToForm (..),
6+ FromForm (..),
7+
8+ -- * Encoding and decoding @'Form'@s
9+ encodeAsForm,
10+ decodeAsForm,
11+
12+ encodeForm,
13+ decodeForm,
14+) where
15+
16+import Web.Internal.FormUrlEncoded
17+
src/Web/HttpApiData.hs+1−11
@@ -8,8 +8,6 @@ module Web.HttpApiData (
88 -- * Classes
99 ToHttpApiData (..),
1010 FromHttpApiData (..),
11− ToForm (..),
12− FromForm (..),
1311
1412 -- * @'Maybe'@ parsers
1513 parseUrlPieceMaybe,
@@ -37,20 +35,12 @@ module Web.HttpApiData (
3735 parseBoundedEnumOfI,
3836 parseBoundedTextData,
3937
40− -- * Encoding and decoding @'Form'@s
41− encodeAsForm,
42− decodeAsForm,
43−
44− encodeForm,
45− decodeForm,
46−
4738 -- * Other helpers
4839 showTextData,
4940 readTextData,
5041) where
5142
52−import Web.HttpApiData.Internal.FormUrlEncoded
53−import Web.HttpApiData.Internal.HttpApiData
43+import Web.Internal.HttpApiData
5444
5545-- $setup
5646--
src/Web/HttpApiData/Internal/FormUrlEncoded.hs → src/Web/Internal/FormUrlEncoded.hsrenamed+2−2
@@ -10,7 +10,7 @@
1010{-# LANGUAGE ScopedTypeVariables #-}
1111{-# LANGUAGE TypeFamilies #-}
1212{-# LANGUAGE TypeOperators #-}
13−module Web.HttpApiData.Internal.FormUrlEncoded where
13+module Web.Internal.FormUrlEncoded where
1414
1515#if __GLASGOW_HASKELL__ < 710
1616import Control.Applicative
@@ -30,7 +30,7 @@ import GHC.Generics
3030import Network.URI (escapeURIString, isUnreserved,
3131 unEscapeString)
3232
33−import Web.HttpApiData.Internal.HttpApiData
33+import Web.Internal.HttpApiData
3434
3535-- $setup
3636-- >>> :set -XDeriveGeneric
src/Web/HttpApiData/Internal/HttpApiData.hs → src/Web/Internal/HttpApiData.hsrenamed+1−1
@@ -7,7 +7,7 @@
77-- |
88-- Convert Haskell values to and from HTTP API data
99-- such as URL pieces, headers and query parameters.
10−module Web.HttpApiData.Internal.HttpApiData where
10+module Web.Internal.HttpApiData where
1111
1212#if __GLASGOW_HASKELL__ < 710
1313import Control.Applicative
test/Web/HttpApiData/Internal/FormUrlEncodedSpec.hs → test/Web/Internal/FormUrlEncodedSpec.hsrenamed+4−4
@@ -1,7 +1,7 @@
11{-# LANGUAGE CPP #-}
22{-# LANGUAGE OverloadedStrings #-}
33{-# LANGUAGE ScopedTypeVariables #-}
4−module Web.HttpApiData.Internal.FormUrlEncodedSpec (spec) where
4+module Web.Internal.FormUrlEncodedSpec (spec) where
55
66#if __GLASGOW_HASKELL__ < 710
77import Control.Applicative
@@ -14,9 +14,9 @@ import Data.Text (Text, unpack)
1414import Test.Hspec
1515import Test.QuickCheck
1616
17−import Web.HttpApiData.Internal.FormUrlEncoded
18−import Web.HttpApiData.Internal.HttpApiData
19−import Web.HttpApiData.Internal.TestInstances
17+import Web.Internal.FormUrlEncoded
18+import Web.Internal.HttpApiData
19+import Web.Internal.TestInstances
2020
2121spec :: Spec
2222spec = do
test/Web/HttpApiData/Internal/HttpApiDataSpec.hs → test/Web/Internal/HttpApiDataSpec.hsrenamed+3−3
@@ -1,5 +1,5 @@
11{-# Language ScopedTypeVariables #-}
2−module Web.HttpApiData.Internal.HttpApiDataSpec (spec) where
2+module Web.Internal.HttpApiDataSpec (spec) where
33
44import Data.Int
55import Data.Word
@@ -14,9 +14,9 @@ import Test.Hspec
1414import Test.Hspec.QuickCheck(prop)
1515import Test.QuickCheck
1616
17−import Web.HttpApiData.Internal.HttpApiData
17+import Web.Internal.HttpApiData
1818
19−import Web.HttpApiData.Internal.TestInstances
19+import Web.Internal.TestInstances
2020
2121
2222(<=>) :: Eq a => (a -> b) -> (b -> Either T.Text a) -> a -> Bool
test/Web/HttpApiData/Internal/TestInstances.hs → test/Web/Internal/TestInstances.hsrenamed+3−3
@@ -2,7 +2,7 @@
22{-# LANGUAGE OverloadedStrings #-}
33{-# LANGUAGE ScopedTypeVariables #-}
44{-# OPTIONS_GHC -fno-warn-orphans #-}
5−module Web.HttpApiData.Internal.TestInstances
5+module Web.Internal.TestInstances
66 ( RandomCase(..)
77 , SimpleRec(..)
88 , SimpleSumRec(..)
@@ -22,8 +22,8 @@ import GHC.Generics
2222
2323import Test.QuickCheck
2424
25−import Web.HttpApiData.Internal.FormUrlEncoded
26−import Web.HttpApiData.Internal.HttpApiData
25+import Web.Internal.FormUrlEncoded
26+import Web.Internal.HttpApiData
2727
2828instance Arbitrary T.Text where
2929 arbitrary = T.pack <$> arbitrary