@@ -196,13 +196,26 @@ let maybeResult = decode body :: Maybe (EsResult Tweet)
196let eitherResult = decode body :: Either String (EsResult Tweet)
196let eitherResult = decode body :: Either String (EsResult Tweet)
198-- print eitherResult should look like:
198-- print eitherResult should look like:
199−Right (EsResult {_index = "twitter", _type = "tweet", _id = "1", _version = 2, found = Just True, _source = Tweet {user = "bitemyapp", postDate = 2009-06-18 00:00:10 UTC, message = "Use haskell!", age = 10000, location = Location {lat = 40.12, lon = -71.34}}})
199+Right (EsResult {_index = "twitter"
204+ , _source = Tweet {user = "bitemyapp"
205+ , postDate = 2009-06-18 00:00:10 UTC
206+ , message = "Use haskell!"
208+ , location = Location {lat = 40.12, lon = -71.34}}})
201-- _source in EsResult is parametric, we dispatch the type by passing in what we expect (Tweet) as a parameter to EsResult.
210-- _source in EsResult is parametric, we dispatch the type by passing in what we expect (Tweet) as a parameter to EsResult.
203-- use the _source record accessor to get at your document
212-- use the _source record accessor to get at your document
204λ> fmap _source result
213λ> fmap _source result
214+Right (Tweet {user = "bitemyapp"
215+ , postDate = 2009-06-18 00:00:10 UTC
216+ , message = "Use haskell!"
205−Right (Tweet {user = "bitemyapp", postDate = 2009-06-18 00:00:10 UTC, message = "Use haskell!", age = 10000, location = Location {lat = 40.12, lon = -71.34}})
218+ , location = Location {lat = 40.12, lon = -71.34}})