Cabal-syntax-3.14.0.0: A library for working with .cabal files
Copyright(c) 2019 Oleg Grenrus
Safe HaskellNone
LanguageHaskell2010

Distribution.Utils.Structured

Description

Structurally tag binary serialisation 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

Encoding and decoding

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

structuredEncode :: (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 :: (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.

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

Since: Cabal-syntax-3.2.0.0

Minimal complete definition

Nothing

Methods

structure :: Proxy a -> Structure Source #

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

Instances

Instances details
Structured OpenModule Source # 
Instance details

Defined in Distribution.Backpack

Structured OpenUnitId Source # 
Instance details

Defined in Distribution.Backpack

Structured CabalSpecVersion Source # 
Instance details

Defined in Distribution.CabalSpecVersion

Structured AbiTag Source # 
Instance details

Defined in Distribution.Compiler

Structured CompilerFlavor Source # 
Instance details

Defined in Distribution.Compiler

Structured CompilerId Source # 
Instance details

Defined in Distribution.Compiler

Structured License Source # 
Instance details

Defined in Distribution.License

Structured ModuleName Source # 
Instance details

Defined in Distribution.ModuleName

Structured License Source # 
Instance details

Defined in Distribution.SPDX.License

Structured LicenseExceptionId Source # 
Instance details

Defined in Distribution.SPDX.LicenseExceptionId

Structured LicenseExpression Source # 
Instance details

Defined in Distribution.SPDX.LicenseExpression

Structured SimpleLicenseExpression Source # 
Instance details

Defined in Distribution.SPDX.LicenseExpression

Structured LicenseId Source # 
Instance details

Defined in Distribution.SPDX.LicenseId

Structured LicenseRef Source # 
Instance details

Defined in Distribution.SPDX.LicenseReference

Structured Arch Source # 
Instance details

Defined in Distribution.System

Structured OS Source # 
Instance details

Defined in Distribution.System

Structured Platform Source # 
Instance details

Defined in Distribution.System

Structured AbiDependency Source # 
Instance details

Defined in Distribution.Types.AbiDependency

Structured AbiHash Source # 
Instance details

Defined in Distribution.Types.AbiHash

Structured Benchmark Source # 
Instance details

Defined in Distribution.Types.Benchmark

Structured BenchmarkInterface Source # 
Instance details

Defined in Distribution.Types.BenchmarkInterface

Structured BenchmarkType Source # 
Instance details

Defined in Distribution.Types.BenchmarkType

Structured BuildInfo Source # 
Instance details

Defined in Distribution.Types.BuildInfo

Structured BuildType Source # 
Instance details

Defined in Distribution.Types.BuildType

Structured Component Source # 
Instance details

Defined in Distribution.Types.Component

Structured ComponentId Source # 
Instance details

Defined in Distribution.Types.ComponentId

Structured ComponentName Source # 
Instance details

Defined in Distribution.Types.ComponentName

Structured ComponentRequestedSpec Source # 
Instance details

Defined in Distribution.Types.ComponentRequestedSpec

Structured ConfVar Source # 
Instance details

Defined in Distribution.Types.ConfVar

Structured Dependency Source # 
Instance details

Defined in Distribution.Types.Dependency

Structured ExeDependency Source # 
Instance details

Defined in Distribution.Types.ExeDependency

Structured Executable Source # 
Instance details

Defined in Distribution.Types.Executable

Structured ExecutableScope Source # 
Instance details

Defined in Distribution.Types.ExecutableScope

Structured ExposedModule Source # 
Instance details

Defined in Distribution.Types.ExposedModule

Structured FlagAssignment Source # 
Instance details

Defined in Distribution.Types.Flag

Structured FlagName Source # 
Instance details

Defined in Distribution.Types.Flag

Structured PackageFlag Source # 
Instance details

Defined in Distribution.Types.Flag

Structured ForeignLib Source # 
Instance details

Defined in Distribution.Types.ForeignLib

Structured LibVersionInfo Source # 
Instance details

Defined in Distribution.Types.ForeignLib

Structured ForeignLibOption Source # 
Instance details

Defined in Distribution.Types.ForeignLibOption

Structured ForeignLibType Source # 
Instance details

Defined in Distribution.Types.ForeignLibType

Structured GenericPackageDescription Source # 
Instance details

Defined in Distribution.Types.GenericPackageDescription

Structured IncludeRenaming Source # 
Instance details

Defined in Distribution.Types.IncludeRenaming

Structured InstalledPackageInfo Source # 
Instance details

Defined in Distribution.Types.InstalledPackageInfo

Structured LegacyExeDependency Source # 
Instance details

Defined in Distribution.Types.LegacyExeDependency

Structured Library Source # 
Instance details

Defined in Distribution.Types.Library

Structured LibraryName Source # 
Instance details

Defined in Distribution.Types.LibraryName

Structured LibraryVisibility Source # 
Instance details

Defined in Distribution.Types.LibraryVisibility

Structured Mixin Source # 
Instance details

Defined in Distribution.Types.Mixin

Structured Module Source # 
Instance details

Defined in Distribution.Types.Module

Structured ModuleReexport Source # 
Instance details

Defined in Distribution.Types.ModuleReexport

Structured ModuleRenaming Source # 
Instance details

Defined in Distribution.Types.ModuleRenaming

Structured MungedPackageId Source # 
Instance details

Defined in Distribution.Types.MungedPackageId

Structured MungedPackageName Source # 
Instance details

Defined in Distribution.Types.MungedPackageName

Structured PackageDescription Source # 
Instance details

Defined in Distribution.Types.PackageDescription

Structured PackageIdentifier Source # 
Instance details

Defined in Distribution.Types.PackageId

Structured PackageName Source # 
Instance details

Defined in Distribution.Types.PackageName

Structured PackageVersionConstraint Source # 
Instance details

Defined in Distribution.Types.PackageVersionConstraint

Structured PkgconfigDependency Source # 
Instance details

Defined in Distribution.Types.PkgconfigDependency

Structured PkgconfigName Source # 
Instance details

Defined in Distribution.Types.PkgconfigName

Structured PkgconfigVersion Source # 
Instance details

Defined in Distribution.Types.PkgconfigVersion

Structured PkgconfigVersionRange Source # 
Instance details

Defined in Distribution.Types.PkgconfigVersionRange

Structured SetupBuildInfo Source # 
Instance details

Defined in Distribution.Types.SetupBuildInfo

Structured KnownRepoType Source # 
Instance details

Defined in Distribution.Types.SourceRepo

Structured RepoKind Source # 
Instance details

Defined in Distribution.Types.SourceRepo

Structured RepoType Source # 
Instance details

Defined in Distribution.Types.SourceRepo

Structured SourceRepo Source # 
Instance details

Defined in Distribution.Types.SourceRepo

Structured TestSuite Source # 
Instance details

Defined in Distribution.Types.TestSuite

Structured TestSuiteInterface Source # 
Instance details

Defined in Distribution.Types.TestSuiteInterface

Structured TestType Source # 
Instance details

Defined in Distribution.Types.TestType

Structured DefUnitId Source # 
Instance details

Defined in Distribution.Types.UnitId

Structured UnitId Source # 
Instance details

Defined in Distribution.Types.UnitId

Structured UnqualComponentName Source # 
Instance details

Defined in Distribution.Types.UnqualComponentName

Structured Version Source # 
Instance details

Defined in Distribution.Types.Version

Structured VersionRange Source # 
Instance details

Defined in Distribution.Types.VersionRange.Internal

Structured ShortText Source # 
Instance details

Defined in Distribution.Utils.ShortText

Structured Extension Source # 
Instance details

Defined in Language.Haskell.Extension

Structured KnownExtension Source # 
Instance details

Defined in Language.Haskell.Extension

Structured Language Source # 
Instance details

Defined in Language.Haskell.Extension

Structured ByteString Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured ByteString Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured IntSet Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Int16 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Int32 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Int64 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Int8 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Word16 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Word32 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Word64 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Word8 Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Ordering Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Text Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Text Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Day Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured DiffTime Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured NominalDiffTime Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured UTCTime Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured UniversalTime Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured LocalTime Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured TimeOfDay Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured TimeZone Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Integer Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured () Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy () -> Structure Source #

structureHash' :: Tagged () MD5

Structured Bool Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Char Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Double Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Float Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Int Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured Word Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured a => Structured (Graph a) Source # 
Instance details

Defined in Distribution.Compat.Graph

Methods

structure :: Proxy (Graph a) -> Structure Source #

structureHash' :: Tagged (Graph a) MD5

Structured a => Structured (NonEmptySet a) Source # 
Instance details

Defined in Distribution.Compat.NonEmptySet

Structured a => Structured (Last' a) Source # 
Instance details

Defined in Distribution.Compat.Semigroup

Methods

structure :: Proxy (Last' a) -> Structure Source #

structureHash' :: Tagged (Last' a) MD5

Structured a => Structured (Option' a) Source # 
Instance details

Defined in Distribution.Compat.Semigroup

Structured a => Structured (PerCompilerFlavor a) Source # 
Instance details

Defined in Distribution.Compiler

Structured c => Structured (Condition c) Source # 
Instance details

Defined in Distribution.Types.Condition

Structured v => Structured (IntMap v) Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured v => Structured (Seq v) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy (Seq v) -> Structure Source #

structureHash' :: Tagged (Seq v) MD5

Structured k => Structured (Set k) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy (Set k) -> Structure Source #

structureHash' :: Tagged (Set k) MD5

Structured a => Structured (NonEmpty a) Source # 
Instance details

Defined in Distribution.Utils.Structured

Structured a => Structured (Ratio a) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy (Ratio a) -> Structure Source #

structureHash' :: Tagged (Ratio a) MD5

Structured a => Structured (Maybe a) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy (Maybe a) -> Structure Source #

structureHash' :: Tagged (Maybe a) MD5

Structured a => Structured [a] Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy [a] -> Structure Source #

structureHash' :: Tagged [a] MD5

(Structured k, Structured v) => Structured (Map k v) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy (Map k v) -> Structure Source #

structureHash' :: Tagged (Map k v) MD5

(Structured a, Structured b) => Structured (Either a b) Source # 
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) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy (a1, a2) -> Structure Source #

structureHash' :: Tagged (a1, a2) MD5

(Structured v, Structured c, Structured a) => Structured (CondBranch v c a) Source # 
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) Source # 
Instance details

Defined in Distribution.Types.CondTree

Methods

structure :: Proxy (CondTree v c a) -> Structure Source #

structureHash' :: Tagged (CondTree v c a) MD5

(Typeable allowAbsolute, Typeable from, Typeable to) => Structured (SymbolicPathX allowAbsolute from to) Source # 
Instance details

Defined in Distribution.Utils.Path

Methods

structure :: Proxy (SymbolicPathX allowAbsolute from to) -> Structure Source #

structureHash' :: Tagged (SymbolicPathX allowAbsolute from to) MD5

(Structured a1, Structured a2, Structured a3) => Structured (a1, a2, a3) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

structure :: Proxy (a1, a2, a3) -> Structure Source #

structureHash' :: Tagged (a1, a2, a3) MD5

(Structured a1, Structured a2, Structured a3, Structured a4) => Structured (a1, a2, a3, a4) Source # 
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) Source # 
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) Source # 
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) Source # 
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

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 TypeReps, and put just TypeRep name when it's occurred another time.

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

