Skip to content

Commit

Permalink
Merge pull request #226 from mbj/add/instances
Browse files Browse the repository at this point in the history
Add Eq and Show instances
  • Loading branch information
mbj committed Dec 29, 2023
2 parents dced2af + b3e9ac3 commit d1b6388
Show file tree
Hide file tree
Showing 11,608 changed files with 16,940 additions and 35 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions gen/Stratosphere/Tag.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Stratosphere.ResourceProperties
import Stratosphere.Value
data Tag
= Tag {key :: (Value Prelude.Text), value :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkTag :: Value Prelude.Text -> Value Prelude.Text -> Tag
mkTag key value = Tag {key = key, value = value}
instance ToResourceProperties Tag where
Expand Down
2 changes: 2 additions & 0 deletions gen/Stratosphere/Tag.hs-boot
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data Tag :: Prelude.Type
instance ToResourceProperties Tag
instance Prelude.Eq Tag
instance Prelude.Show Tag
instance JSON.ToJSON Tag
21 changes: 16 additions & 5 deletions generator/src/Stratosphere/Generator/Declaration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ genRecord Record{..} = runGen $ do
recordName
[]
[GHC.recordCon recordName fields]
[]
[GHC.derivingStock [GHC.var "Prelude.Eq", GHC.var "Prelude.Show"]]
where
genField :: Raw.PropertyName -> Raw.Property -> Generator (GHC.OccNameStr, GHC.Field)
genField propertyName Raw.Property{..} =
Expand Down Expand Up @@ -309,11 +309,15 @@ genRecordBoot :: Record -> ([GHC.HsDecl'], State)
genRecordBoot Record{..} = runGen $ do
recordDeclaration <- genRecordDeclaration
resourcePropertiesInstance <- genResourcePropertiesInstance
eqInstance <- genEqInstance
showInstance <- genShowInstance
toJSONInstance <- genToJSONInstance

pure $
[ recordDeclaration
, resourcePropertiesInstance
, eqInstance
, showInstance
, toJSONInstance
]
where
Expand Down Expand Up @@ -346,12 +350,19 @@ genRecordBoot Record{..} = runGen $ do
genResourcePropertiesInstance :: Generator GHC.HsDecl'
genResourcePropertiesInstance
= addImport ResourceProperties
$ GHC.instance' (GHC.var "ToResourceProperties" @@ (GHC.var recordName)) []
$ mkRecordInstance (GHC.var "ToResourceProperties")

genToJSONInstance :: Generator GHC.HsDecl'
genToJSONInstance
= addImport JSON
$ GHC.instance' (GHC.var "JSON.ToJSON" @@ (GHC.var recordName)) []
genToJSONInstance = addImport JSON $ mkRecordInstance (GHC.var "JSON.ToJSON")

genEqInstance :: Generator GHC.HsDecl'
genEqInstance = addImport Prelude $ mkRecordInstance (GHC.var "Prelude.Eq")

genShowInstance :: Generator GHC.HsDecl'
genShowInstance = addImport Prelude $ mkRecordInstance (GHC.var "Prelude.Show")

mkRecordInstance :: GHC.HsType' -> GHC.HsDecl'
mkRecordInstance hsType = GHC.instance' (hsType @@ (GHC.var recordName)) []

recordName :: IsString a => a
recordName = fromString $ Text.unpack name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ data Analyzer
archiveRules :: (Prelude.Maybe [ArchiveRuleProperty]),
tags :: (Prelude.Maybe [Tag]),
type' :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkAnalyzer :: Value Prelude.Text -> Analyzer
mkAnalyzer type'
= Analyzer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Stratosphere.Value
data ArchiveRuleProperty
= ArchiveRuleProperty {filter :: [FilterProperty],
ruleName :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkArchiveRuleProperty ::
[FilterProperty] -> Value Prelude.Text -> ArchiveRuleProperty
mkArchiveRuleProperty filter ruleName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data ArchiveRuleProperty :: Prelude.Type
instance ToResourceProperties ArchiveRuleProperty
instance Prelude.Eq ArchiveRuleProperty
instance Prelude.Show ArchiveRuleProperty
instance JSON.ToJSON ArchiveRuleProperty
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data FilterProperty
exists :: (Prelude.Maybe (Value Prelude.Bool)),
neq :: (Prelude.Maybe (ValueList Prelude.Text)),
property :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkFilterProperty :: Value Prelude.Text -> FilterProperty
mkFilterProperty property
= FilterProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data FilterProperty :: Prelude.Type
instance ToResourceProperties FilterProperty
instance Prelude.Eq FilterProperty
instance Prelude.Show FilterProperty
instance JSON.ToJSON FilterProperty
1 change: 1 addition & 0 deletions services/acmpca/gen/Stratosphere/ACMPCA/Certificate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data Certificate
templateArn :: (Prelude.Maybe (Value Prelude.Text)),
validity :: ValidityProperty,
validityNotBefore :: (Prelude.Maybe ValidityProperty)}
deriving stock (Prelude.Eq, Prelude.Show)
mkCertificate ::
Value Prelude.Text
-> Value Prelude.Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Stratosphere.ResourceProperties
data ApiPassthroughProperty
= ApiPassthroughProperty {extensions :: (Prelude.Maybe ExtensionsProperty),
subject :: (Prelude.Maybe SubjectProperty)}
deriving stock (Prelude.Eq, Prelude.Show)
mkApiPassthroughProperty :: ApiPassthroughProperty
mkApiPassthroughProperty
= ApiPassthroughProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data ApiPassthroughProperty :: Prelude.Type
instance ToResourceProperties ApiPassthroughProperty
instance Prelude.Eq ApiPassthroughProperty
instance Prelude.Show ApiPassthroughProperty
instance JSON.ToJSON ApiPassthroughProperty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Stratosphere.Value
data CustomAttributeProperty
= CustomAttributeProperty {objectIdentifier :: (Value Prelude.Text),
value :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkCustomAttributeProperty ::
Value Prelude.Text -> Value Prelude.Text -> CustomAttributeProperty
mkCustomAttributeProperty objectIdentifier value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data CustomAttributeProperty :: Prelude.Type
instance ToResourceProperties CustomAttributeProperty
instance Prelude.Eq CustomAttributeProperty
instance Prelude.Show CustomAttributeProperty
instance JSON.ToJSON CustomAttributeProperty
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ data CustomExtensionProperty
= CustomExtensionProperty {critical :: (Prelude.Maybe (Value Prelude.Bool)),
objectIdentifier :: (Value Prelude.Text),
value :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkCustomExtensionProperty ::
Value Prelude.Text -> Value Prelude.Text -> CustomExtensionProperty
mkCustomExtensionProperty objectIdentifier value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data CustomExtensionProperty :: Prelude.Type
instance ToResourceProperties CustomExtensionProperty
instance Prelude.Eq CustomExtensionProperty
instance Prelude.Show CustomExtensionProperty
instance JSON.ToJSON CustomExtensionProperty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Stratosphere.Value
data EdiPartyNameProperty
= EdiPartyNameProperty {nameAssigner :: (Value Prelude.Text),
partyName :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkEdiPartyNameProperty ::
Value Prelude.Text -> Value Prelude.Text -> EdiPartyNameProperty
mkEdiPartyNameProperty nameAssigner partyName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data EdiPartyNameProperty :: Prelude.Type
instance ToResourceProperties EdiPartyNameProperty
instance Prelude.Eq EdiPartyNameProperty
instance Prelude.Show EdiPartyNameProperty
instance JSON.ToJSON EdiPartyNameProperty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Stratosphere.Value
data ExtendedKeyUsageProperty
= ExtendedKeyUsageProperty {extendedKeyUsageObjectIdentifier :: (Prelude.Maybe (Value Prelude.Text)),
extendedKeyUsageType :: (Prelude.Maybe (Value Prelude.Text))}
deriving stock (Prelude.Eq, Prelude.Show)
mkExtendedKeyUsageProperty :: ExtendedKeyUsageProperty
mkExtendedKeyUsageProperty
= ExtendedKeyUsageProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data ExtendedKeyUsageProperty :: Prelude.Type
instance ToResourceProperties ExtendedKeyUsageProperty
instance Prelude.Eq ExtendedKeyUsageProperty
instance Prelude.Show ExtendedKeyUsageProperty
instance JSON.ToJSON ExtendedKeyUsageProperty
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data ExtensionsProperty
extendedKeyUsage :: (Prelude.Maybe [ExtendedKeyUsageProperty]),
keyUsage :: (Prelude.Maybe KeyUsageProperty),
subjectAlternativeNames :: (Prelude.Maybe [GeneralNameProperty])}
deriving stock (Prelude.Eq, Prelude.Show)
mkExtensionsProperty :: ExtensionsProperty
mkExtensionsProperty
= ExtensionsProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data ExtensionsProperty :: Prelude.Type
instance ToResourceProperties ExtensionsProperty
instance Prelude.Eq ExtensionsProperty
instance Prelude.Show ExtensionsProperty
instance JSON.ToJSON ExtensionsProperty
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ data GeneralNameProperty
registeredId :: (Prelude.Maybe (Value Prelude.Text)),
rfc822Name :: (Prelude.Maybe (Value Prelude.Text)),
uniformResourceIdentifier :: (Prelude.Maybe (Value Prelude.Text))}
deriving stock (Prelude.Eq, Prelude.Show)
mkGeneralNameProperty :: GeneralNameProperty
mkGeneralNameProperty
= GeneralNameProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data GeneralNameProperty :: Prelude.Type
instance ToResourceProperties GeneralNameProperty
instance Prelude.Eq GeneralNameProperty
instance Prelude.Show GeneralNameProperty
instance JSON.ToJSON GeneralNameProperty
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data KeyUsageProperty
keyCertSign :: (Prelude.Maybe (Value Prelude.Bool)),
keyEncipherment :: (Prelude.Maybe (Value Prelude.Bool)),
nonRepudiation :: (Prelude.Maybe (Value Prelude.Bool))}
deriving stock (Prelude.Eq, Prelude.Show)
mkKeyUsageProperty :: KeyUsageProperty
mkKeyUsageProperty
= KeyUsageProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data KeyUsageProperty :: Prelude.Type
instance ToResourceProperties KeyUsageProperty
instance Prelude.Eq KeyUsageProperty
instance Prelude.Show KeyUsageProperty
instance JSON.ToJSON KeyUsageProperty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Stratosphere.Value
data OtherNameProperty
= OtherNameProperty {typeId :: (Value Prelude.Text),
value :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkOtherNameProperty ::
Value Prelude.Text -> Value Prelude.Text -> OtherNameProperty
mkOtherNameProperty typeId value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data OtherNameProperty :: Prelude.Type
instance ToResourceProperties OtherNameProperty
instance Prelude.Eq OtherNameProperty
instance Prelude.Show OtherNameProperty
instance JSON.ToJSON OtherNameProperty
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Stratosphere.Value
data PolicyInformationProperty
= PolicyInformationProperty {certPolicyId :: (Value Prelude.Text),
policyQualifiers :: (Prelude.Maybe [PolicyQualifierInfoProperty])}
deriving stock (Prelude.Eq, Prelude.Show)
mkPolicyInformationProperty ::
Value Prelude.Text -> PolicyInformationProperty
mkPolicyInformationProperty certPolicyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data PolicyInformationProperty :: Prelude.Type
instance ToResourceProperties PolicyInformationProperty
instance Prelude.Eq PolicyInformationProperty
instance Prelude.Show PolicyInformationProperty
instance JSON.ToJSON PolicyInformationProperty
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Stratosphere.Value
data PolicyQualifierInfoProperty
= PolicyQualifierInfoProperty {policyQualifierId :: (Value Prelude.Text),
qualifier :: QualifierProperty}
deriving stock (Prelude.Eq, Prelude.Show)
mkPolicyQualifierInfoProperty ::
Value Prelude.Text
-> QualifierProperty -> PolicyQualifierInfoProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data PolicyQualifierInfoProperty :: Prelude.Type
instance ToResourceProperties PolicyQualifierInfoProperty
instance Prelude.Eq PolicyQualifierInfoProperty
instance Prelude.Show PolicyQualifierInfoProperty
instance JSON.ToJSON PolicyQualifierInfoProperty
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Stratosphere.ResourceProperties
import Stratosphere.Value
data QualifierProperty
= QualifierProperty {cpsUri :: (Value Prelude.Text)}
deriving stock (Prelude.Eq, Prelude.Show)
mkQualifierProperty :: Value Prelude.Text -> QualifierProperty
mkQualifierProperty cpsUri = QualifierProperty {cpsUri = cpsUri}
instance ToResourceProperties QualifierProperty where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data QualifierProperty :: Prelude.Type
instance ToResourceProperties QualifierProperty
instance Prelude.Eq QualifierProperty
instance Prelude.Show QualifierProperty
instance JSON.ToJSON QualifierProperty
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ data SubjectProperty
state :: (Prelude.Maybe (Value Prelude.Text)),
surname :: (Prelude.Maybe (Value Prelude.Text)),
title :: (Prelude.Maybe (Value Prelude.Text))}
deriving stock (Prelude.Eq, Prelude.Show)
mkSubjectProperty :: SubjectProperty
mkSubjectProperty
= SubjectProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data SubjectProperty :: Prelude.Type
instance ToResourceProperties SubjectProperty
instance Prelude.Eq SubjectProperty
instance Prelude.Show SubjectProperty
instance JSON.ToJSON SubjectProperty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Stratosphere.Value
data ValidityProperty
= ValidityProperty {type' :: (Value Prelude.Text),
value :: (Value Prelude.Double)}
deriving stock (Prelude.Eq, Prelude.Show)
mkValidityProperty ::
Value Prelude.Text -> Value Prelude.Double -> ValidityProperty
mkValidityProperty type' value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data ValidityProperty :: Prelude.Type
instance ToResourceProperties ValidityProperty
instance Prelude.Eq ValidityProperty
instance Prelude.Show ValidityProperty
instance JSON.ToJSON ValidityProperty
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ data CertificateAuthority
tags :: (Prelude.Maybe [Tag]),
type' :: (Value Prelude.Text),
usageMode :: (Prelude.Maybe (Value Prelude.Text))}
deriving stock (Prelude.Eq, Prelude.Show)
mkCertificateAuthority ::
Value Prelude.Text
-> Value Prelude.Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Stratosphere.ResourceProperties
data AccessDescriptionProperty
= AccessDescriptionProperty {accessLocation :: GeneralNameProperty,
accessMethod :: AccessMethodProperty}
deriving stock (Prelude.Eq, Prelude.Show)
mkAccessDescriptionProperty ::
GeneralNameProperty
-> AccessMethodProperty -> AccessDescriptionProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data AccessDescriptionProperty :: Prelude.Type
instance ToResourceProperties AccessDescriptionProperty
instance Prelude.Eq AccessDescriptionProperty
instance Prelude.Show AccessDescriptionProperty
instance JSON.ToJSON AccessDescriptionProperty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Stratosphere.Value
data AccessMethodProperty
= AccessMethodProperty {accessMethodType :: (Prelude.Maybe (Value Prelude.Text)),
customObjectIdentifier :: (Prelude.Maybe (Value Prelude.Text))}
deriving stock (Prelude.Eq, Prelude.Show)
mkAccessMethodProperty :: AccessMethodProperty
mkAccessMethodProperty
= AccessMethodProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data AccessMethodProperty :: Prelude.Type
instance ToResourceProperties AccessMethodProperty
instance Prelude.Eq AccessMethodProperty
instance Prelude.Show AccessMethodProperty
instance JSON.ToJSON AccessMethodProperty
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data CrlConfigurationProperty
expirationInDays :: (Prelude.Maybe (Value Prelude.Integer)),
s3BucketName :: (Prelude.Maybe (Value Prelude.Text)),
s3ObjectAcl :: (Prelude.Maybe (Value Prelude.Text))}
deriving stock (Prelude.Eq, Prelude.Show)
mkCrlConfigurationProperty :: CrlConfigurationProperty
mkCrlConfigurationProperty
= CrlConfigurationProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import qualified Stratosphere.Prelude as Prelude
import Stratosphere.ResourceProperties
data CrlConfigurationProperty :: Prelude.Type
instance ToResourceProperties CrlConfigurationProperty
instance Prelude.Eq CrlConfigurationProperty
instance Prelude.Show CrlConfigurationProperty
instance JSON.ToJSON CrlConfigurationProperty
Loading

0 comments on commit d1b6388

Please sign in to comment.