git.iko.soy/typeable/hjsonschema
on master help sign in
Switch from wreq to http-conduit.

This allows us to drop lens as a dependency.

commitca75a7ba5a03bc03a53472b3b9d1535da4b98a7a authorIan Grant Jeffries <ian@housejeffries.com> dateWed 25 Mar 2015, 11:29 (12 years ago) parent403c2a1
3 files changed+8−14
README.md+1−1 hjsonschema.cabal+2−3 src/Data/JsonSchema/Reference.hs+5−10
README.md+1−1
@@ -29,4 +29,4 @@ Note that the tests require an internet connection.
2929
3030Thanks to [Julian Berman](https://github.com/Julian) for the fantastic test suite.
3131
32−Also thanks to Tim Baumann for his [aeson-schema](https://hackage.haskell.org/package/aeson-schema) library. Hjsonschema's test code and its implementation of Graph both come from Aeson-Schema.
32+Also thanks to Tim Baumann for his [aeson-schema](https://hackage.haskell.org/package/aeson-schema) library. Hjsonschema's test code and its implementation of `Graph` both come from Aeson-Schema.
hjsonschema.cabal+2−3
@@ -1,5 +1,5 @@
11name: hjsonschema
2−version: 0.5.0.0
2+version: 0.5.1.0
33synopsis: JSON Schema Draft 4 library
44homepage: https://github.com/seagreen/hjsonschema
55license: MIT
@@ -32,14 +32,13 @@ library
3232 , file-embed >= 0.0.8 && < 0.0.9
3333 , hashable >= 1.2 && < 1.3
3434 , hjsonpointer >= 0.1 && < 0.2
35+ , http-conduit >= 2.1.5 && < 2.2
3536 , http-types >= 0.8 && < 0.9
36− , lens >= 4.7 && < 4.9
3737 , regexpr >= 0.5 && < 0.6
3838 , scientific >= 0.3 && < 0.4
3939 , unordered-containers >= 0.2 && < 0.3
4040 , text >= 1.2 && < 1.3
4141 , vector >= 0.10 && < 0.11
42− , wreq >= 0.3 && < 0.4
4342
4443test-suite local
4544 type: exitcode-stdio-1.0
src/Data/JsonSchema/Reference.hs+5−10
@@ -1,7 +1,7 @@
11module Data.JsonSchema.Reference where
22
3+import Control.Arrow
34import Control.Exception
4−import Control.Lens
55import Control.Monad
66import Data.Aeson
77import Data.ByteString.Lazy (ByteString)
@@ -10,7 +10,7 @@ import qualified Data.HashMap.Strict as H
1010import Data.Monoid
1111import Data.Text (Text)
1212import qualified Data.Text as T
13−import Network.Wreq
13+import Network.HTTP.Conduit
1414import Prelude hiding (foldr)
1515
1616combineIdAndRef :: Text -> Text -> Text
@@ -47,18 +47,13 @@ fetchRef :: Text -> IO (Either Text (HashMap Text Value))
4747fetchRef t = do
4848 eResp <- safeGet t
4949 case eResp of
50− Left err -> return (Left err)
51− Right b ->
52− case eitherDecode b of
53− Right (Object z) -> return (Right z)
54− Right v -> return . Left $
55− "fetchRef returned the following instead of an object" <> T.pack (show v)
56− Left e -> return . Left . T.pack $ e
50+ Left e -> return $ Left e
51+ Right b -> return . left T.pack $ eitherDecode b
5752
5853safeGet :: Text -> IO (Either Text ByteString)
5954safeGet url =
6055 catch
61− (return . Right . (^. responseBody) =<< get (T.unpack url))
56+ (return . Right =<< (simpleHttp . T.unpack) url)
6257 handler
6358 where
6459 handler :: SomeException -> IO (Either Text ByteString)