| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Ecosystem
Description
The ecosystem tag.
Ecosystem is the shared vocabulary the rest of the system dispatches on: the
package vocabulary (Ecluse.Package) records it in a PackageName, the version
engine (Ecluse.Version) selects a per-ecosystem parser by it, the registry
adapters (later) are chosen by it, and configuration both keys a mount by it
and derives that mount's path prefix from it (prefixFor).
It lives in its own small module on purpose. It is a stable shared type imported
by several areas, and keeping it here breaks what would otherwise be an import
cycle between Ecluse.Package (whose PackageDetails holds a Version) and
Ecluse.Version (whose parsers dispatch on the ecosystem) — exactly the
.Types-style extraction sanctioned by STYLE.md → "Module organization".
Documentation
The package ecosystem an identity, version, or snapshot belongs to.
Instances
| Show Ecosystem Source # | |
| Eq Ecosystem Source # | |
| Ord Ecosystem Source # | |
ecosystemName :: Ecosystem -> Text Source #
The canonical wire/config name of an ecosystem — the key a mounts object
is written under and the inverse of parseEcosystem.
>>>ecosystemName Npm"npm"
parseEcosystem :: Text -> Maybe Ecosystem Source #
Parse an Ecosystem from its wire name, Nothing for one the build does not
serve. Used to decode the config document's mounts keys, where an unknown key is
rejected loudly rather than skipped (see Ecluse.Config).
>>>parseEcosystem "npm"Just Npm
>>>parseEcosystem "cargo"Nothing
prefixFor :: Ecosystem -> NonEmpty Text Source #
The path prefix a mount serves under, derived from its ecosystem (npm →
/npm, PyPI → /pypi) and never operator-configured, so a prefix can neither
collide nor be mistyped (see docs/architecture/hosting.md → Mounts). A
NonEmpty list of path segments: every registry is path-mounted, so a root mount
is unrepresentable.
>>>prefixFor Npm"npm" :| []