I'm new to Haskell, and I'm working on testing JSON serialization. Here's 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 this in a more readable way? Maybe something like:
record `shouldBe` """ {"bird":"Snowy Eget","city":"California","meta":"low tide"} """
This is not necessarily a multi-line string, but if you finished JSON, then it will. Just interesting at all.
source share