OQ24A5VRN3IFOFFO2TWLF6OOP4I5V2NSUURZXUWEFLURQP4GPP5AC
2VCC6DPGXLR6KYEW5NOLKPE6TXWHY5M6B74ZRZBU6IP3LZQDGCXQC
O35UMQTSQPBNLYTXGBZOVCRNDQTCG2KDF2SJNRFJSZT5J2LJJ5OAC
B2JWXIEPCMVVITDJDR2SACY4VHITXGH7ZM6A5RWN6E7OKTO43TUAC
{-# LANGUAGE DeriveGeneric #-}{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Text as T
import qualified Data.Text as Timport Text.Casingimport Data.Aesonimport Data.Aeson.Encodingimport qualified Data.Scientific as Scientific (toBoundedInteger)import GHC.Generics
import Text.Casing
import Data.Aeson
import Data.Aeson.Encoding
import qualified Data.Scientific as Scientific (toBoundedInteger)
import GHC.Generics
instance ToJSON Volume where toJSON = Number . fromIntegral . (+1) . fromEnum toEncoding = int . (+1) . fromEnum
instance ToJSON Volume where
toJSON = Number . fromIntegral . (+1) . fromEnum
toEncoding = int . (+1) . fromEnum
instance FromJSON Volume where parseJSON (Number x) = let maybeVolume = Scientific.toBoundedInteger x >>= toVolume in case maybeVolume of Just vol -> pure vol Nothing -> fail "Volume number is out of bounds" parseJSON _ = fail "Volume must be a number"
instance FromJSON Volume where
parseJSON (Number x) =
let maybeVolume = Scientific.toBoundedInteger x >>= toVolume
in case maybeVolume of
Just vol -> pure vol
Nothing -> fail "Volume number is out of bounds"
parseJSON _ = fail "Volume must be a number"
deriving Genericinstance ToJSON Primer where toEncoding = genericToEncoding defaultOptions { fieldLabelModifier = camel . drop 6 }
deriving Generic
instance ToJSON Primer where
toEncoding = genericToEncoding defaultOptions { fieldLabelModifier = camel . drop 6 }
instance FromJSON Primer where parseJSON = genericParseJSON defaultOptions { fieldLabelModifier = camel . drop 6 }
instance FromJSON Primer where
parseJSON = genericParseJSON defaultOptions { fieldLabelModifier = camel . drop 6 }
, aeson , scientific , casing
, aeson
, scientific
, casing