-- | Aeson instances for definitions used later in processing (e.g. analyses).

{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE UndecidableInstances #-} -- required due to instance design

module Language.Fortran.Extras.JSON.Analysis() where

import Language.Fortran.Extras.JSON.Helpers
import Data.Aeson
import Language.Fortran.Common.Array

instance ToJSON a => ToJSON (Dim a) where
    toJSON :: Dim a -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
gtj forall a b. (a -> b) -> a -> b
$ String -> Options
jcProdDrop String
"dim"

instance (ToJSON a, ToJSON (t a), ToJSON (t (Dim a))) => ToJSON (Dims t a) where
    toJSON :: Dims t a -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
gtj forall a b. (a -> b) -> a -> b
$ String -> Options
jcSumDrop String
"Dims"