Skip to content

Instantly share code, notes, and snippets.

@Gabriella439
Created April 7, 2018 02:45
Show Gist options
  • Save Gabriella439/81855ec23c679e23e556a3cdad7757cd to your computer and use it in GitHub Desktop.
Save Gabriella439/81855ec23c679e23e556a3cdad7757cd to your computer and use it in GitHub Desktop.
The Cabal file format encoded as a Dhall type
let Version = ∀(Version : Type) → ∀(v : Text → Version) → Version
in let VersionRange =
∀(VersionRange : Type)
→ ∀(anyVersion : VersionRange)
→ ∀(noVersion : VersionRange)
→ ∀(thisVersion : Version → VersionRange)
→ ∀(notThisVersion : Version → VersionRange)
→ ∀(laterVersion : Version → VersionRange)
→ ∀(earlierVersion : Version → VersionRange)
→ ∀(orLaterVersion : Version → VersionRange)
→ ∀(orEarlierVersion : Version → VersionRange)
→ ∀(withinVersion : Version → VersionRange)
→ ∀(majorBoundVersion : Version → VersionRange)
→ ∀(unionVersionRanges : VersionRange → VersionRange → VersionRange)
→ ∀ ( intersectVersionRanges
: VersionRange → VersionRange → VersionRange
)
→ ∀ ( differenceVersionRanges
: VersionRange → VersionRange → VersionRange
)
→ ∀(invertVersionRange : VersionRange → VersionRange)
→ VersionRange
in let BuildType =
< Configure :
{}
| Custom :
{}
| Make :
{}
| Simple :
{}
| UnknownBuildType :
{ _1 : Text }
>
in let License =
< AGPL :
Optional Version
| AllRightsReserved :
{}
| Apache :
Optional Version
| BSD2 :
{}
| BSD3 :
{}
| BSD4 :
{}
| GPL :
Optional Version
| ISC :
{}
| LGPL :
Optional Version
| MIT :
{}
| MPL :
Version
| Other :
{}
| PublicDomain :
{}
| Unspecified :
{}
>
in let Language =
< Haskell2010 :
{}
| Haskell98 :
{}
| UnknownLanguage :
{ _1 : Text }
>
in let Arch =
< Alpha :
{}
| Arm :
{}
| Hppa :
{}
| I386 :
{}
| IA64 :
{}
| JavaScript :
{}
| M68k :
{}
| Mips :
{}
| OtherArch :
{ _1 : Text }
| PPC :
{}
| PPC64 :
{}
| Rs6000 :
{}
| S390 :
{}
| SH :
{}
| Sparc :
{}
| Vax :
{}
| X86_64 :
{}
>
in let CompilerOptions =
{ GHC :
List Text
, GHCJS :
List Text
, HBC :
List Text
, Helium :
List Text
, Hugs :
List Text
, JHC :
List Text
, LHC :
List Text
, NHC :
List Text
, UHC :
List Text
, YHC :
List Text
}
in let Extension =
< AllowAmbiguousTypes :
Bool
| ApplicativeDo :
Bool
| Arrows :
Bool
| AutoDeriveTypeable :
Bool
| BangPatterns :
Bool
| BinaryLiterals :
Bool
| CApiFFI :
Bool
| CPP :
Bool
| ConstrainedClassMethods :
Bool
| ConstraintKinds :
Bool
| DataKinds :
Bool
| DatatypeContexts :
Bool
| DefaultSignatures :
Bool
| DeriveAnyClass :
Bool
| DeriveDataTypeable :
Bool
| DeriveFoldable :
Bool
| DeriveFunctor :
Bool
| DeriveGeneric :
Bool
| DeriveLift :
Bool
| DeriveTraversable :
Bool
| DisambiguateRecordFields :
Bool
| DoAndIfThenElse :
Bool
| DoRec :
Bool
| DuplicateRecordFields :
Bool
| EmptyCase :
Bool
| EmptyDataDecls :
Bool
| ExistentialQuantification :
Bool
| ExplicitForAll :
Bool
| ExplicitNamespaces :
Bool
| ExtendedDefaultRules :
Bool
| ExtensibleRecords :
Bool
| FlexibleContexts :
Bool
| FlexibleInstances :
Bool
| ForeignFunctionInterface :
Bool
| FunctionalDependencies :
Bool
| GADTSyntax :
Bool
| GADTs :
Bool
| GHCForeignImportPrim :
Bool
| GeneralizedNewtypeDeriving :
Bool
| Generics :
Bool
| HereDocuments :
Bool
| ImplicitParams :
Bool
| ImplicitPrelude :
Bool
| ImpredicativeTypes :
Bool
| IncoherentInstances :
Bool
| InstanceSigs :
Bool
| InterruptibleFFI :
Bool
| JavaScriptFFI :
Bool
| KindSignatures :
Bool
| LambdaCase :
Bool
| LiberalTypeSynonyms :
Bool
| MagicHash :
Bool
| MonadComprehensions :
Bool
| MonadFailDesugaring :
Bool
| MonoLocalBinds :
Bool
| MonoPatBinds :
Bool
| MonomorphismRestriction :
Bool
| MultiParamTypeClasses :
Bool
| MultiWayIf :
Bool
| NPlusKPatterns :
Bool
| NamedFieldPuns :
Bool
| NamedWildCards :
Bool
| NegativeLiterals :
Bool
| NewQualifiedOperators :
Bool
| NondecreasingIndentation :
Bool
| NullaryTypeClasses :
Bool
| NumDecimals :
Bool
| OverlappingInstances :
Bool
| OverloadedLabels :
Bool
| OverloadedLists :
Bool
| OverloadedStrings :
Bool
| PackageImports :
Bool
| ParallelArrays :
Bool
| ParallelListComp :
Bool
| PartialTypeSignatures :
Bool
| PatternGuards :
Bool
| PatternSignatures :
Bool
| PatternSynonyms :
Bool
| PolyKinds :
Bool
| PolymorphicComponents :
Bool
| PostfixOperators :
Bool
| QuasiQuotes :
Bool
| Rank2Types :
Bool
| RankNTypes :
Bool
| RebindableSyntax :
Bool
| RecordPuns :
Bool
| RecordWildCards :
Bool
| RecursiveDo :
Bool
| RegularPatterns :
Bool
| RelaxedPolyRec :
Bool
| RestrictedTypeSynonyms :
Bool
| RoleAnnotations :
Bool
| Safe :
Bool
| SafeImports :
Bool
| ScopedTypeVariables :
Bool
| StandaloneDeriving :
Bool
| StaticPointers :
Bool
| Strict :
Bool
| StrictData :
Bool
| TemplateHaskell :
Bool
| TemplateHaskellQuotes :
Bool
| TraditionalRecordSyntax :
Bool
| TransformListComp :
Bool
| Trustworthy :
Bool
| TupleSections :
Bool
| TypeApplications :
Bool
| TypeFamilies :
Bool
| TypeFamilyDependencies :
Bool
| TypeInType :
Bool
| TypeOperators :
Bool
| TypeSynonymInstances :
Bool
| UnboxedTuples :
Bool
| UndecidableInstances :
Bool
| UndecidableSuperClasses :
Bool
| UnicodeSyntax :
Bool
| UnliftedFFITypes :
Bool
| Unsafe :
Bool
| ViewPatterns :
Bool
| XmlSyntax :
Bool
>
in let OS =
< AIX :
{}
| Android :
{}
| DragonFly :
{}
| FreeBSD :
{}
| Ghcjs :
{}
| HPUX :
{}
| HaLVM :
{}
| Hurd :
{}
| IOS :
{}
| IRIX :
{}
| Linux :
{}
| NetBSD :
{}
| OSX :
{}
| OpenBSD :
{}
| OtherOS :
{ _1 : Text }
| Solaris :
{}
| Windows :
{}
>
in let Compiler =
< GHC :
{}
| GHCJS :
{}
| HBC :
{}
| HaskellSuite :
{ _1 : Text }
| Helium :
{}
| Hugs :
{}
| JHC :
{}
| LHC :
{}
| NHC :
{}
| OtherCompiler :
{ _1 : Text }
| UHC :
{}
| YHC :
{}
>
in let RepoKind =
< RepoHead : {} | RepoKindUnknown : { _1 : Text } | RepoThis : {} >
in let RepoType =
< Bazaar :
{}
| CVS :
{}
| Darcs :
{}
| Git :
{}
| GnuArch :
{}
| Mercurial :
{}
| Monotone :
{}
| OtherRepoType :
{ _1 : Text }
| SVN :
{}
>
in let SourceRepo =
{ branch :
Optional Text
, kind :
RepoKind
, location :
Optional Text
, module :
Optional Text
, subdir :
Optional Text
, tag :
Optional Text
, type :
Optional RepoType
}
in let Config =
{ os :
OS → Bool
, arch :
Arch → Bool
, flag :
Text → Bool
, impl :
Compiler → VersionRange → Bool
}
in let TestSuite =
{ autogen-modules :
List Text
, build-depends :
List { bounds : VersionRange, package : Text }
, build-tool-depends :
List { component : Text, package : Text, version : VersionRange }
, build-tools :
List { exe : Text, version : VersionRange }
, buildable :
Bool
, c-sources :
List Text
, cc-options :
List Text
, compiler-options :
CompilerOptions
, cpp-options :
List Text
, default-extensions :
List Extension
, default-language :
Optional Language
, extra-framework-dirs :
List Text
, extra-ghci-libraries :
List Text
, extra-lib-dirs :
List Text
, extra-libraries :
List Text
, frameworks :
List Text
, hs-source-dirs :
List Text
, include-dirs :
List Text
, includes :
List Text
, install-includes :
List Text
, js-sources :
List Text
, ld-options :
List Text
, mixins :
List
{ package :
Text
, renaming :
{ provides :
List { rename : Text, to : Text }
, requires :
List { rename : Text, to : Text }
}
}
, other-extensions :
List Extension
, other-languages :
List Language
, other-modules :
List Text
, pkgconfig-depends :
List { name : Text, version : VersionRange }
, profiling-options :
CompilerOptions
, shared-options :
CompilerOptions
, type :
< detailed :
{ module : Text }
| exitcode-stdio :
{ main-is : Text }
>
}
in let Benchmark =
{ autogen-modules :
List Text
, build-depends :
List { bounds : VersionRange, package : Text }
, build-tool-depends :
List { component : Text, package : Text, version : VersionRange }
, build-tools :
List { exe : Text, version : VersionRange }
, buildable :
Bool
, c-sources :
List Text
, cc-options :
List Text
, compiler-options :
CompilerOptions
, cpp-options :
List Text
, default-extensions :
List Extension
, default-language :
Optional Language
, extra-framework-dirs :
List Text
, extra-ghci-libraries :
List Text
, extra-lib-dirs :
List Text
, extra-libraries :
List Text
, frameworks :
List Text
, hs-source-dirs :
List Text
, include-dirs :
List Text
, includes :
List Text
, install-includes :
List Text
, js-sources :
List Text
, ld-options :
List Text
, main-is :
Text
, mixins :
List
{ package :
Text
, renaming :
{ provides :
List { rename : Text, to : Text }
, requires :
List { rename : Text, to : Text }
}
}
, other-extensions :
List Extension
, other-languages :
List Language
, other-modules :
List Text
, pkgconfig-depends :
List { name : Text, version : VersionRange }
, profiling-options :
CompilerOptions
, shared-options :
CompilerOptions
}
in let Executable =
{ autogen-modules :
List Text
, build-depends :
List { bounds : VersionRange, package : Text }
, build-tool-depends :
List { component : Text, package : Text, version : VersionRange }
, build-tools :
List { exe : Text, version : VersionRange }
, buildable :
Bool
, c-sources :
List Text
, cc-options :
List Text
, compiler-options :
CompilerOptions
, cpp-options :
List Text
, default-extensions :
List Extension
, default-language :
Optional Language
, extra-framework-dirs :
List Text
, extra-ghci-libraries :
List Text
, extra-lib-dirs :
List Text
, extra-libraries :
List Text
, frameworks :
List Text
, hs-source-dirs :
List Text
, include-dirs :
List Text
, includes :
List Text
, install-includes :
List Text
, js-sources :
List Text
, ld-options :
List Text
, main-is :
Text
, mixins :
List
{ package :
Text
, renaming :
{ provides :
List { rename : Text, to : Text }
, requires :
List { rename : Text, to : Text }
}
}
, other-extensions :
List Extension
, other-languages :
List Language
, other-modules :
List Text
, pkgconfig-depends :
List { name : Text, version : VersionRange }
, profiling-options :
CompilerOptions
, scope :
< Private : {} | Public : {} >
, shared-options :
CompilerOptions
}
in let ForeignLibrary =
{ autogen-modules :
List Text
, build-depends :
List { bounds : VersionRange, package : Text }
, build-tool-depends :
List { component : Text, package : Text, version : VersionRange }
, build-tools :
List { exe : Text, version : VersionRange }
, buildable :
Bool
, c-sources :
List Text
, cc-options :
List Text
, compiler-options :
CompilerOptions
, cpp-options :
List Text
, default-extensions :
List Extension
, default-language :
Optional Language
, extra-framework-dirs :
List Text
, extra-ghci-libraries :
List Text
, extra-lib-dirs :
List Text
, extra-libraries :
List Text
, frameworks :
List Text
, hs-source-dirs :
List Text
, include-dirs :
List Text
, includes :
List Text
, install-includes :
List Text
, js-sources :
List Text
, ld-options :
List Text
, lib-version-info :
Optional { age : Natural, current : Natural, revision : Natural }
, lib-version-linux :
Optional Version
, mixins :
List
{ package :
Text
, renaming :
{ provides :
List { rename : Text, to : Text }
, requires :
List { rename : Text, to : Text }
}
}
, mod-def-files :
List Text
, options :
List < Standalone : {} >
, other-extensions :
List Extension
, other-languages :
List Language
, other-modules :
List Text
, pkgconfig-depends :
List { name : Text, version : VersionRange }
, profiling-options :
CompilerOptions
, shared-options :
CompilerOptions
, type :
< Shared : {} | Static : {} >
}
in let Library =
{ autogen-modules :
List Text
, build-depends :
List { bounds : VersionRange, package : Text }
, build-tool-depends :
List { component : Text, package : Text, version : VersionRange }
, build-tools :
List { exe : Text, version : VersionRange }
, buildable :
Bool
, c-sources :
List Text
, cc-options :
List Text
, compiler-options :
CompilerOptions
, cpp-options :
List Text
, default-extensions :
List Extension
, default-language :
Optional Language
, exposed-modules :
List Text
, extra-framework-dirs :
List Text
, extra-ghci-libraries :
List Text
, extra-lib-dirs :
List Text
, extra-libraries :
List Text
, frameworks :
List Text
, hs-source-dirs :
List Text
, include-dirs :
List Text
, includes :
List Text
, install-includes :
List Text
, js-sources :
List Text
, ld-options :
List Text
, mixins :
List
{ package :
Text
, renaming :
{ provides :
List { rename : Text, to : Text }
, requires :
List { rename : Text, to : Text }
}
}
, other-extensions :
List Extension
, other-languages :
List Language
, other-modules :
List Text
, pkgconfig-depends :
List { name : Text, version : VersionRange }
, profiling-options :
CompilerOptions
, reexported-modules :
List
{ name :
Text
, original :
{ name : Text, package : Optional Text }
}
, shared-options :
CompilerOptions
, signatures :
List Text
}
in { author :
Text
, benchmarks :
List { benchmark : Config → Benchmark, name : Text }
, bug-reports :
Text
, build-type :
Optional BuildType
, cabal-version :
Version
, category :
Text
, copyright :
Text
, custom-setup :
Optional
{ setup-depends : List { bounds : VersionRange, package : Text } }
, data-dir :
Text
, data-files :
List Text
, description :
Text
, executables :
List { executable : Config → Executable, name : Text }
, extra-doc-files :
List Text
, extra-source-files :
List Text
, extra-tmp-files :
List Text
, flags :
List { default : Bool, description : Text, manual : Bool, name : Text }
, foreign-libraries :
List { foreign-lib : Config → ForeignLibrary, name : Text }
, homepage :
Text
, library :
Optional (Config → Library)
, license :
License
, license-files :
List Text
, maintainer :
Text
, name :
Text
, package-url :
Text
, source-repos :
List SourceRepo
, stability :
Text
, sub-libraries :
List { library : Config → Library, name : Text }
, synopsis :
Text
, test-suites :
List { name : Text, test-suite : Config → TestSuite }
, tested-with :
List { compiler : Compiler, version : VersionRange }
, version :
Version
, x-fields :
List { _1 : Text, _2 : Text }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment