git.iko.soy/typeable/http-api-data
on master help sign in
Fix PR so it works on ghc-7.8.
commitac72f9ec3370c6e22bcb4e5cc49f7429a216b196 author(cdep)illabout <cdep.illabout@gmail.com> dateWed 24 Aug 2016, 23:59 (10 years ago) parent0e7f261
3 files changed+14−5
src/Web/HttpApiData/Internal/FormUrlEncoded.hs+7−2 test/Web/HttpApiData/Internal/FormUrlEncodedSpec.hs+6−1 test/Web/HttpApiData/Internal/TestInstances.hs+1−2
src/Web/HttpApiData/Internal/FormUrlEncoded.hs+7−2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DefaultSignatures #-}
23{-# LANGUAGE DeriveGeneric #-}
34{-# LANGUAGE FlexibleContexts #-}
@@ -11,6 +12,10 @@
1112{-# LANGUAGE TypeOperators #-}
1213module Web.HttpApiData.Internal.FormUrlEncoded where
1314
15+#if __GLASGOW_HASKELL__ < 710
16+import Control.Applicative
17+#endif
18+
1419import Control.Arrow (first, left, second)
1520import Control.Monad.State
1621import qualified Data.ByteString.Lazy as BSL
@@ -31,8 +36,8 @@ newtype Form = Form { unForm :: M.Map T.Text T.Text }
3136
3237instance IsList Form where
3338 type Item Form = (T.Text, T.Text)
34− fromList = Form . fromList
35− toList = toList . unForm
39+ fromList = Form . M.fromList
40+ toList = M.toList . unForm
3641
3742-- | A type that can be converted to @application/x-www-form-urlencoded@
3843class ToForm a where
test/Web/HttpApiData/Internal/FormUrlEncodedSpec.hs+6−1
@@ -1,7 +1,12 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE OverloadedStrings #-}
23{-# LANGUAGE ScopedTypeVariables #-}
34module Web.HttpApiData.Internal.FormUrlEncodedSpec (spec) where
45
6+#if __GLASGOW_HASKELL__ < 710
7+import Control.Applicative
8+#endif
9+
510import Test.Hspec
611import qualified Data.Map as M
712import Test.QuickCheck
test/Web/HttpApiData/Internal/TestInstances.hs+1−2
@@ -1,4 +1,3 @@
1−{-# LANGUAGE DeriveAnyClass #-}
21{-# LANGUAGE DeriveGeneric #-}
32{-# LANGUAGE OverloadedStrings #-}
43{-# LANGUAGE ScopedTypeVariables #-}
@@ -113,4 +112,4 @@ newtype NoEmptyKeyForm =
113112 deriving Show
114113
115114instance Arbitrary NoEmptyKeyForm where
116− arbitrary = NoEmptyKeyForm . Form . M.delete "" <$> arbitrary
115+ arbitrary = NoEmptyKeyForm . Form . M.delete "" . M.fromList <$> arbitrary