Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Distribution.Client.Types.Repo
Synopsis
- data RemoteRepo = RemoteRepo {}
- emptyRemoteRepo :: RepoName -> RemoteRepo
- data LocalRepo = LocalRepo {}
- emptyLocalRepo :: RepoName -> LocalRepo
- localRepoCacheKey :: LocalRepo -> String
- data Repo
- = RepoLocalNoIndex { }
- | RepoRemote { }
- | RepoSecure { }
- repoName :: Repo -> RepoName
- isRepoRemote :: Repo -> Bool
- maybeRepoRemote :: Repo -> Maybe RemoteRepo
- normaliseFileNoIndexURI :: OS -> URI -> URI
Remote repository
data RemoteRepo Source #
Constructors
RemoteRepo | |
Fields
|
Instances
emptyRemoteRepo :: RepoName -> RemoteRepo Source #
Construct a partial RemoteRepo
value to fold the field parser list over.
Local repository (no-index)
no-index style local repositories.
Constructors
LocalRepo | |
Fields |
Instances
emptyLocalRepo :: RepoName -> LocalRepo Source #
Construct a partial LocalRepo
value to fold the field parser list over.
localRepoCacheKey :: LocalRepo -> String Source #
Calculate a cache key for local-repo.
For remote repositories we just use name, but local repositories may
all be named "local", so we add a bit of localRepoPath
into the
mix.
Repository
Different kinds of repositories
NOTE: It is important that this type remains serializable.
Constructors
RepoLocalNoIndex | Local repository, without index. |
Fields | |
RepoRemote | Standard (unsecured) remote repositories |
Fields | |
RepoSecure | Secure repositories Although this contains the same fields as Not all access to a secure repo goes through the hackage-security
library currently; code paths that do not still make use of the
|
Fields |
Instances
isRepoRemote :: Repo -> Bool Source #
Check if this is a remote repo
maybeRepoRemote :: Repo -> Maybe RemoteRepo Source #
Extract RemoteRepo
from Repo
if remote.
Windows
normaliseFileNoIndexURI :: OS -> URI -> URI Source #
When on Windows, we need to convert the paths in URIs to be POSIX-style.
>>>
import Network.URI
>>>
normaliseFileNoIndexURI Windows (URI "file+noindex:" (Just nullURIAuth) "C:\\dev\\foo" "" "")
file+noindex:C:/dev/foo
Other formats of file paths are not understood by network-uri
:
>>>
import Network.URI
>>>
uriPath <$> parseURI "file+noindex://C:/foo.txt"
Just "/foo.txt">>>
parseURI "file+noindex://C:\foo.txt"
Nothing>>>
uriPath <$> parseURI "file+noindex:///C:/foo.txt"
Just "/C:/foo.txt">>>
uriPath <$> parseURI "file+noindex:C:/foo.txt"
Just "C:/foo.txt"
Out of the ones above, only the last one can be used from anywhere in the system.