futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | None
Language | GHC2021

Futhark.Pkg.Info

Contents

- Package info
- Package registry

Description

Obtaining information about packages over THE INTERNET!

Synopsis

- data PkgInfo (m :: Type -> Type) = PkgInfo {
  - pkgVersions :: Map SemVer (PkgRevInfo m)
  - pkgLookupCommit :: Maybe Text -> m (PkgRevInfo m)
  }
- lookupPkgRev :: forall (m :: Type -> Type). SemVer -> PkgInfo m -> Maybe (PkgRevInfo m)
- pkgInfo :: (MonadIO m, MonadLogger m, MonadFail m) => CacheDir -> PkgPath -> m (PkgInfo m)
- data PkgRevInfo (m :: Type -> Type) = PkgRevInfo {
  - pkgGetFiles :: GetFiles m
  - pkgRevCommit :: Text
  - pkgRevGetManifest :: GetManifest m
  - pkgRevTime :: UTCTime
  }
- data GetManifest (m :: Type -> Type)
- data GetFiles (m :: Type -> Type)
- newtype CacheDir = CacheDir FilePath
- data PkgRegistry (m :: Type -> Type)
- class (MonadIO m, MonadLogger m, MonadFail m) => MonadPkgRegistry (m :: Type -> Type) where
  - getPkgRegistry :: m (PkgRegistry m)
  - putPkgRegistry :: PkgRegistry m -> m ()
  - modifyPkgRegistry :: (PkgRegistry m -> PkgRegistry m) -> m ()
- lookupPackage :: MonadPkgRegistry m => CacheDir -> PkgPath -> m (PkgInfo m)
- lookupPackageRev :: MonadPkgRegistry m => CacheDir -> PkgPath -> SemVer -> m (PkgRevInfo m)
- lookupNewestRev :: MonadPkgRegistry m => CacheDir -> PkgPath -> m SemVer

# Package info

data PkgInfo (m :: Type -> Type) Source #

Information about a package. The name of the package is stored separately.

Constructors

PkgInfo |

Fields

- pkgVersions :: Map SemVer (PkgRevInfo m)
- pkgLookupCommit :: Maybe Text -> m (PkgRevInfo m)

  Look up information about a specific commit, or HEAD in case of Nothing.

lookupPkgRev :: forall (m :: Type -> Type). SemVer -> PkgInfo m -> Maybe (PkgRevInfo m) Source #

Lookup information about a given version of a package.

pkgInfo :: (MonadIO m, MonadLogger m, MonadFail m) => CacheDir -> PkgPath -> m (PkgInfo m) Source #

Retrieve information about a package based on its package path. This uses Semantic Import Versioning when interacting with repositories. For example, a package `github.comuserrepo` will match version 0.* or 1.* tags only, a package `github.comuserrepo/v2` will match 2.* tags, and so forth..

data PkgRevInfo (m :: Type -> Type) Source #

Information about a version of a single package. The version number is stored separately.

Constructors

PkgRevInfo |

Fields

- pkgGetFiles :: GetFiles m
- pkgRevCommit :: Text

  The commit ID can be used for verification ("freezing"), by storing what it was at the time this version was last selected.

- pkgRevGetManifest :: GetManifest m
- pkgRevTime :: UTCTime

  Timestamp for when the revision was made (rarely used).

#### Instances

Instances details

Show (PkgRevInfo m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods showsPrec :: Int -> PkgRevInfo m -> ShowS Source # show :: PkgRevInfo m -> String Source # showList :: [PkgRevInfo m] -> ShowS Source #
Eq (PkgRevInfo m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods (==) :: PkgRevInfo m -> PkgRevInfo m -> Bool Source # (/=) :: PkgRevInfo m -> PkgRevInfo m -> Bool Source #

data GetManifest (m :: Type -> Type) Source #

The manifest is stored as a monadic action, because we want to fetch them on-demand. It would be a waste to fetch it information for every version of every package if we only actually need a small subset of them.

#### Instances

Instances details

Show (GetManifest m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods showsPrec :: Int -> GetManifest m -> ShowS Source # show :: GetManifest m -> String Source # showList :: [GetManifest m] -> ShowS Source #
Eq (GetManifest m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods (==) :: GetManifest m -> GetManifest m -> Bool Source # (/=) :: GetManifest m -> GetManifest m -> Bool Source #

data GetFiles (m :: Type -> Type) Source #

Get the absolute path to a package directory on disk, as well as relative paths to files that should be installed from this package. Composing the package directory and one of these paths refers to a local file (pointing into the cache) and is valid at least until the next cache operation.

#### Instances

Instances details

Show (GetFiles m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods showsPrec :: Int -> GetFiles m -> ShowS Source # show :: GetFiles m -> String Source # showList :: [GetFiles m] -> ShowS Source #
Eq (GetFiles m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods (==) :: GetFiles m -> GetFiles m -> Bool Source # (/=) :: GetFiles m -> GetFiles m -> Bool Source #

newtype CacheDir Source #

A temporary directory in which we store Git checkouts while running. This is to avoid constantly re-cloning. Will be deleted when `futhark pkg` terminates. In principle we could keep this around for longer, but then we would have to 'git pull' now and then also. Note that the cache is stateful - we are going to use `git checkout` to move around the history. It is generally not safe to have multiple operations running concurrently.

Constructors

CacheDir FilePath |

# Package registry

data PkgRegistry (m :: Type -> Type) Source #

A package registry is a mapping from package paths to information about the package. It is unlikely that any given registry is global; rather small registries are constructed on-demand based on the package paths referenced by the user, and may also be combined monoidically. In essence, the PkgRegistry is just a cache.

#### Instances

Instances details

Monoid (PkgRegistry m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods mempty :: PkgRegistry m Source # mappend :: PkgRegistry m -> PkgRegistry m -> PkgRegistry m Source # mconcat :: [PkgRegistry m] -> PkgRegistry m Source #
Semigroup (PkgRegistry m) Source # |
Instance details Defined in Futhark.Pkg.Info Methods (<>) :: PkgRegistry m -> PkgRegistry m -> PkgRegistry m Source # sconcat :: NonEmpty (PkgRegistry m) -> PkgRegistry m Source # stimes :: Integral b => b -> PkgRegistry m -> PkgRegistry m Source #

class (MonadIO m, MonadLogger m, MonadFail m) => MonadPkgRegistry (m :: Type -> Type) where Source #

Monads that support a stateful package registry. These are also required to be instances of `MonadIO` because most package registry operations involve network operations.

Minimal complete definition

getPkgRegistry, putPkgRegistry

Methods

getPkgRegistry :: m (PkgRegistry m) Source #

putPkgRegistry :: PkgRegistry m -> m () Source #

modifyPkgRegistry :: (PkgRegistry m -> PkgRegistry m) -> m () Source #

lookupPackage :: MonadPkgRegistry m => CacheDir -> PkgPath -> m (PkgInfo m) Source #

Given a package path, look up information about that package.

lookupPackageRev :: MonadPkgRegistry m => CacheDir -> PkgPath -> SemVer -> m (PkgRevInfo m) Source #

Look up information about a specific version of a package.

lookupNewestRev :: MonadPkgRegistry m => CacheDir -> PkgPath -> m SemVer Source #

Find the newest version of a package.