Derive structure generically.

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) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

gstructured :: TypeRep -> Proxy (M1 i c f) -> TypeVersion -> Structure

nominalStructure :: forall {k} (a :: k). Typeable a => Proxy a -> Structure Source #

Use Typeable to infer name

containerStructure :: forall {k} (f :: Type -> k) 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 TypeReps 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
Generic Structure Source # 
Instance details

Defined in Distribution.Utils.Structured

Associated Types

type Rep Structure 
Instance details

Defined in Distribution.Utils.Structured

type Rep Structure = D1 ('MetaData "Structure" "Distribution.Utils.Structured" "Cabal-syntax-3.14.0.0-395c" '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)))))
Show Structure Source # 
Instance details

Defined in Distribution.Utils.Structured

Eq Structure Source # 
Instance details

Defined in Distribution.Utils.Structured

Ord Structure Source # 
Instance details

Defined in Distribution.Utils.Structured

type Rep Structure Source # 
Instance details

Defined in Distribution.Utils.Structured

type Rep Structure = D1 ('MetaData "Structure" "Distribution.Utils.Structured" "Cabal-syntax-3.14.0.0-395c" '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)))))

data Tag (a :: k) Source #

Constructors

Tag 

Instances

Instances details
Structured a => Binary (Tag a) Source # 
Instance details

Defined in Distribution.Utils.Structured

Methods

put :: Tag a -> Put Source #

get :: Get (Tag a) Source #

putList :: [Tag a] -> Put Source #

type TypeVersion = Word32 Source #

A semantic version of a data type. Usually 0.

hashStructure :: Structure -> MD5 Source #

A MD5 hash digest of Structure.

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

A van-Laarhoven lens into TypeName of Structure

typeName :: Lens' Structure TypeName