Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 33 lines (28 sloc) 0.975 kB
bf26c18 @trofi cleanup: factor out Main.defaultRepo{,URI} to separate Hackage file
trofi authored
1 {-|
2 Author : Sergei Trofimovich <slyfox@gentoo.org>
3 Stability : experimental
4 Portability : haskell98
5
6 Utilities to work with hackage-alike repositories
7 -}
8 module Hackage
9 ( defaultRepo
10 , defaultRepoURI
11 ) where
12
13 import Distribution.Client.Types (Repo(..), RemoteRepo(..))
14 import Network.URI (URI(..), URIAuth(..))
15 import System.FilePath
16
17 defaultRepo :: FilePath -> Repo
18 defaultRepo overlayPath =
19 Repo {
20 repoKind = Left hackage,
21 repoLocalDir = overlayPath </> ".hackport"
22 }
23 where
24 hackage = RemoteRepo server_name uri
25 server_name = "hackage.haskell.org"
26 uri = URI "http:" (Just (URIAuth "" server_name "")) "/packages/archive" "" ""
27
28 defaultRepoURI :: FilePath -> URI
29 defaultRepoURI overlayPath =
30 case repoKind (defaultRepo overlayPath) of
31 Left (RemoteRepo { remoteRepoURI = uri }) -> uri
32 Right _ -> error $ "defaultRepoURI: unable to get URI for " ++ overlayPath
Something went wrong with that request. Please try again.