| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Futhark.Pkg.Types
Description
Types (and a few other simple definitions) for futhark-pkg.
Synopsis
- type PkgPath = Text
- pkgPathFilePath :: PkgPath -> FilePath
- newtype PkgRevDeps = PkgRevDeps (Map PkgPath (SemVer, Maybe Text))
- prettySemVer :: SemVer -> Text
- semver :: Text -> Either ParsingError SemVer
- data SemVer = SemVer {}
- data VUnit
- commitVersion :: Text -> Text -> SemVer
- isCommitVersion :: SemVer -> Maybe Text
- parseVersion :: Text -> Either (ParseErrorBundle Text Void) SemVer
- data PkgManifest = PkgManifest {}
- newPkgManifest :: Maybe PkgPath -> PkgManifest
- pkgRevDeps :: PkgManifest -> PkgRevDeps
- pkgDir :: PkgManifest -> Maybe FilePath
- addRequiredToManifest :: Required -> PkgManifest -> (PkgManifest, Maybe Required)
- removeRequiredFromManifest :: PkgPath -> PkgManifest -> Maybe (PkgManifest, Required)
- prettyPkgManifest :: PkgManifest -> Text
- type Comment = Text
- data Commented a = Commented {}
- data Required = Required {}
- futharkPkg :: FilePath
- parsePkgManifest :: FilePath -> Text -> Either (ParseErrorBundle Text Void) PkgManifest
- parsePkgManifestFromFile :: FilePath -> IO PkgManifest
- errorBundlePretty :: (Stream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
- newtype BuildList = BuildList {}
- prettyBuildList :: BuildList -> Text
Documentation
A package path is a unique identifier for a package, for example
github.comuserfoo.
pkgPathFilePath :: PkgPath -> FilePath Source #
Turn a package path (which always uses forward slashes) into a file path in the local file system (which might use different slashes).
newtype PkgRevDeps Source #
The dependencies of a (revision of a) package is a mapping from package paths to minimum versions (and an optional hash pinning).
Instances
| Show PkgRevDeps Source # | |
Defined in Futhark.Pkg.Types Methods showsPrec :: Int -> PkgRevDeps -> ShowS # show :: PkgRevDeps -> String # showList :: [PkgRevDeps] -> ShowS # | |
| Semigroup PkgRevDeps Source # | |
Defined in Futhark.Pkg.Types Methods (<>) :: PkgRevDeps -> PkgRevDeps -> PkgRevDeps # sconcat :: NonEmpty PkgRevDeps -> PkgRevDeps # stimes :: Integral b => b -> PkgRevDeps -> PkgRevDeps # | |
| Monoid PkgRevDeps Source # | |
Defined in Futhark.Pkg.Types Methods mempty :: PkgRevDeps # mappend :: PkgRevDeps -> PkgRevDeps -> PkgRevDeps # mconcat :: [PkgRevDeps] -> PkgRevDeps # | |
prettySemVer :: SemVer -> Text #
Constructors
| SemVer | |
Instances
| Eq SemVer | |
| Ord SemVer | |
| Show SemVer | |
| Generic SemVer | |
| Semigroup SemVer | |
| Monoid SemVer | |
| NFData SemVer | |
Defined in Data.Versions | |
| Semantic SemVer | |
| Hashable SemVer | |
Defined in Data.Versions | |
| type Rep SemVer | |
Defined in Data.Versions type Rep SemVer = D1 ('MetaData "SemVer" "Data.Versions" "versions-3.5.3-50c8623388aa42e0f827054c1ecdeac6ac77a2668b7c13806d207be2bd75e84b" 'False) (C1 ('MetaCons "SemVer" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_svMajor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "_svMinor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :*: (S1 ('MetaSel ('Just "_svPatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "_svPreRel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [VChunk]) :*: S1 ('MetaSel ('Just "_svMeta") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [VChunk]))))) | |
Instances
| Eq VUnit | |
| Ord VUnit | |
| Read VUnit | |
| Show VUnit | |
| Generic VUnit | |
| Semigroup VUnit | |
| Monoid VUnit | |
| NFData VUnit | |
Defined in Data.Versions | |
| Hashable VUnit | |
Defined in Data.Versions | |
| type Rep VUnit | |
Defined in Data.Versions type Rep VUnit = D1 ('MetaData "VUnit" "Data.Versions" "versions-3.5.3-50c8623388aa42e0f827054c1ecdeac6ac77a2668b7c13806d207be2bd75e84b" 'False) (C1 ('MetaCons "Digits" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: C1 ('MetaCons "Str" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) | |
Versions
commitVersion :: Text -> Text -> SemVer Source #
commitVersion timestamp commit constructs a commit version.
isCommitVersion :: SemVer -> Maybe Text Source #
Versions of the form (0,0,0)-timestamp+hash are treated
specially, as a reference to the commit identified uniquely with
hash (typically the Git commit ID). This function detects such
versions.
parseVersion :: Text -> Either (ParseErrorBundle Text Void) SemVer Source #
Unfortunately, Data.Versions has a buggy semver parser that collapses consecutive zeroes in the metadata field. So, we define our own parser here. It's a little simpler too, since we don't need full semver.
Package manifests
data PkgManifest Source #
A structure corresponding to a futhark.pkg file, including
comments. It is an invariant that duplicate required packages do
not occcur (the parser will verify this).
Constructors
| PkgManifest | |
Fields
| |
Instances
| Eq PkgManifest Source # | |
Defined in Futhark.Pkg.Types | |
| Show PkgManifest Source # | |
Defined in Futhark.Pkg.Types Methods showsPrec :: Int -> PkgManifest -> ShowS # show :: PkgManifest -> String # showList :: [PkgManifest] -> ShowS # | |
newPkgManifest :: Maybe PkgPath -> PkgManifest Source #
Possibly given a package path, construct an otherwise-empty manifest file.
pkgRevDeps :: PkgManifest -> PkgRevDeps Source #
The required packages listed in a package manifest.
pkgDir :: PkgManifest -> Maybe FilePath Source #
Where in the corresponding repository archive we can expect to find the package files.
addRequiredToManifest :: Required -> PkgManifest -> (PkgManifest, Maybe Required) Source #
Add new required package to the package manifest. If the package was already present, return the old version.
removeRequiredFromManifest :: PkgPath -> PkgManifest -> Maybe (PkgManifest, Required) Source #
prettyPkgManifest :: PkgManifest -> Text Source #
Prettyprint a package manifest such that it can be written to a
futhark.pkg file.
Wraps a value with an annotation of preceding line comments.
This is important to our goal of being able to programmatically
modify the futhark.pkg file while keeping comments intact.
Instances
| Functor Commented Source # | |
| Foldable Commented Source # | |
Defined in Futhark.Pkg.Types Methods fold :: Monoid m => Commented m -> m # foldMap :: Monoid m => (a -> m) -> Commented a -> m # foldMap' :: Monoid m => (a -> m) -> Commented a -> m # foldr :: (a -> b -> b) -> b -> Commented a -> b # foldr' :: (a -> b -> b) -> b -> Commented a -> b # foldl :: (b -> a -> b) -> b -> Commented a -> b # foldl' :: (b -> a -> b) -> b -> Commented a -> b # foldr1 :: (a -> a -> a) -> Commented a -> a # foldl1 :: (a -> a -> a) -> Commented a -> a # toList :: Commented a -> [a] # length :: Commented a -> Int # elem :: Eq a => a -> Commented a -> Bool # maximum :: Ord a => Commented a -> a # minimum :: Ord a => Commented a -> a # | |
| Traversable Commented Source # | |
Defined in Futhark.Pkg.Types | |
| Eq a => Eq (Commented a) Source # | |
| Show a => Show (Commented a) Source # | |
An entry in the required section of a futhark.pkg file.
Constructors
| Required | |
Fields
| |
Instances
futharkPkg :: FilePath Source #
The name of the file containing the futhark-pkg manifest.
Parsing package manifests
parsePkgManifest :: FilePath -> Text -> Either (ParseErrorBundle Text Void) PkgManifest Source #
errorBundlePretty :: (Stream s, ShowErrorComponent e) => ParseErrorBundle s e -> String #
Build list
A mapping from package paths to their chosen revisions. This is the result of the version solver.
Constructors
| BuildList | |
Fields | |
prettyBuildList :: BuildList -> Text Source #
Prettyprint a build list; one package per line and newline-terminated.