I am new to Haskell, and am working on testing JSON serialization. Here is what the test case looks like:
{-# LANGUAGE OverloadedStrings #-}
module WetlandsTest where
import Control.Exception (evaluate)
import Test.Hspec
import Wetlands
main :: IO ()
main = hspec $ do
describe "wetlands" $ do
describe "spotting" $ do
it "returns a json encoded spotting" $ do
let record = spotting "Snowy Egret" "California" "low tide"
record `shouldBe` "{\"bird\":\"Snowy Eget\",\"state\":\"California\",\"meta\":\"low tide\"}"
Is there a way to write that in a more readable way? Maybe something along the lines of:
record `shouldBe` """
{"bird":"Snowy Eget","city":"California","meta":"low tide"}
"""
This isn't necessarily a multiline string, but if you prettified the JSON then it would be. Just wondering in general.
dos are unnecessary as it stands, so you could clean it up some by eliminating those as well.