git.iko.soy/typeable/bloodhound
on master help sign in
warnings clean up
commitc518b8ed7f158145664dc51797f1305dad46dd03 authorChris Allen <cma@bitemyapp.com> dateMon 19 Oct 2015, 11:17 (11 years ago) parenta971422
1 file changed+9−6
tests/tests.hs+9−6
tests/tests.hs+9−6
@@ -14,7 +14,6 @@ import Data.List (nub)
1414import Data.List.NonEmpty (NonEmpty (..))
1515import qualified Data.List.NonEmpty as NE
1616import qualified Data.Map.Strict as M
17−import qualified Data.Maybe as MY
1817import Data.Monoid
1918import Data.Text (Text)
2019import qualified Data.Text as T
@@ -112,10 +111,14 @@ data Tweet = Tweet { user :: Text
112111 , location :: Location }
113112 deriving (Eq, Generic, Show)
114113
115−instance ToJSON Tweet
116−instance FromJSON Tweet
117−instance ToJSON Location
118−instance FromJSON Location
114+instance ToJSON Tweet where
115+ toJSON = genericToJSON defaultOptions
116+instance FromJSON Tweet where
117+ parseJSON = genericParseJSON defaultOptions
118+instance ToJSON Location where
119+ toJSON = genericToJSON defaultOptions
120+instance FromJSON Location where
121+ parseJSON = genericParseJSON defaultOptions
119122
120123data ParentMapping = ParentMapping deriving (Eq, Show)
121124
@@ -315,7 +318,7 @@ instance Arbitrary a => Arbitrary (SearchHits a) where
315318getSource :: EsResult a -> Maybe a
316319getSource = fmap _source . foundResult
317320
318−-- grabFirst :: Either String (SearchResult a) -> Either String a
321+grabFirst :: Either String (SearchResult a) -> Either String a
319322grabFirst r =
320323 case fmap (hitSource . head . hits . searchHits) r of
321324 (Left e) -> Left e