| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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))
- data Chunk = Alphanum !Text
- newtype Release = Release (NonEmpty Chunk)
- data SemVer = SemVer {}
- prettySemVer :: SemVer -> Text
- 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 :: (VisualStream s, TraversableStream 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
| Monoid PkgRevDeps Source # | |
Defined in Futhark.Pkg.Types Methods mempty :: PkgRevDeps Source # mappend :: PkgRevDeps -> PkgRevDeps -> PkgRevDeps Source # mconcat :: [PkgRevDeps] -> PkgRevDeps Source # | |
| Semigroup PkgRevDeps Source # | |
Defined in Futhark.Pkg.Types Methods (<>) :: PkgRevDeps -> PkgRevDeps -> PkgRevDeps Source # sconcat :: NonEmpty PkgRevDeps -> PkgRevDeps Source # stimes :: Integral b => b -> PkgRevDeps -> PkgRevDeps Source # | |
| Show PkgRevDeps Source # | |
Defined in Futhark.Pkg.Types | |
Instances
| NFData Chunk | |||||
Defined in Data.Versions | |||||
| Data Chunk | |||||
Defined in Data.Versions Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Chunk -> c Chunk Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Chunk Source # toConstr :: Chunk -> Constr Source # dataTypeOf :: Chunk -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Chunk) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Chunk) Source # gmapT :: (forall b. Data b => b -> b) -> Chunk -> Chunk Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Chunk -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Chunk -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Chunk -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Chunk -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Chunk -> m Chunk Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Chunk -> m Chunk Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Chunk -> m Chunk Source # | |||||
| Generic Chunk | |||||
Defined in Data.Versions Associated Types
| |||||
| Read Chunk | |||||
| Show Chunk | |||||
| Eq Chunk | |||||
| Hashable Chunk | |||||
Defined in Data.Versions | |||||
| Lift Chunk | |||||
| type Rep Chunk | |||||
Defined in Data.Versions type Rep Chunk = D1 ('MetaData "Chunk" "Data.Versions" "versions-6.0.8-8010jVc99ZXG8EKUxZ72J4" 'False) (C1 ('MetaCons "Numeric" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word)) :+: C1 ('MetaCons "Alphanum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))) | |||||
Instances
| NFData Release | |
Defined in Data.Versions | |
| Data Release | |
Defined in Data.Versions Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Release -> c Release Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Release Source # toConstr :: Release -> Constr Source # dataTypeOf :: Release -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Release) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Release) Source # gmapT :: (forall b. Data b => b -> b) -> Release -> Release Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Release -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Release -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Release -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Release -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Release -> m Release Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Release -> m Release Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Release -> m Release Source # | |
| Generic Release | |
Defined in Data.Versions | |
| Read Release | |
| Show Release | |
| Eq Release | |
| Ord Release | |
| Hashable Release | |
Defined in Data.Versions | |
| Lift Release | |
| type Rep Release | |
Constructors
| SemVer | |
Instances
prettySemVer :: SemVer -> 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
| Show PkgManifest Source # | |
Defined in Futhark.Pkg.Types | |
| Eq PkgManifest Source # | |
Defined in Futhark.Pkg.Types Methods (==) :: PkgManifest -> PkgManifest -> Bool Source # (/=) :: PkgManifest -> PkgManifest -> Bool Source # | |
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 Source # foldMap :: Monoid m => (a -> m) -> Commented a -> m Source # foldMap' :: Monoid m => (a -> m) -> Commented a -> m Source # foldr :: (a -> b -> b) -> b -> Commented a -> b Source # foldr' :: (a -> b -> b) -> b -> Commented a -> b Source # foldl :: (b -> a -> b) -> b -> Commented a -> b Source # foldl' :: (b -> a -> b) -> b -> Commented a -> b Source # foldr1 :: (a -> a -> a) -> Commented a -> a Source # foldl1 :: (a -> a -> a) -> Commented a -> a Source # toList :: Commented a -> [a] Source # null :: Commented a -> Bool Source # length :: Commented a -> Int Source # elem :: Eq a => a -> Commented a -> Bool Source # maximum :: Ord a => Commented a -> a Source # minimum :: Ord a => Commented a -> a Source # | |
| Traversable Commented Source # | |
Defined in Futhark.Pkg.Types Methods traverse :: Applicative f => (a -> f b) -> Commented a -> f (Commented b) Source # sequenceA :: Applicative f => Commented (f a) -> f (Commented a) Source # mapM :: Monad m => (a -> m b) -> Commented a -> m (Commented b) Source # sequence :: Monad m => Commented (m a) -> m (Commented a) Source # | |
| Show a => Show (Commented a) Source # | |
| Eq a => Eq (Commented a) Source # | |
An entry in the required section of a futhark.pkg file.
Constructors
| Required | |
Fields
| |
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 #
Parse a pretty as a PkgManifest. The FilePath is used for any error messages.
parsePkgManifestFromFile :: FilePath -> IO PkgManifest Source #
Read contents of file and pass it to parsePkgManifest.
errorBundlePretty :: (VisualStream s, TraversableStream 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.