git.iko.soy/typeable/http-api-data
on master help sign in
Fix PR so it works on ghc-7.8.
ac72f9e(cdep)illabout
src/Web/HttpApiData/Internal/FormUrlEncoded.hs+7−2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DefaultSignatures #-}
2{-# LANGUAGE DefaultSignatures #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE FlexibleContexts #-}
@@ -11,6 +12,10 @@
11{-# LANGUAGE TypeOperators #-}
12{-# LANGUAGE TypeOperators #-}
12module Web.HttpApiData.Internal.FormUrlEncoded where
13module Web.HttpApiData.Internal.FormUrlEncoded where
13
14
15+#if __GLASGOW_HASKELL__ < 710
16+import Control.Applicative
17+#endif
18+
14import Control.Arrow (first, left, second)
19import Control.Arrow (first, left, second)
15import Control.Monad.State
20import Control.Monad.State
16import qualified Data.ByteString.Lazy as BSL
21import qualified Data.ByteString.Lazy as BSL
@@ -31,8 +36,8 @@ newtype Form = Form { unForm :: M.Map T.Text T.Text }
31
36
32instance IsList Form where
37instance IsList Form where
33 type Item Form = (T.Text, T.Text)
38 type Item Form = (T.Text, T.Text)
34− fromList = Form . fromList
39+ fromList = Form . M.fromList
35− toList = toList . unForm
40+ toList = M.toList . unForm
36
41
37-- | A type that can be converted to @application/x-www-form-urlencoded@
42-- | A type that can be converted to @application/x-www-form-urlencoded@
38class ToForm a where
43class ToForm a where
test/Web/HttpApiData/Internal/FormUrlEncodedSpec.hs+6−1
@@ -1,7 +1,12 @@
1+{-# LANGUAGE CPP #-}
1−{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
3module Web.HttpApiData.Internal.FormUrlEncodedSpec (spec) where
4module Web.HttpApiData.Internal.FormUrlEncodedSpec (spec) where
4
5
6+#if __GLASGOW_HASKELL__ < 710
7+import Control.Applicative
8+#endif
9+
5import Test.Hspec
10import Test.Hspec
6import qualified Data.Map as M
11import qualified Data.Map as M
7import Test.QuickCheck
12import Test.QuickCheck
test/Web/HttpApiData/Internal/TestInstances.hs+1−2
@@ -1,4 +1,3 @@
1−{-# LANGUAGE DeriveAnyClass #-}
2{-# LANGUAGE DeriveGeneric #-}
1{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
4{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
@@ -113,4 +112,4 @@ newtype NoEmptyKeyForm =
113 deriving Show
112 deriving Show
114
113
115instance Arbitrary NoEmptyKeyForm where
114instance Arbitrary NoEmptyKeyForm where
116− arbitrary = NoEmptyKeyForm . Form . M.delete "" <$> arbitrary
115+ arbitrary = NoEmptyKeyForm . Form . M.delete "" . M.fromList <$> arbitrary