Distribution.Utils.Structured

Cabal-3.2.0.0: A framework for packaging Haskell software

Copyright | (c) 2019 Oleg Grenrus
Safe Haskell | None
Language | Haskell2010

Distribution.Utils.Structured

Contents

- Encoding and decoding
- Structured class
- Structure type

Description

Structurally tag binary serialisaton stream. Useful when most `Binary` instances are `Generic` derived.

Say you have a data type

    data Record = Record
      { _recordFields  :: HM.HashMap Text (Integer, ByteString)
      , _recordEnabled :: Bool
      }
      deriving (Eq, Show, Generic)

    instance Binary Record
    instance Structured Record

then you can serialise and deserialise `Record` values with a structure tag by simply

    structuredEncode record :: ByteString
    structuredDecode lbs :: IO Record

If structure of `Record` changes in between, deserialisation will fail early.

Technically, `Structured` is not related to `Binary`, and may be useful in other uses.

Synopsis

- structuredEncode :: forall a. (Binary a, Structured a) => a -> ByteString
- structuredEncodeFile :: (Binary a, Structured a) => FilePath -> a -> IO ()
- structuredDecode :: forall a. (Binary a, Structured a) => ByteString -> a
- structuredDecodeOrFailIO :: (Binary a, Structured a) => ByteString -> IO (Either String a)
- structuredDecodeFileOrFail :: (Binary a, Structured a) => FilePath -> IO (Either String a)
- class Typeable a => Structured a where
  - structure :: Proxy a -> Structure
- type MD5 = Fingerprint
- structureHash :: forall a. Structured a => Proxy a -> MD5
- structureBuilder :: Structure -> Builder
- genericStructure :: forall a. (Typeable a, Generic a, GStructured (Rep a)) => Proxy a -> Structure
- class GStructured (f :: Type -> Type)
- nominalStructure :: Typeable a => Proxy a -> Structure
- containerStructure :: forall f a. (Typeable f, Structured a) => Proxy (f a) -> Structure
- data Structure
  - = Nominal !TypeRep !TypeVersion TypeName [Structure]
  - | Newtype !TypeRep !TypeVersion TypeName Structure
  - | Structure !TypeRep !TypeVersion TypeName SopStructure
- type TypeName = String
- type ConstructorName = String
- type TypeVersion = Word32
- type SopStructure = [(ConstructorName, [Structure])]
- hashStructure :: Structure -> MD5
- typeVersion :: Functor f => (TypeVersion -> f TypeVersion) -> Structure -> f Structure
- typeName :: Functor f => (TypeName -> f TypeName) -> Structure -> f Structure

# Encoding and decoding

These functions operate like `binary`'s counterparts, but the serialised version has a structure hash in front.

structuredEncode :: forall a. (Binary a, Structured a) => a -> ByteString Source #

Structured `encode`. Encode a value to using binary serialisation to a lazy `ByteString`. Encoding starts with 16 byte large structure hash.

structuredEncodeFile :: (Binary a, Structured a) => FilePath -> a -> IO () Source #

Lazily serialise a value to a file

structuredDecode :: forall a. (Binary a, Structured a) => ByteString -> a Source #

Structured `decode`. Decode a value from a lazy `ByteString`, reconstructing the original structure. Throws pure exception on invalid inputs.

structuredDecodeOrFailIO :: (Binary a, Structured a) => ByteString -> IO (Either String a) Source #

structuredDecodeFileOrFail :: (Binary a, Structured a) => FilePath -> IO (Either String a) Source #

Lazily reconstruct a value previously written to a file.

# Structured class

class Typeable a => Structured a where Source #

Class of types with a known `Structure`.

For regular data types `Structured` can be derived generically.

    data Record = Record { a :: Int, b :: Bool, c :: [Char] } deriving (Generic)
    instance Structured Record

Minimal complete definition

Nothing

Methods

structure :: Proxy a -> Structure Source #

structure :: (Generic a, GStructured (Rep a)) => Proxy a -> Structure Source #

#### Instances

Instances details

