Skip to content

Commit

Permalink
Merge pull request haskell#91 from clinty/aeson-pretty-portability
Browse files Browse the repository at this point in the history
Use defConfig with record fields to handle aeson-pretty's API change
  • Loading branch information
bos authored Jan 9, 2017
2 parents d85273e + 6a2ef6a commit aacb2fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions httpbin/HttpBin/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module HttpBin.Server (serve) where
import Control.Applicative ((<$>))
import Control.Monad.IO.Class (liftIO)
import Data.Aeson (Value(..), eitherDecode, object, toJSON)
import Data.Aeson.Encode.Pretty (Config(..), encodePretty')
import Data.Aeson.Encode.Pretty (Config(..), Indent(Spaces), defConfig, encodePretty')
import Data.ByteString.Char8 (pack)
import Data.CaseInsensitive (original)
import Data.Maybe (catMaybes, fromMaybe)
Expand Down Expand Up @@ -133,7 +133,7 @@ rqIntParam name req =

writeJSON obj = do
modifyResponse $ setContentType "application/json"
writeLBS . (<> "\n") . encodePretty' (Config 2 compare) . object $ obj
writeLBS . (<> "\n") . encodePretty' defConfig { confIndent = Spaces 2, confCompare = compare } . object $ obj

respond act = do
req <- getRequest
Expand Down
4 changes: 2 additions & 2 deletions wreq.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ executable httpbin
else
build-depends:
aeson >= 0.7,
aeson-pretty >= 0.7.1,
aeson-pretty >= 0.8.0,
base >= 4.5 && < 5,
base64-bytestring,
bytestring,
Expand Down Expand Up @@ -179,7 +179,7 @@ test-suite tests
HUnit,
QuickCheck >= 2.7,
aeson,
aeson-pretty >= 0.7.1,
aeson-pretty >= 0.8.0,
base >= 4.5 && < 5,
base64-bytestring,
bytestring,
Expand Down

0 comments on commit aacb2fa

Please sign in to comment.