    {-# LANGUAGE OverloadedStrings #-}

    module Network.Protocol.MusicBrainz.Types (
        MBID(..)
      , Release(..)
      , TextRepresentation(..)
      , Medium(..)
      , Track(..)
      , Recording(..)
      , ArtistCredit(..)
      , Artist(..)
      , ReleaseGroup(..)
      , LabelInfo(..)
      , Label(..)
      , ReleaseEvent(..)
      , Area(..)
      , ISO3166Code(..)
      , CoverArtArchive(..)
    ) where

    import Data.Text (Text)
    import Data.Time.Calendar (Day)
    import Data.Vector (Vector)

    import Control.Applicative ((<$>), (<*>))
    import Control.Monad (mzero)
    import Data.Aeson (FromJSON(..), (.:), (.:?), Value(..))
    import Data.Maybe (fromMaybe)
    import qualified Data.Text as T
    import Data.Time.Format (parseTimeM)
    import Data.Time.Locale.Compat (defaultTimeLocale)

    newtype MBID = MBID { MBID -> Text
    unMBID :: Text }
        deriving (MBID -> MBID -> Bool
    (MBID -> MBID -> Bool) -> (MBID -> MBID -> Bool) -> Eq MBID
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: MBID -> MBID -> Bool
    == :: MBID -> MBID -> Bool
    $c/= :: MBID -> MBID -> Bool
    /= :: MBID -> MBID -> Bool
    Eq, Int -> MBID -> ShowS
    [MBID] -> ShowS
    MBID -> String
    (Int -> MBID -> ShowS)
    -> (MBID -> String) -> ([MBID] -> ShowS) -> Show MBID
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MBID -> ShowS
    showsPrec :: Int -> MBID -> ShowS
    $cshow :: MBID -> String
    show :: MBID -> String
    $cshowList :: [MBID] -> ShowS
    showList :: [MBID] -> ShowS
    Show)

    data Release = Release {
        Release -> MBID
    _releaseId :: MBID
      , Release -> Text
    _releaseTitle :: Text
      , Release -> Maybe Text
    _releaseStatus :: Maybe Text
      , Release -> Maybe Text
    _releaseQuality :: Maybe Text
      , Release -> Maybe Text
    _releasePackaging :: Maybe Text
      , Release -> Maybe TextRepresentation
    _releaseTextRepresentation :: Maybe TextRepresentation
      , Release -> [ArtistCredit]
    _releaseArtistCredit :: [ArtistCredit]
      , Release -> Maybe Day
    _releaseDate :: Maybe Day
      , Release -> Maybe Text
    _releaseCountry :: Maybe Text
      , Release -> [ReleaseEvent]
    _releaseEvents :: [ReleaseEvent]
      , Release -> Maybe Text
    _releaseBarcode :: Maybe Text
      , Release -> Maybe Text
    _releaseASIN :: Maybe Text
      , Release -> Maybe CoverArtArchive
    _releaseCoverArtArchive :: Maybe CoverArtArchive
      , Release -> Vector Medium
    _releaseMedia :: Vector Medium
    } deriving (Release -> Release -> Bool
    (Release -> Release -> Bool)
    -> (Release -> Release -> Bool) -> Eq Release
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Release -> Release -> Bool
    == :: Release -> Release -> Bool
    $c/= :: Release -> Release -> Bool
    /= :: Release -> Release -> Bool
    Eq, Int -> Release -> ShowS
    [Release] -> ShowS
    Release -> String
    (Int -> Release -> ShowS)
    -> (Release -> String) -> ([Release] -> ShowS) -> Show Release
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Release -> ShowS
    showsPrec :: Int -> Release -> ShowS
    $cshow :: Release -> String
    show :: Release -> String
    $cshowList :: [Release] -> ShowS
    showList :: [Release] -> ShowS
    Show)

    instance FromJSON Release where
        parseJSON :: Value -> Parser Release
    parseJSON (Object Object
    v) = MBID
    -> Text
    -> Maybe Text
    -> Maybe Text
    -> Maybe Text
    -> Maybe TextRepresentation
    -> [ArtistCredit]
    -> Maybe Day
    -> Maybe Text
    -> [ReleaseEvent]
    -> Maybe Text
    -> Maybe Text
    -> Maybe CoverArtArchive
    -> Vector Medium
    -> Release
    Release (MBID
     -> Text
     -> Maybe Text
     -> Maybe Text
     -> Maybe Text
     -> Maybe TextRepresentation
     -> [ArtistCredit]
     -> Maybe Day
     -> Maybe Text
     -> [ReleaseEvent]
     -> Maybe Text
     -> Maybe Text
     -> Maybe CoverArtArchive
     -> Vector Medium
     -> Release)
    -> Parser MBID
    -> Parser
         (Text
          -> Maybe Text
          -> Maybe Text
          -> Maybe Text
          -> Maybe TextRepresentation
          -> [ArtistCredit]
          -> Maybe Day
          -> Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     (Text -> MBID
    MBID (Text -> MBID) -> Parser Text -> Parser MBID
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser Text
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "id") Parser
      (Text
       -> Maybe Text
       -> Maybe Text
       -> Maybe Text
       -> Maybe TextRepresentation
       -> [ArtistCredit]
       -> Maybe Day
       -> Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser Text
    -> Parser
         (Maybe Text
          -> Maybe Text
          -> Maybe Text
          -> Maybe TextRepresentation
          -> [ArtistCredit]
          -> Maybe Day
          -> Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser Text
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "title" Parser
      (Maybe Text
       -> Maybe Text
       -> Maybe Text
       -> Maybe TextRepresentation
       -> [ArtistCredit]
       -> Maybe Day
       -> Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser (Maybe Text)
    -> Parser
         (Maybe Text
          -> Maybe Text
          -> Maybe TextRepresentation
          -> [ArtistCredit]
          -> Maybe Day
          -> Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "status" Parser
      (Maybe Text
       -> Maybe Text
       -> Maybe TextRepresentation
       -> [ArtistCredit]
       -> Maybe Day
       -> Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser (Maybe Text)
    -> Parser
         (Maybe Text
          -> Maybe TextRepresentation
          -> [ArtistCredit]
          -> Maybe Day
          -> Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "quality" Parser
      (Maybe Text
       -> Maybe TextRepresentation
       -> [ArtistCredit]
       -> Maybe Day
       -> Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser (Maybe Text)
    -> Parser
         (Maybe TextRepresentation
          -> [ArtistCredit]
          -> Maybe Day
          -> Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "packaging" Parser
      (Maybe TextRepresentation
       -> [ArtistCredit]
       -> Maybe Day
       -> Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser (Maybe TextRepresentation)
    -> Parser
         ([ArtistCredit]
          -> Maybe Day
          -> Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe TextRepresentation)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "text-representation" Parser
      ([ArtistCredit]
       -> Maybe Day
       -> Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser [ArtistCredit]
    -> Parser
         (Maybe Day
          -> Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser [ArtistCredit]
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "artist-credit" Parser
      (Maybe Day
       -> Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser (Maybe Day)
    -> Parser
         (Maybe Text
          -> [ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     ((Bool -> TimeLocale -> String -> String -> Maybe Day
    forall (m :: * -> *) t.
    (MonadFail m, ParseTime t) =>
    Bool -> TimeLocale -> String -> String -> m t
    parseTimeM Bool
    True TimeLocale
    defaultTimeLocale String
    "%Y-%m-%d" (String -> Maybe Day) -> (Text -> String) -> Text -> Maybe Day
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> String
    T.unpack (Text -> Maybe Day) -> Maybe Text -> Maybe Day
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<<) (Maybe Text -> Maybe Day)
    -> Parser (Maybe Text) -> Parser (Maybe Day)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "date") Parser
      (Maybe Text
       -> [ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser (Maybe Text)
    -> Parser
         ([ReleaseEvent]
          -> Maybe Text
          -> Maybe Text
          -> Maybe CoverArtArchive
          -> Vector Medium
          -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "country" Parser
      ([ReleaseEvent]
       -> Maybe Text
       -> Maybe Text
       -> Maybe CoverArtArchive
       -> Vector Medium
       -> Release)
    -> Parser [ReleaseEvent]
    -> Parser
         (Maybe Text
          -> Maybe Text -> Maybe CoverArtArchive -> Vector Medium -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser [ReleaseEvent]
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "release-events" Parser
      (Maybe Text
       -> Maybe Text -> Maybe CoverArtArchive -> Vector Medium -> Release)
    -> Parser (Maybe Text)
    -> Parser
         (Maybe Text -> Maybe CoverArtArchive -> Vector Medium -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "barcode" Parser
      (Maybe Text -> Maybe CoverArtArchive -> Vector Medium -> Release)
    -> Parser (Maybe Text)
    -> Parser (Maybe CoverArtArchive -> Vector Medium -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "asin" Parser (Maybe CoverArtArchive -> Vector Medium -> Release)
    -> Parser (Maybe CoverArtArchive)
    -> Parser (Vector Medium -> Release)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe CoverArtArchive)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "cover-art-archive" Parser (Vector Medium -> Release)
    -> Parser (Vector Medium) -> Parser Release
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Vector Medium)
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "media"
        parseJSON Value
    _          = Parser Release
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data TextRepresentation = TextRepresentation {
        TextRepresentation -> Maybe Text
    _textRepLanguage :: Maybe Text
      , TextRepresentation -> Maybe Text
    _textRepScript :: Maybe Text
    } deriving (TextRepresentation -> TextRepresentation -> Bool
    (TextRepresentation -> TextRepresentation -> Bool)
    -> (TextRepresentation -> TextRepresentation -> Bool)
    -> Eq TextRepresentation
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: TextRepresentation -> TextRepresentation -> Bool
    == :: TextRepresentation -> TextRepresentation -> Bool
    $c/= :: TextRepresentation -> TextRepresentation -> Bool
    /= :: TextRepresentation -> TextRepresentation -> Bool
    Eq, Int -> TextRepresentation -> ShowS
    [TextRepresentation] -> ShowS
    TextRepresentation -> String
    (Int -> TextRepresentation -> ShowS)
    -> (TextRepresentation -> String)
    -> ([TextRepresentation] -> ShowS)
    -> Show TextRepresentation
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> TextRepresentation -> ShowS
    showsPrec :: Int -> TextRepresentation -> ShowS
    $cshow :: TextRepresentation -> String
    show :: TextRepresentation -> String
    $cshowList :: [TextRepresentation] -> ShowS
    showList :: [TextRepresentation] -> ShowS
    Show)

    instance FromJSON TextRepresentation where
        parseJSON :: Value -> Parser TextRepresentation
    parseJSON (Object Object
    v) = Maybe Text -> Maybe Text -> TextRepresentation
    TextRepresentation (Maybe Text -> Maybe Text -> TextRepresentation)
    -> Parser (Maybe Text) -> Parser (Maybe Text -> TextRepresentation)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "language" Parser (Maybe Text -> TextRepresentation)
    -> Parser (Maybe Text) -> Parser TextRepresentation
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "script"
        parseJSON Value
    _          = Parser TextRepresentation
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data Medium = Medium {
        Medium -> Maybe Text
    _mediumTitle :: Maybe Text
      , Medium -> Maybe Integer
    _mediumPosition :: Maybe Integer
      , Medium -> Maybe Text
    _mediumFormat :: Maybe Text
      , Medium -> Integer
    _mediumTrackCount :: Integer
      , Medium -> Maybe Integer
    _mediumTrackOffset :: Maybe Integer
      , Medium -> Maybe [Track]
    _mediumTrackList :: Maybe [Track]
    } deriving (Medium -> Medium -> Bool
    (Medium -> Medium -> Bool)
    -> (Medium -> Medium -> Bool) -> Eq Medium
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Medium -> Medium -> Bool
    == :: Medium -> Medium -> Bool
    $c/= :: Medium -> Medium -> Bool
    /= :: Medium -> Medium -> Bool
    Eq, Int -> Medium -> ShowS
    [Medium] -> ShowS
    Medium -> String
    (Int -> Medium -> ShowS)
    -> (Medium -> String) -> ([Medium] -> ShowS) -> Show Medium
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Medium -> ShowS
    showsPrec :: Int -> Medium -> ShowS
    $cshow :: Medium -> String
    show :: Medium -> String
    $cshowList :: [Medium] -> ShowS
    showList :: [Medium] -> ShowS
    Show)

    instance FromJSON Medium where
        parseJSON :: Value -> Parser Medium
    parseJSON (Object Object
    v) = Maybe Text
    -> Maybe Integer
    -> Maybe Text
    -> Integer
    -> Maybe Integer
    -> Maybe [Track]
    -> Medium
    Medium (Maybe Text
     -> Maybe Integer
     -> Maybe Text
     -> Integer
     -> Maybe Integer
     -> Maybe [Track]
     -> Medium)
    -> Parser (Maybe Text)
    -> Parser
         (Maybe Integer
          -> Maybe Text
          -> Integer
          -> Maybe Integer
          -> Maybe [Track]
          -> Medium)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "title" Parser
      (Maybe Integer
       -> Maybe Text
       -> Integer
       -> Maybe Integer
       -> Maybe [Track]
       -> Medium)
    -> Parser (Maybe Integer)
    -> Parser
         (Maybe Text -> Integer -> Maybe Integer -> Maybe [Track] -> Medium)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Integer)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "position" Parser
      (Maybe Text -> Integer -> Maybe Integer -> Maybe [Track] -> Medium)
    -> Parser (Maybe Text)
    -> Parser (Integer -> Maybe Integer -> Maybe [Track] -> Medium)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "format" Parser (Integer -> Maybe Integer -> Maybe [Track] -> Medium)
    -> Parser Integer
    -> Parser (Maybe Integer -> Maybe [Track] -> Medium)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser Integer
    forall a. FromJSON a => Object -> Key -> Parser a
    .:  Key
    "track-count" Parser (Maybe Integer -> Maybe [Track] -> Medium)
    -> Parser (Maybe Integer) -> Parser (Maybe [Track] -> Medium)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Integer)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "track-offset" Parser (Maybe [Track] -> Medium)
    -> Parser (Maybe [Track]) -> Parser Medium
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe [Track])
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "tracks"
        parseJSON Value
    _          = Parser Medium
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data Track = Track {
        Track -> MBID
    _trackId :: MBID
      , Track -> [ArtistCredit]
    _trackArtistCredit :: [ArtistCredit]
      , Track -> Maybe Integer
    _trackPosition :: Maybe Integer
      , Track -> Maybe Text
    _trackNumber :: Maybe Text
      , Track -> Maybe Integer
    _trackLength :: Maybe Integer
      , Track -> Recording
    _trackRecording :: Recording
    } deriving (Track -> Track -> Bool
    (Track -> Track -> Bool) -> (Track -> Track -> Bool) -> Eq Track
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Track -> Track -> Bool
    == :: Track -> Track -> Bool
    $c/= :: Track -> Track -> Bool
    /= :: Track -> Track -> Bool
    Eq, Int -> Track -> ShowS
    [Track] -> ShowS
    Track -> String
    (Int -> Track -> ShowS)
    -> (Track -> String) -> ([Track] -> ShowS) -> Show Track
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Track -> ShowS
    showsPrec :: Int -> Track -> ShowS
    $cshow :: Track -> String
    show :: Track -> String
    $cshowList :: [Track] -> ShowS
    showList :: [Track] -> ShowS
    Show)

    instance FromJSON Track where
        parseJSON :: Value -> Parser Track
    parseJSON (Object Object
    v) = MBID
    -> [ArtistCredit]
    -> Maybe Integer
    -> Maybe Text
    -> Maybe Integer
    -> Recording
    -> Track
    Track (MBID
     -> [ArtistCredit]
     -> Maybe Integer
     -> Maybe Text
     -> Maybe Integer
     -> Recording
     -> Track)
    -> Parser MBID
    -> Parser
         ([ArtistCredit]
          -> Maybe Integer
          -> Maybe Text
          -> Maybe Integer
          -> Recording
          -> Track)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     (Text -> MBID
    MBID (Text -> MBID) -> Parser Text -> Parser MBID
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser Text
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "id") Parser
      ([ArtistCredit]
       -> Maybe Integer
       -> Maybe Text
       -> Maybe Integer
       -> Recording
       -> Track)
    -> Parser [ArtistCredit]
    -> Parser
         (Maybe Integer
          -> Maybe Text -> Maybe Integer -> Recording -> Track)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser [ArtistCredit]
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "artist-credit" Parser
      (Maybe Integer
       -> Maybe Text -> Maybe Integer -> Recording -> Track)
    -> Parser (Maybe Integer)
    -> Parser (Maybe Text -> Maybe Integer -> Recording -> Track)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Integer)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "position" Parser (Maybe Text -> Maybe Integer -> Recording -> Track)
    -> Parser (Maybe Text)
    -> Parser (Maybe Integer -> Recording -> Track)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "number" Parser (Maybe Integer -> Recording -> Track)
    -> Parser (Maybe Integer) -> Parser (Recording -> Track)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Integer)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "length" Parser (Recording -> Track) -> Parser Recording -> Parser Track
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser Recording
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "recording"
        parseJSON Value
    _          = Parser Track
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data Recording = Recording {
        Recording -> MBID
    _recordingId :: MBID
      , Recording -> Maybe Text
    _recordingTitle :: Maybe Text
      , Recording -> Maybe Integer
    _recordingLength :: Maybe Integer
      , Recording -> [ArtistCredit]
    _recordingArtistCredit :: [ArtistCredit]
    } deriving (Recording -> Recording -> Bool
    (Recording -> Recording -> Bool)
    -> (Recording -> Recording -> Bool) -> Eq Recording
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Recording -> Recording -> Bool
    == :: Recording -> Recording -> Bool
    $c/= :: Recording -> Recording -> Bool
    /= :: Recording -> Recording -> Bool
    Eq, Int -> Recording -> ShowS
    [Recording] -> ShowS
    Recording -> String
    (Int -> Recording -> ShowS)
    -> (Recording -> String)
    -> ([Recording] -> ShowS)
    -> Show Recording
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Recording -> ShowS
    showsPrec :: Int -> Recording -> ShowS
    $cshow :: Recording -> String
    show :: Recording -> String
    $cshowList :: [Recording] -> ShowS
    showList :: [Recording] -> ShowS
    Show)

    instance FromJSON Recording where
        parseJSON :: Value -> Parser Recording
    parseJSON (Object Object
    v) = MBID -> Maybe Text -> Maybe Integer -> [ArtistCredit] -> Recording
    Recording (MBID
     -> Maybe Text -> Maybe Integer -> [ArtistCredit] -> Recording)
    -> Parser MBID
    -> Parser
         (Maybe Text -> Maybe Integer -> [ArtistCredit] -> Recording)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     (Text -> MBID
    MBID (Text -> MBID) -> Parser Text -> Parser MBID
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser Text
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "id") Parser (Maybe Text -> Maybe Integer -> [ArtistCredit] -> Recording)
    -> Parser (Maybe Text)
    -> Parser (Maybe Integer -> [ArtistCredit] -> Recording)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "title" Parser (Maybe Integer -> [ArtistCredit] -> Recording)
    -> Parser (Maybe Integer) -> Parser ([ArtistCredit] -> Recording)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Integer)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "length" Parser ([ArtistCredit] -> Recording)
    -> Parser [ArtistCredit] -> Parser Recording
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser [ArtistCredit]
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "artist-credit"
        parseJSON Value
    _          = Parser Recording
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data ArtistCredit = ArtistCredit {
        ArtistCredit -> Artist
    _artistCreditArtist :: Artist
      , ArtistCredit -> Maybe Text
    _artistCreditJoinPhrase :: Maybe Text
      , ArtistCredit -> Maybe Text
    _artistCreditName :: Maybe Text
    } deriving (ArtistCredit -> ArtistCredit -> Bool
    (ArtistCredit -> ArtistCredit -> Bool)
    -> (ArtistCredit -> ArtistCredit -> Bool) -> Eq ArtistCredit
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ArtistCredit -> ArtistCredit -> Bool
    == :: ArtistCredit -> ArtistCredit -> Bool
    $c/= :: ArtistCredit -> ArtistCredit -> Bool
    /= :: ArtistCredit -> ArtistCredit -> Bool
    Eq, Int -> ArtistCredit -> ShowS
    [ArtistCredit] -> ShowS
    ArtistCredit -> String
    (Int -> ArtistCredit -> ShowS)
    -> (ArtistCredit -> String)
    -> ([ArtistCredit] -> ShowS)
    -> Show ArtistCredit
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ArtistCredit -> ShowS
    showsPrec :: Int -> ArtistCredit -> ShowS
    $cshow :: ArtistCredit -> String
    show :: ArtistCredit -> String
    $cshowList :: [ArtistCredit] -> ShowS
    showList :: [ArtistCredit] -> ShowS
    Show)

    instance FromJSON ArtistCredit where
        parseJSON :: Value -> Parser ArtistCredit
    parseJSON (Object Object
    v) = Artist -> Maybe Text -> Maybe Text -> ArtistCredit
    ArtistCredit (Artist -> Maybe Text -> Maybe Text -> ArtistCredit)
    -> Parser Artist
    -> Parser (Maybe Text -> Maybe Text -> ArtistCredit)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     Object
    v Object -> Key -> Parser Artist
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "artist" Parser (Maybe Text -> Maybe Text -> ArtistCredit)
    -> Parser (Maybe Text) -> Parser (Maybe Text -> ArtistCredit)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "joinphrase" Parser (Maybe Text -> ArtistCredit)
    -> Parser (Maybe Text) -> Parser ArtistCredit
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "name"
        parseJSON Value
    _          = Parser ArtistCredit
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data Artist = Artist {
        Artist -> MBID
    _artistId :: MBID
      , Artist -> Maybe Text
    _artistName :: Maybe Text
      , Artist -> Maybe Text
    _artistSortName :: Maybe Text
      , Artist -> Maybe Text
    _artistDisambiguation :: Maybe Text
    } deriving (Artist -> Artist -> Bool
    (Artist -> Artist -> Bool)
    -> (Artist -> Artist -> Bool) -> Eq Artist
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Artist -> Artist -> Bool
    == :: Artist -> Artist -> Bool
    $c/= :: Artist -> Artist -> Bool
    /= :: Artist -> Artist -> Bool
    Eq, Int -> Artist -> ShowS
    [Artist] -> ShowS
    Artist -> String
    (Int -> Artist -> ShowS)
    -> (Artist -> String) -> ([Artist] -> ShowS) -> Show Artist
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Artist -> ShowS
    showsPrec :: Int -> Artist -> ShowS
    $cshow :: Artist -> String
    show :: Artist -> String
    $cshowList :: [Artist] -> ShowS
    showList :: [Artist] -> ShowS
    Show)

    instance FromJSON Artist where
        parseJSON :: Value -> Parser Artist
    parseJSON (Object Object
    v) = MBID -> Maybe Text -> Maybe Text -> Maybe Text -> Artist
    Artist (MBID -> Maybe Text -> Maybe Text -> Maybe Text -> Artist)
    -> Parser MBID
    -> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Artist)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     (Text -> MBID
    MBID (Text -> MBID) -> Parser Text -> Parser MBID
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser Text
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "id") Parser (Maybe Text -> Maybe Text -> Maybe Text -> Artist)
    -> Parser (Maybe Text)
    -> Parser (Maybe Text -> Maybe Text -> Artist)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "name" Parser (Maybe Text -> Maybe Text -> Artist)
    -> Parser (Maybe Text) -> Parser (Maybe Text -> Artist)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "sort-name" Parser (Maybe Text -> Artist)
    -> Parser (Maybe Text) -> Parser Artist
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "disambiguation"
        parseJSON Value
    _          = Parser Artist
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data ReleaseGroup = ReleaseGroup {
        ReleaseGroup -> MBID
    _releaseGroupId :: MBID
      , ReleaseGroup -> Text
    _releaseGroupType :: Text
      , ReleaseGroup -> Maybe Text
    _releaseGroupTitle :: Maybe Text
      , ReleaseGroup -> Maybe Text
    _releaseGroupFirstReleaseDate :: Maybe Text
      , ReleaseGroup -> Maybe Text
    _releaseGroupPrimaryType :: Maybe Text
      , ReleaseGroup -> [ArtistCredit]
    _releaseGroupArtistCredit :: [ArtistCredit]
    } deriving (ReleaseGroup -> ReleaseGroup -> Bool
    (ReleaseGroup -> ReleaseGroup -> Bool)
    -> (ReleaseGroup -> ReleaseGroup -> Bool) -> Eq ReleaseGroup
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ReleaseGroup -> ReleaseGroup -> Bool
    == :: ReleaseGroup -> ReleaseGroup -> Bool
    $c/= :: ReleaseGroup -> ReleaseGroup -> Bool
    /= :: ReleaseGroup -> ReleaseGroup -> Bool
    Eq, Int -> ReleaseGroup -> ShowS
    [ReleaseGroup] -> ShowS
    ReleaseGroup -> String
    (Int -> ReleaseGroup -> ShowS)
    -> (ReleaseGroup -> String)
    -> ([ReleaseGroup] -> ShowS)
    -> Show ReleaseGroup
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ReleaseGroup -> ShowS
    showsPrec :: Int -> ReleaseGroup -> ShowS
    $cshow :: ReleaseGroup -> String
    show :: ReleaseGroup -> String
    $cshowList :: [ReleaseGroup] -> ShowS
    showList :: [ReleaseGroup] -> ShowS
    Show)

    data LabelInfo = LabelInfo {
        LabelInfo -> Maybe Text
    _labelInfoCatalogNumber :: Maybe Text
      , LabelInfo -> Label
    _labelInfoLabel :: Label
    } deriving (LabelInfo -> LabelInfo -> Bool
    (LabelInfo -> LabelInfo -> Bool)
    -> (LabelInfo -> LabelInfo -> Bool) -> Eq LabelInfo
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: LabelInfo -> LabelInfo -> Bool
    == :: LabelInfo -> LabelInfo -> Bool
    $c/= :: LabelInfo -> LabelInfo -> Bool
    /= :: LabelInfo -> LabelInfo -> Bool
    Eq, Int -> LabelInfo -> ShowS
    [LabelInfo] -> ShowS
    LabelInfo -> String
    (Int -> LabelInfo -> ShowS)
    -> (LabelInfo -> String)
    -> ([LabelInfo] -> ShowS)
    -> Show LabelInfo
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> LabelInfo -> ShowS
    showsPrec :: Int -> LabelInfo -> ShowS
    $cshow :: LabelInfo -> String
    show :: LabelInfo -> String
    $cshowList :: [LabelInfo] -> ShowS
    showList :: [LabelInfo] -> ShowS
    Show)

    data Label = Label {
        Label -> MBID
    _labelId :: MBID
      , Label -> Maybe Text
    _labelName :: Maybe Text
      , Label -> Maybe Text
    _labelSortName :: Maybe Text
      , Label -> Maybe Text
    _labelLabelCode :: Maybe Text
    } deriving (Label -> Label -> Bool
    (Label -> Label -> Bool) -> (Label -> Label -> Bool) -> Eq Label
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Label -> Label -> Bool
    == :: Label -> Label -> Bool
    $c/= :: Label -> Label -> Bool
    /= :: Label -> Label -> Bool
    Eq, Int -> Label -> ShowS
    [Label] -> ShowS
    Label -> String
    (Int -> Label -> ShowS)
    -> (Label -> String) -> ([Label] -> ShowS) -> Show Label
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Label -> ShowS
    showsPrec :: Int -> Label -> ShowS
    $cshow :: Label -> String
    show :: Label -> String
    $cshowList :: [Label] -> ShowS
    showList :: [Label] -> ShowS
    Show)

    data ReleaseEvent = ReleaseEvent {
        ReleaseEvent -> Maybe Day
    _releaseEventDate :: Maybe Day
      , ReleaseEvent -> Maybe Area
    _releaseEventArea :: Maybe Area
    } deriving (ReleaseEvent -> ReleaseEvent -> Bool
    (ReleaseEvent -> ReleaseEvent -> Bool)
    -> (ReleaseEvent -> ReleaseEvent -> Bool) -> Eq ReleaseEvent
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ReleaseEvent -> ReleaseEvent -> Bool
    == :: ReleaseEvent -> ReleaseEvent -> Bool
    $c/= :: ReleaseEvent -> ReleaseEvent -> Bool
    /= :: ReleaseEvent -> ReleaseEvent -> Bool
    Eq, Int -> ReleaseEvent -> ShowS
    [ReleaseEvent] -> ShowS
    ReleaseEvent -> String
    (Int -> ReleaseEvent -> ShowS)
    -> (ReleaseEvent -> String)
    -> ([ReleaseEvent] -> ShowS)
    -> Show ReleaseEvent
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ReleaseEvent -> ShowS
    showsPrec :: Int -> ReleaseEvent -> ShowS
    $cshow :: ReleaseEvent -> String
    show :: ReleaseEvent -> String
    $cshowList :: [ReleaseEvent] -> ShowS
    showList :: [ReleaseEvent] -> ShowS
    Show)

    instance FromJSON ReleaseEvent where
        parseJSON :: Value -> Parser ReleaseEvent
    parseJSON (Object Object
    v) = Maybe Day -> Maybe Area -> ReleaseEvent
    ReleaseEvent (Maybe Day -> Maybe Area -> ReleaseEvent)
    -> Parser (Maybe Day) -> Parser (Maybe Area -> ReleaseEvent)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     ((Bool -> TimeLocale -> String -> String -> Maybe Day
    forall (m :: * -> *) t.
    (MonadFail m, ParseTime t) =>
    Bool -> TimeLocale -> String -> String -> m t
    parseTimeM Bool
    True TimeLocale
    defaultTimeLocale String
    "%Y-%m-%d" (String -> Maybe Day) -> (Text -> String) -> Text -> Maybe Day
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> String
    T.unpack (Text -> Maybe Day) -> Maybe Text -> Maybe Day
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<<) (Maybe Text -> Maybe Day)
    -> Parser (Maybe Text) -> Parser (Maybe Day)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "date") Parser (Maybe Area -> ReleaseEvent)
    -> Parser (Maybe Area) -> Parser ReleaseEvent
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Area)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "area"
        parseJSON Value
    _          = Parser ReleaseEvent
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data Area = Area {
        Area -> MBID
    _areaId :: MBID
      , Area -> Maybe Text
    _areaName :: Maybe Text
      , Area -> Maybe Text
    _areaSortName :: Maybe Text
      , Area -> [ISO3166Code]
    _areaISO3166_1Codes :: [ISO3166Code]
      , Area -> [ISO3166Code]
    _areaISO3166_2Codes :: [ISO3166Code]
      , Area -> [ISO3166Code]
    _areaISO3166_3Codes :: [ISO3166Code]
    } deriving (Area -> Area -> Bool
    (Area -> Area -> Bool) -> (Area -> Area -> Bool) -> Eq Area
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Area -> Area -> Bool
    == :: Area -> Area -> Bool
    $c/= :: Area -> Area -> Bool
    /= :: Area -> Area -> Bool
    Eq, Int -> Area -> ShowS
    [Area] -> ShowS
    Area -> String
    (Int -> Area -> ShowS)
    -> (Area -> String) -> ([Area] -> ShowS) -> Show Area
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Area -> ShowS
    showsPrec :: Int -> Area -> ShowS
    $cshow :: Area -> String
    show :: Area -> String
    $cshowList :: [Area] -> ShowS
    showList :: [Area] -> ShowS
    Show)

    instance FromJSON Area where
        parseJSON :: Value -> Parser Area
    parseJSON (Object Object
    v) = MBID
    -> Maybe Text
    -> Maybe Text
    -> [ISO3166Code]
    -> [ISO3166Code]
    -> [ISO3166Code]
    -> Area
    Area (MBID
     -> Maybe Text
     -> Maybe Text
     -> [ISO3166Code]
     -> [ISO3166Code]
     -> [ISO3166Code]
     -> Area)
    -> Parser MBID
    -> Parser
         (Maybe Text
          -> Maybe Text
          -> [ISO3166Code]
          -> [ISO3166Code]
          -> [ISO3166Code]
          -> Area)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     (Text -> MBID
    MBID (Text -> MBID) -> Parser Text -> Parser MBID
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser Text
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "id") Parser
      (Maybe Text
       -> Maybe Text
       -> [ISO3166Code]
       -> [ISO3166Code]
       -> [ISO3166Code]
       -> Area)
    -> Parser (Maybe Text)
    -> Parser
         (Maybe Text
          -> [ISO3166Code] -> [ISO3166Code] -> [ISO3166Code] -> Area)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "name" Parser
      (Maybe Text
       -> [ISO3166Code] -> [ISO3166Code] -> [ISO3166Code] -> Area)
    -> Parser (Maybe Text)
    -> Parser ([ISO3166Code] -> [ISO3166Code] -> [ISO3166Code] -> Area)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Text)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "sort-name" Parser ([ISO3166Code] -> [ISO3166Code] -> [ISO3166Code] -> Area)
    -> Parser [ISO3166Code]
    -> Parser ([ISO3166Code] -> [ISO3166Code] -> Area)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     ([ISO3166Code] -> Maybe [ISO3166Code] -> [ISO3166Code]
    forall a. a -> Maybe a -> a
    fromMaybe [] (Maybe [ISO3166Code] -> [ISO3166Code])
    -> Parser (Maybe [ISO3166Code]) -> Parser [ISO3166Code]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser (Maybe [ISO3166Code])
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "iso_3166_1_codes") Parser ([ISO3166Code] -> [ISO3166Code] -> Area)
    -> Parser [ISO3166Code] -> Parser ([ISO3166Code] -> Area)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     ([ISO3166Code] -> Maybe [ISO3166Code] -> [ISO3166Code]
    forall a. a -> Maybe a -> a
    fromMaybe [] (Maybe [ISO3166Code] -> [ISO3166Code])
    -> Parser (Maybe [ISO3166Code]) -> Parser [ISO3166Code]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser (Maybe [ISO3166Code])
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "iso_3166_2_codes") Parser ([ISO3166Code] -> Area)
    -> Parser [ISO3166Code] -> Parser Area
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     ([ISO3166Code] -> Maybe [ISO3166Code] -> [ISO3166Code]
    forall a. a -> Maybe a -> a
    fromMaybe [] (Maybe [ISO3166Code] -> [ISO3166Code])
    -> Parser (Maybe [ISO3166Code]) -> Parser [ISO3166Code]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    v Object -> Key -> Parser (Maybe [ISO3166Code])
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "iso_3166_3_codes")
        parseJSON Value
    _          = Parser Area
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    data CoverArtArchive = CoverArtArchive {
        CoverArtArchive -> Maybe Bool
    _coverArtArchiveArtwork :: Maybe Bool
      , CoverArtArchive -> Maybe Integer
    _coverArtArchiveCount :: Maybe Integer
      , CoverArtArchive -> Maybe Bool
    _coverArtArchiveFront :: Maybe Bool
      , CoverArtArchive -> Maybe Bool
    _coverArtArchiveBack :: Maybe Bool
    } deriving (CoverArtArchive -> CoverArtArchive -> Bool
    (CoverArtArchive -> CoverArtArchive -> Bool)
    -> (CoverArtArchive -> CoverArtArchive -> Bool)
    -> Eq CoverArtArchive
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: CoverArtArchive -> CoverArtArchive -> Bool
    == :: CoverArtArchive -> CoverArtArchive -> Bool
    $c/= :: CoverArtArchive -> CoverArtArchive -> Bool
    /= :: CoverArtArchive -> CoverArtArchive -> Bool
    Eq, Int -> CoverArtArchive -> ShowS
    [CoverArtArchive] -> ShowS
    CoverArtArchive -> String
    (Int -> CoverArtArchive -> ShowS)
    -> (CoverArtArchive -> String)
    -> ([CoverArtArchive] -> ShowS)
    -> Show CoverArtArchive
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CoverArtArchive -> ShowS
    showsPrec :: Int -> CoverArtArchive -> ShowS
    $cshow :: CoverArtArchive -> String
    show :: CoverArtArchive -> String
    $cshowList :: [CoverArtArchive] -> ShowS
    showList :: [CoverArtArchive] -> ShowS
    Show)

    instance FromJSON CoverArtArchive where
        parseJSON :: Value -> Parser CoverArtArchive
    parseJSON (Object Object
    v) = Maybe Bool
    -> Maybe Integer -> Maybe Bool -> Maybe Bool -> CoverArtArchive
    CoverArtArchive (Maybe Bool
     -> Maybe Integer -> Maybe Bool -> Maybe Bool -> CoverArtArchive)
    -> Parser (Maybe Bool)
    -> Parser
         (Maybe Integer -> Maybe Bool -> Maybe Bool -> CoverArtArchive)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>
                                     Object
    v Object -> Key -> Parser (Maybe Bool)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "artwork" Parser
      (Maybe Integer -> Maybe Bool -> Maybe Bool -> CoverArtArchive)
    -> Parser (Maybe Integer)
    -> Parser (Maybe Bool -> Maybe Bool -> CoverArtArchive)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Integer)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "count" Parser (Maybe Bool -> Maybe Bool -> CoverArtArchive)
    -> Parser (Maybe Bool) -> Parser (Maybe Bool -> CoverArtArchive)
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Bool)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "front" Parser (Maybe Bool -> CoverArtArchive)
    -> Parser (Maybe Bool) -> Parser CoverArtArchive
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                     Object
    v Object -> Key -> Parser (Maybe Bool)
    forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
    .:? Key
    "back"
        parseJSON Value
    _          = Parser CoverArtArchive
    forall a. Parser a
    forall (m :: * -> *) a. MonadPlus m => m a
    mzero

    newtype ISO3166Code = ISO3166Code { ISO3166Code -> Text
    unISO3166Code :: Text }
        deriving (ISO3166Code -> ISO3166Code -> Bool
    (ISO3166Code -> ISO3166Code -> Bool)
    -> (ISO3166Code -> ISO3166Code -> Bool) -> Eq ISO3166Code
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ISO3166Code -> ISO3166Code -> Bool
    == :: ISO3166Code -> ISO3166Code -> Bool
    $c/= :: ISO3166Code -> ISO3166Code -> Bool
    /= :: ISO3166Code -> ISO3166Code -> Bool
    Eq, Int -> ISO3166Code -> ShowS
    [ISO3166Code] -> ShowS
    ISO3166Code -> String
    (Int -> ISO3166Code -> ShowS)
    -> (ISO3166Code -> String)
    -> ([ISO3166Code] -> ShowS)
    -> Show ISO3166Code
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ISO3166Code -> ShowS
    showsPrec :: Int -> ISO3166Code -> ShowS
    $cshow :: ISO3166Code -> String
    show :: ISO3166Code -> String
    $cshowList :: [ISO3166Code] -> ShowS
    showList :: [ISO3166Code] -> ShowS
    Show)

    instance FromJSON ISO3166Code where
        parseJSON :: Value -> Parser ISO3166Code
    parseJSON Value
    t = Text -> ISO3166Code
    ISO3166Code (Text -> ISO3166Code) -> Parser Text -> Parser ISO3166Code
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Value -> Parser Text
    forall a. FromJSON a => Value -> Parser a
    parseJSON Value
    t