Structured Bool # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Bool -> Structure Source # structureHash' :: Tagged Bool MD5
Structured Char # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Char -> Structure Source # structureHash' :: Tagged Char MD5
Structured Double # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Double -> Structure Source # structureHash' :: Tagged Double MD5
Structured Float # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Float -> Structure Source # structureHash' :: Tagged Float MD5
Structured Int # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Int -> Structure Source # structureHash' :: Tagged Int MD5
Structured Int8 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Int8 -> Structure Source # structureHash' :: Tagged Int8 MD5
Structured Int16 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Int16 -> Structure Source # structureHash' :: Tagged Int16 MD5
Structured Int32 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Int32 -> Structure Source # structureHash' :: Tagged Int32 MD5
Structured Int64 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Int64 -> Structure Source # structureHash' :: Tagged Int64 MD5
Structured Integer # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Integer -> Structure Source # structureHash' :: Tagged Integer MD5
Structured Ordering # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Ordering -> Structure Source # structureHash' :: Tagged Ordering MD5
Structured Word # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Word -> Structure Source # structureHash' :: Tagged Word MD5
Structured Word8 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Word8 -> Structure Source # structureHash' :: Tagged Word8 MD5
Structured Word16 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Word16 -> Structure Source # structureHash' :: Tagged Word16 MD5
Structured Word32 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Word32 -> Structure Source # structureHash' :: Tagged Word32 MD5
Structured Word64 # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Word64 -> Structure Source # structureHash' :: Tagged Word64 MD5
Structured () # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy () -> Structure Source # structureHash' :: Tagged () MD5
Structured ByteString # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy ByteString -> Structure Source # structureHash' :: Tagged ByteString MD5
Structured ByteString # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy ByteString -> Structure Source # structureHash' :: Tagged ByteString MD5
Structured IntSet # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy IntSet -> Structure Source # structureHash' :: Tagged IntSet MD5
Structured Text # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Text -> Structure Source # structureHash' :: Tagged Text MD5
Structured Text # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Text -> Structure Source # structureHash' :: Tagged Text MD5
Structured LocalTime # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy LocalTime -> Structure Source # structureHash' :: Tagged LocalTime MD5
Structured TimeOfDay # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy TimeOfDay -> Structure Source # structureHash' :: Tagged TimeOfDay MD5
Structured TimeZone # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy TimeZone -> Structure Source # structureHash' :: Tagged TimeZone MD5
Structured UniversalTime # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy UniversalTime -> Structure Source # structureHash' :: Tagged UniversalTime MD5
Structured UTCTime # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy UTCTime -> Structure Source # structureHash' :: Tagged UTCTime MD5
Structured NominalDiffTime # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy NominalDiffTime -> Structure Source # structureHash' :: Tagged NominalDiffTime MD5
Structured DiffTime # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy DiffTime -> Structure Source # structureHash' :: Tagged DiffTime MD5
Structured Day # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy Day -> Structure Source # structureHash' :: Tagged Day MD5
Structured ShortText # |
Instance details Defined in Distribution.Utils.ShortText Methods structure :: Proxy ShortText -> Structure Source # structureHash' :: Tagged ShortText MD5
Structured PathTemplateVariable # |
Instance details Defined in Distribution.Simple.InstallDirs.Internal Methods structure :: Proxy PathTemplateVariable -> Structure Source # structureHash' :: Tagged PathTemplateVariable MD5
Structured PathComponent # |
Instance details Defined in Distribution.Simple.InstallDirs.Internal Methods structure :: Proxy PathComponent -> Structure Source # structureHash' :: Tagged PathComponent MD5
Structured Version # |
Instance details Defined in Distribution.Types.Version Methods structure :: Proxy Version -> Structure Source # structureHash' :: Tagged Version MD5
Structured VersionRange # |
Instance details Defined in Distribution.Types.VersionRange.Internal Methods structure :: Proxy VersionRange -> Structure Source # structureHash' :: Tagged VersionRange MD5
Structured RepoType # |
Instance details Defined in Distribution.Types.SourceRepo Methods structure :: Proxy RepoType -> Structure Source # structureHash' :: Tagged RepoType MD5
Structured RepoKind # |
Instance details Defined in Distribution.Types.SourceRepo Methods structure :: Proxy RepoKind -> Structure Source # structureHash' :: Tagged RepoKind MD5
Structured SourceRepo # |
Instance details Defined in Distribution.Types.SourceRepo Methods structure :: Proxy SourceRepo -> Structure Source # structureHash' :: Tagged SourceRepo MD5
Structured PkgconfigVersion # |
Instance details Defined in Distribution.Types.PkgconfigVersion Methods structure :: Proxy PkgconfigVersion -> Structure Source # structureHash' :: Tagged PkgconfigVersion MD5
Structured PkgconfigVersionRange # |
Instance details Defined in Distribution.Types.PkgconfigVersionRange Methods structure :: Proxy PkgconfigVersionRange -> Structure Source # structureHash' :: Tagged PkgconfigVersionRange MD5
Structured PkgconfigName # |
Instance details Defined in Distribution.Types.PkgconfigName Methods structure :: Proxy PkgconfigName -> Structure Source # structureHash' :: Tagged PkgconfigName MD5
Structured PkgconfigDependency # |
Instance details Defined in Distribution.Types.PkgconfigDependency Methods structure :: Proxy PkgconfigDependency -> Structure Source # structureHash' :: Tagged PkgconfigDependency MD5
Structured PackageName # |
Instance details Defined in Distribution.Types.PackageName Methods structure :: Proxy PackageName -> Structure Source # structureHash' :: Tagged PackageName MD5
Structured UnqualComponentName # |
Instance details Defined in Distribution.Types.UnqualComponentName Methods structure :: Proxy UnqualComponentName -> Structure Source # structureHash' :: Tagged UnqualComponentName MD5
Structured PackageVersionConstraint # |
Instance details Defined in Distribution.Types.PackageVersionConstraint Methods structure :: Proxy PackageVersionConstraint -> Structure Source # structureHash' :: Tagged PackageVersionConstraint MD5
Structured LibraryVisibility # |
Instance details Defined in Distribution.Types.LibraryVisibility Methods structure :: Proxy LibraryVisibility -> Structure Source # structureHash' :: Tagged LibraryVisibility MD5
Structured LibraryName # |
Instance details Defined in Distribution.Types.LibraryName Methods structure :: Proxy LibraryName -> Structure Source # structureHash' :: Tagged LibraryName MD5
Structured MungedPackageName # |
Instance details Defined in Distribution.Types.MungedPackageName Methods structure :: Proxy MungedPackageName -> Structure Source # structureHash' :: Tagged MungedPackageName MD5
Structured ForeignLibType # |
Instance details Defined in Distribution.Types.ForeignLibType Methods structure :: Proxy ForeignLibType -> Structure Source # structureHash' :: Tagged ForeignLibType MD5
Structured ForeignLibOption # |
Instance details Defined in Distribution.Types.ForeignLibOption Methods structure :: Proxy ForeignLibOption -> Structure Source # structureHash' :: Tagged ForeignLibOption MD5
Structured FlagAssignment # |
Instance details Defined in Distribution.Types.Flag Methods structure :: Proxy FlagAssignment -> Structure Source # structureHash' :: Tagged FlagAssignment MD5
Structured FlagName # |
Instance details Defined in Distribution.Types.Flag Methods structure :: Proxy FlagName -> Structure Source # structureHash' :: Tagged FlagName MD5
Structured Flag # |
Instance details Defined in Distribution.Types.Flag Methods structure :: Proxy Flag -> Structure Source # structureHash' :: Tagged Flag MD5
Structured ExecutableScope # |
Instance details Defined in Distribution.Types.ExecutableScope Methods structure :: Proxy ExecutableScope -> Structure Source # structureHash' :: Tagged ExecutableScope MD5
Structured ComponentName # |
Instance details Defined in Distribution.Types.ComponentName Methods structure :: Proxy ComponentName -> Structure Source # structureHash' :: Tagged ComponentName MD5
Structured ComponentId # |
Instance details Defined in Distribution.Types.ComponentId Methods structure :: Proxy ComponentId -> Structure Source # structureHash' :: Tagged ComponentId MD5
Structured GivenComponent # |
Instance details Defined in Distribution.Types.GivenComponent Methods structure :: Proxy GivenComponent -> Structure Source # structureHash' :: Tagged GivenComponent MD5
Structured BuildType # |
Instance details Defined in Distribution.Types.BuildType Methods structure :: Proxy BuildType -> Structure Source # structureHash' :: Tagged BuildType MD5
Structured AbiHash # |
Instance details Defined in Distribution.Types.AbiHash Methods structure :: Proxy AbiHash -> Structure Source # structureHash' :: Tagged AbiHash MD5
Structured Platform # |
Instance details Defined in Distribution.System Methods structure :: Proxy Platform -> Structure Source # structureHash' :: Tagged Platform MD5
Structured Arch # |
Instance details Defined in Distribution.System Methods structure :: Proxy Arch -> Structure Source # structureHash' :: Tagged Arch MD5
Structured OS # |
Instance details Defined in Distribution.System Methods structure :: Proxy OS -> Structure Source # structureHash' :: Tagged OS MD5
Structured LicenseRef # |
Instance details Defined in Distribution.SPDX.LicenseReference Methods structure :: Proxy LicenseRef -> Structure Source # structureHash' :: Tagged LicenseRef MD5
Structured LicenseId # |
Instance details Defined in Distribution.SPDX.LicenseId Methods structure :: Proxy LicenseId -> Structure Source # structureHash' :: Tagged LicenseId MD5
Structured LicenseExceptionId # |
Instance details Defined in Distribution.SPDX.LicenseExceptionId Methods structure :: Proxy LicenseExceptionId -> Structure Source # structureHash' :: Tagged LicenseExceptionId MD5
Structured SimpleLicenseExpression # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods structure :: Proxy SimpleLicenseExpression -> Structure Source # structureHash' :: Tagged SimpleLicenseExpression MD5
Structured LicenseExpression # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods structure :: Proxy LicenseExpression -> Structure Source # structureHash' :: Tagged LicenseExpression MD5
Structured License # |
Instance details Defined in Distribution.SPDX.License Methods structure :: Proxy License -> Structure Source # structureHash' :: Tagged License MD5
Structured ModuleName # |
Instance details Defined in Distribution.ModuleName Methods structure :: Proxy ModuleName -> Structure Source # structureHash' :: Tagged ModuleName MD5
Structured ModuleRenaming # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods structure :: Proxy ModuleRenaming -> Structure Source # structureHash' :: Tagged ModuleRenaming MD5
Structured IncludeRenaming # |
Instance details Defined in Distribution.Types.IncludeRenaming Methods structure :: Proxy IncludeRenaming -> Structure Source # structureHash' :: Tagged IncludeRenaming MD5
Structured Mixin # |
Instance details Defined in Distribution.Types.Mixin Methods structure :: Proxy Mixin -> Structure Source # structureHash' :: Tagged Mixin MD5
Structured ModuleReexport # |
Instance details Defined in Distribution.Types.ModuleReexport Methods structure :: Proxy ModuleReexport -> Structure Source # structureHash' :: Tagged ModuleReexport MD5
Structured VerbosityFlag # |
Instance details Defined in Distribution.Verbosity.Internal Methods structure :: Proxy VerbosityFlag -> Structure Source # structureHash' :: Tagged VerbosityFlag MD5
Structured VerbosityLevel # |
Instance details Defined in Distribution.Verbosity.Internal Methods structure :: Proxy VerbosityLevel -> Structure Source # structureHash' :: Tagged VerbosityLevel MD5
Structured Verbosity # |
Instance details Defined in Distribution.Verbosity Methods structure :: Proxy Verbosity -> Structure Source # structureHash' :: Tagged Verbosity MD5
Structured TestType # |
Instance details Defined in Distribution.Types.TestType Methods structure :: Proxy TestType -> Structure Source # structureHash' :: Tagged TestType MD5
Structured TestSuiteInterface # |
Instance details Defined in Distribution.Types.TestSuiteInterface Methods structure :: Proxy TestSuiteInterface -> Structure Source # structureHash' :: Tagged TestSuiteInterface MD5
Structured PackageIdentifier # |
Instance details Defined in Distribution.Types.PackageId Methods structure :: Proxy PackageIdentifier -> Structure Source # structureHash' :: Tagged PackageIdentifier MD5
Structured DefUnitId # |
Instance details Defined in Distribution.Types.UnitId Methods structure :: Proxy DefUnitId -> Structure Source # structureHash' :: Tagged DefUnitId MD5
Structured UnitId # |
Instance details Defined in Distribution.Types.UnitId Methods structure :: Proxy UnitId -> Structure Source # structureHash' :: Tagged UnitId MD5
Structured Module # |
Instance details Defined in Distribution.Types.Module Methods structure :: Proxy Module -> Structure Source # structureHash' :: Tagged Module MD5
Structured OpenModule # |
Instance details Defined in Distribution.Backpack Methods structure :: Proxy OpenModule -> Structure Source # structureHash' :: Tagged OpenModule MD5
Structured OpenUnitId # |
Instance details Defined in Distribution.Backpack Methods structure :: Proxy OpenUnitId -> Structure Source # structureHash' :: Tagged OpenUnitId MD5
Structured ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods structure :: Proxy ExposedModule -> Structure Source # structureHash' :: Tagged ExposedModule MD5
Structured MungedPackageId # |
Instance details Defined in Distribution.Types.MungedPackageId Methods structure :: Proxy MungedPackageId -> Structure Source # structureHash' :: Tagged MungedPackageId MD5
Structured LegacyExeDependency # |
Instance details Defined in Distribution.Types.LegacyExeDependency Methods structure :: Proxy LegacyExeDependency -> Structure Source # structureHash' :: Tagged LegacyExeDependency MD5
Structured ExeDependency # |
Instance details Defined in Distribution.Types.ExeDependency Methods structure :: Proxy ExeDependency -> Structure Source # structureHash' :: Tagged ExeDependency MD5
Structured Dependency # |
Instance details Defined in Distribution.Types.Dependency Methods structure :: Proxy Dependency -> Structure Source # structureHash' :: Tagged Dependency MD5
Structured SetupBuildInfo # |
Instance details Defined in Distribution.Types.SetupBuildInfo Methods structure :: Proxy SetupBuildInfo -> Structure Source # structureHash' :: Tagged SetupBuildInfo MD5
Structured BenchmarkType # |
Instance details Defined in Distribution.Types.BenchmarkType Methods structure :: Proxy BenchmarkType -> Structure Source # structureHash' :: Tagged BenchmarkType MD5
Structured BenchmarkInterface # |
Instance details Defined in Distribution.Types.BenchmarkInterface Methods structure :: Proxy BenchmarkInterface -> Structure Source # structureHash' :: Tagged BenchmarkInterface MD5
Structured AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods structure :: Proxy AbiDependency -> Structure Source # structureHash' :: Tagged AbiDependency MD5
Structured License # |
Instance details Defined in Distribution.License Methods structure :: Proxy License -> Structure Source # structureHash' :: Tagged License MD5
Structured InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods structure :: Proxy InstalledPackageInfo -> Structure Source # structureHash' :: Tagged InstalledPackageInfo MD5
Structured KnownExtension # |
Instance details Defined in Language.Haskell.Extension Methods structure :: Proxy KnownExtension -> Structure Source # structureHash' :: Tagged KnownExtension MD5
Structured Extension # |
Instance details Defined in Language.Haskell.Extension Methods structure :: Proxy Extension -> Structure Source # structureHash' :: Tagged Extension MD5
Structured Language # |
Instance details Defined in Language.Haskell.Extension Methods structure :: Proxy Language -> Structure Source # structureHash' :: Tagged Language MD5
Structured AbiTag # |
Instance details Defined in Distribution.Compiler Methods structure :: Proxy AbiTag -> Structure Source # structureHash' :: Tagged AbiTag MD5
Structured CompilerId # |
Instance details Defined in Distribution.Compiler Methods structure :: Proxy CompilerId -> Structure Source # structureHash' :: Tagged CompilerId MD5
Structured CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods structure :: Proxy CompilerFlavor -> Structure Source # structureHash' :: Tagged CompilerFlavor MD5
Structured ConfVar # |
Instance details Defined in Distribution.Types.ConfVar Methods structure :: Proxy ConfVar -> Structure Source # structureHash' :: Tagged ConfVar MD5
Structured BuildInfo # |
Instance details Defined in Distribution.Types.BuildInfo Methods structure :: Proxy BuildInfo -> Structure Source # structureHash' :: Tagged BuildInfo MD5
Structured TestSuite # |
Instance details Defined in Distribution.Types.TestSuite Methods structure :: Proxy TestSuite -> Structure Source # structureHash' :: Tagged TestSuite MD5
Structured Library # |
Instance details Defined in Distribution.Types.Library Methods structure :: Proxy Library -> Structure Source # structureHash' :: Tagged Library MD5
Structured LibVersionInfo # |
Instance details Defined in Distribution.Types.ForeignLib Methods structure :: Proxy LibVersionInfo -> Structure Source # structureHash' :: Tagged LibVersionInfo MD5
Structured ForeignLib # |
Instance details Defined in Distribution.Types.ForeignLib Methods structure :: Proxy ForeignLib -> Structure Source # structureHash' :: Tagged ForeignLib MD5
Structured Executable # |
Instance details Defined in Distribution.Types.Executable Methods structure :: Proxy Executable -> Structure Source # structureHash' :: Tagged Executable MD5
Structured Benchmark # |
Instance details Defined in Distribution.Types.Benchmark Methods structure :: Proxy Benchmark -> Structure Source # structureHash' :: Tagged Benchmark MD5
Structured ComponentRequestedSpec # |
Instance details Defined in Distribution.Types.ComponentRequestedSpec Methods structure :: Proxy ComponentRequestedSpec -> Structure Source # structureHash' :: Tagged ComponentRequestedSpec MD5
Structured PackageDescription # |
Instance details Defined in Distribution.Types.PackageDescription Methods structure :: Proxy PackageDescription -> Structure Source # structureHash' :: Tagged PackageDescription MD5
Structured GenericPackageDescription # |
Instance details Defined in Distribution.Types.GenericPackageDescription Methods structure :: Proxy GenericPackageDescription -> Structure Source # structureHash' :: Tagged GenericPackageDescription MD5
Structured PathTemplate # |
Instance details Defined in Distribution.Simple.InstallDirs Methods structure :: Proxy PathTemplate -> Structure Source # structureHash' :: Tagged PathTemplate MD5
Structured ProgramSearchPathEntry # |
Instance details Defined in Distribution.Simple.Program.Find Methods structure :: Proxy ProgramSearchPathEntry -> Structure Source # structureHash' :: Tagged ProgramSearchPathEntry MD5
Structured ProgramLocation # |
Instance details Defined in Distribution.Simple.Program.Types Methods structure :: Proxy ProgramLocation -> Structure Source # structureHash' :: Tagged ProgramLocation MD5
Structured ConfiguredProgram # |
Instance details Defined in Distribution.Simple.Program.Types Methods structure :: Proxy ConfiguredProgram -> Structure Source # structureHash' :: Tagged ConfiguredProgram MD5
Structured ProfDetailLevel # |
Instance details Defined in Distribution.Simple.Compiler Methods structure :: Proxy ProfDetailLevel -> Structure Source # structureHash' :: Tagged ProfDetailLevel MD5
Structured DebugInfoLevel # |
Instance details Defined in Distribution.Simple.Compiler Methods structure :: Proxy DebugInfoLevel -> Structure Source # structureHash' :: Tagged DebugInfoLevel MD5
Structured OptimisationLevel # |
Instance details Defined in Distribution.Simple.Compiler Methods structure :: Proxy OptimisationLevel -> Structure Source # structureHash' :: Tagged OptimisationLevel MD5
Structured PackageDB # |
Instance details Defined in Distribution.Simple.Compiler Methods structure :: Proxy PackageDB -> Structure Source # structureHash' :: Tagged PackageDB MD5
Structured Compiler # |
Instance details Defined in Distribution.Simple.Compiler Methods structure :: Proxy Compiler -> Structure Source # structureHash' :: Tagged Compiler MD5
Structured ProgramDb # |
Instance details Defined in Distribution.Simple.Program.Db Methods structure :: Proxy ProgramDb -> Structure Source # structureHash' :: Tagged ProgramDb MD5
Structured TestShowDetails # |
Instance details Defined in Distribution.Simple.Setup Methods structure :: Proxy TestShowDetails -> Structure Source # structureHash' :: Tagged TestShowDetails MD5
Structured HaddockTarget # |
Instance details Defined in Distribution.Simple.Setup Methods structure :: Proxy HaddockTarget -> Structure Source # structureHash' :: Tagged HaddockTarget MD5
Structured ConfigFlags # |
Instance details Defined in Distribution.Simple.Setup Methods structure :: Proxy ConfigFlags -> Structure Source # structureHash' :: Tagged ConfigFlags MD5
Structured ComponentLocalBuildInfo # |
Instance details Defined in Distribution.Types.ComponentLocalBuildInfo Methods structure :: Proxy ComponentLocalBuildInfo -> Structure Source # structureHash' :: Tagged ComponentLocalBuildInfo MD5
Structured LocalBuildInfo # |
Instance details Defined in Distribution.Types.LocalBuildInfo Methods structure :: Proxy LocalBuildInfo -> Structure Source # structureHash' :: Tagged LocalBuildInfo MD5
Structured ModuleShape # |
Instance details Defined in Distribution.Backpack.ModuleShape Methods structure :: Proxy ModuleShape -> Structure Source # structureHash' :: Tagged ModuleShape MD5
Structured ModTime # |
Instance details Defined in Distribution.Compat.Time Methods structure :: Proxy ModTime -> Structure Source # structureHash' :: Tagged ModTime MD5
Structured a => Structured [a] # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy [a] -> Structure Source # structureHash' :: Tagged [a] MD5
Structured a => Structured (Maybe a) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (Maybe a) -> Structure Source # structureHash' :: Tagged (Maybe a) MD5
Structured a => Structured (Ratio a) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (Ratio a) -> Structure Source # structureHash' :: Tagged (Ratio a) MD5
Structured a => Structured (NonEmpty a) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (NonEmpty a) -> Structure Source # structureHash' :: Tagged (NonEmpty a) MD5
Structured v => Structured (IntMap v) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (IntMap v) -> Structure Source # structureHash' :: Tagged (IntMap v) MD5
Structured v => Structured (Seq v) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (Seq v) -> Structure Source # structureHash' :: Tagged (Seq v) MD5
Structured k => Structured (Set k) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (Set k) -> Structure Source # structureHash' :: Tagged (Set k) MD5
Structured a => Structured (Option' a) # |
Instance details Defined in Distribution.Compat.Semigroup Methods structure :: Proxy (Option' a) -> Structure Source # structureHash' :: Tagged (Option' a) MD5
Structured a => Structured (Last' a) # |
Instance details Defined in Distribution.Compat.Semigroup Methods structure :: Proxy (Last' a) -> Structure Source # structureHash' :: Tagged (Last' a) MD5
Structured c => Structured (Condition c) # |
Instance details Defined in Distribution.Types.Condition Methods structure :: Proxy (Condition c) -> Structure Source # structureHash' :: Tagged (Condition c) MD5
Structured a => Structured (Flag a) # |
Instance details Defined in Distribution.Simple.Flag Methods structure :: Proxy (Flag a) -> Structure Source # structureHash' :: Tagged (Flag a) MD5
Structured a => Structured (Graph a) # |
Instance details Defined in Distribution.Compat.Graph Methods structure :: Proxy (Graph a) -> Structure Source # structureHash' :: Tagged (Graph a) MD5
Structured a => Structured (PerCompilerFlavor a) # |
Instance details Defined in Distribution.Compiler Methods structure :: Proxy (PerCompilerFlavor a) -> Structure Source # structureHash' :: Tagged (PerCompilerFlavor a) MD5
Structured dir => Structured (InstallDirs dir) # |
Instance details Defined in Distribution.Simple.InstallDirs Methods structure :: Proxy (InstallDirs dir) -> Structure Source # structureHash' :: Tagged (InstallDirs dir) MD5
Structured a => Structured (NubList a) # |
Instance details Defined in Distribution.Utils.NubList Methods structure :: Proxy (NubList a) -> Structure Source # structureHash' :: Tagged (NubList a) MD5
Structured a => Structured (PackageIndex a) # |
Instance details Defined in Distribution.Simple.PackageIndex Methods structure :: Proxy (PackageIndex a) -> Structure Source # structureHash' :: Tagged (PackageIndex a) MD5
(Structured a, Structured b) => Structured (Either a b) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (Either a b) -> Structure Source # structureHash' :: Tagged (Either a b) MD5
(Structured a1, Structured a2) => Structured (a1, a2) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (a1, a2) -> Structure Source # structureHash' :: Tagged (a1, a2) MD5
(Structured k, Structured v) => Structured (Map k v) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (Map k v) -> Structure Source # structureHash' :: Tagged (Map k v) MD5
(Structured a1, Structured a2, Structured a3) => Structured (a1, a2, a3) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (a1, a2, a3) -> Structure Source # structureHash' :: Tagged (a1, a2, a3) MD5
(Structured v, Structured c, Structured a) => Structured (CondBranch v c a) # |
Instance details Defined in Distribution.Types.CondTree Methods structure :: Proxy (CondBranch v c a) -> Structure Source # structureHash' :: Tagged (CondBranch v c a) MD5
(Structured v, Structured c, Structured a) => Structured (CondTree v c a) # |
Instance details Defined in Distribution.Types.CondTree Methods structure :: Proxy (CondTree v c a) -> Structure Source # structureHash' :: Tagged (CondTree v c a) MD5
(Structured a1, Structured a2, Structured a3, Structured a4) => Structured (a1, a2, a3, a4) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (a1, a2, a3, a4) -> Structure Source # structureHash' :: Tagged (a1, a2, a3, a4) MD5
(Structured a1, Structured a2, Structured a3, Structured a4, Structured a5) => Structured (a1, a2, a3, a4, a5) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (a1, a2, a3, a4, a5) -> Structure Source # structureHash' :: Tagged (a1, a2, a3, a4, a5) MD5
(Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6) => Structured (a1, a2, a3, a4, a5, a6) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (a1, a2, a3, a4, a5, a6) -> Structure Source # structureHash' :: Tagged (a1, a2, a3, a4, a5, a6) MD5
(Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6, Structured a7) => Structured (a1, a2, a3, a4, a5, a6, a7) # |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (a1, a2, a3, a4, a5, a6, a7) -> Structure Source # structureHash' :: Tagged (a1, a2, a3, a4, a5, a6, a7) MD5

type MD5 = Fingerprint Source #

structureHash :: forall a. Structured a => Proxy a -> MD5 Source #

Semantically ``hashStructure` . `structure``.

structureBuilder :: Structure -> Builder Source #

Flatten `Structure` into something we can calculate hash of.

As `Structure` can be potentially infinite. For mutually recursive types, we keep track of `TypeRep`s, and put just `TypeRep` name when it's occurred another time.

genericStructure :: forall a. (Typeable a, Generic a, GStructured (Rep a)) => Proxy a -> Structure Source #

Derive `structure` genrically.

class GStructured (f :: Type -> Type) Source #

Used to implement `genericStructure`.

Minimal complete definition

gstructured

#### Instances

Instances details

(i ~ D, Datatype c, GStructuredSum f) => GStructured (M1 i c f) # |
Instance details Defined in Distribution.Utils.Structured Methods gstructured :: TypeRep -> Proxy (M1 i c f) -> TypeVersion -> Structure

nominalStructure :: Typeable a => Proxy a -> Structure Source #

Use `Typeable` to infer name

containerStructure :: forall f a. (Typeable f, Structured a) => Proxy (f a) -> Structure Source #

# Structure type

data Structure Source #

Structure of a datatype.

It can be infinite, as far as `TypeRep`s involved are finite. (e.g. polymorphic recursion might cause troubles).

Constructors

Nominal !TypeRep !TypeVersion TypeName [Structure] | nominal, yet can be parametrised by other structures.
Newtype !TypeRep !TypeVersion TypeName Structure | a newtype wrapper
Structure !TypeRep !TypeVersion TypeName SopStructure | sum-of-products structure

#### Instances

Instances details

Eq Structure # |
Instance details Defined in Distribution.Utils.Structured Methods (==) :: Structure -> Structure -> Bool # (/=) :: Structure -> Structure -> Bool #
Ord Structure # |
Instance details Defined in Distribution.Utils.Structured Methods compare :: Structure -> Structure -> Ordering # (<) :: Structure -> Structure -> Bool # (<=) :: Structure -> Structure -> Bool # (>) :: Structure -> Structure -> Bool # (>=) :: Structure -> Structure -> Bool # max :: Structure -> Structure -> Structure # min :: Structure -> Structure -> Structure #
Show Structure # |
Instance details Defined in Distribution.Utils.Structured Methods showsPrec :: Int -> Structure -> ShowS Source # show :: Structure -> String Source # showList :: [Structure] -> ShowS Source #
Generic Structure # |
Instance details Defined in Distribution.Utils.Structured Associated Types type Rep Structure :: Type -> Type Source # Methods from :: Structure -> Rep Structure x Source # to :: Rep Structure x -> Structure Source #
type Rep Structure # |
Instance details Defined in Distribution.Utils.Structured type Rep Structure = D1 ('MetaData "Structure" "Distribution.Utils.Structured" "Cabal-3.2.0.0" 'False) (C1 ('MetaCons "Nominal" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TypeRep) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TypeVersion)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TypeName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Structure]))) :+: (C1 ('MetaCons "Newtype" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TypeRep) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TypeVersion)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TypeName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Structure))) :+: C1 ('MetaCons "Structure" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TypeRep) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TypeVersion)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TypeName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SopStructure)))))

type TypeName = String Source #

type ConstructorName = String Source #

type TypeVersion = Word32 Source #

A sematic version of a data type. Usually 0.

type SopStructure = [(ConstructorName, [Structure])] Source #

hashStructure :: Structure -> MD5 Source #

A MD5 hash digest of `Structure`.

typeVersion :: Functor f => (TypeVersion -> f TypeVersion) -> Structure -> f Structure Source #

A van-Laarhoven lens into `TypeVersion` of `Structure`

    typeVersion :: Lens' Structure TypeVersion

typeName :: Functor f => (TypeName -> f TypeName) -> Structure -> f Structure Source #

A van-Laarhoven lens into `TypeName` of `Structure`

    typeName :: Lens' Structure TypeName