Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created January 23, 2016 14:42
Show Gist options
  • Save codedmart/a583e6664043f44072ba to your computer and use it in GitHub Desktop.
Save codedmart/a583e6664043f44072ba to your computer and use it in GitHub Desktop.
data ConditionValues a b c = I a | T b | S c
deriving (Eq, Ord, Read, Show)
instance (ToJSON a, ToJSON b, ToJSON c) => ToJSON (ConditionValues a b c) where
toJSON (I a) = toJSON a
toJSON (T b) = toJSON b
toJSON (S b) = toJSON b
instance (FromJSON a, FromJSON b, FromJSON c) => FromJSON (ConditionValues a b c) where
-- parseJSON f = I <$> parseJSON f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment