ghcup-0.1.14.2: ghc toolchain installer
Copyright(c) Julian Ospald 2020
LicenseLGPL-3.0
Maintainerhasufell@hasufell.de
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

GHCup

Description

This module contains the main functions that correspond to the command line interface, like installation, listing versions and so on.

These are the entry points.

Synopsis

Documentation

installGHCBindist Source #

Like installGHCBin, except takes the DownloadInfo as argument instead of looking it up from GHCupDownloads.

installPackedGHC Source #

Arguments

:: (MonadMask m, MonadCatch m, MonadReader AppState m, MonadThrow m, MonadLogger m, MonadIO m) 
=> Path Abs

Path to the packed GHC bindist

-> Maybe TarDir

Subdir of the archive

-> Path Abs

Path to install to

-> Version

The GHC version

-> PlatformRequest 
-> Excepts '[BuildFailed, UnknownArchive, TarDirDoesNotExist, ArchiveResult] m () 

Install a packed GHC distribution. This only deals with unpacking and the GHC build system and nothing else.

installUnpackedGHC Source #

Arguments

:: (MonadReader AppState m, MonadThrow m, MonadLogger m, MonadIO m) 
=> Path Abs

Path to the unpacked GHC bindist (where the configure script resides)

-> Path Abs

Path to install to

-> Version

The GHC version

-> PlatformRequest 
-> Excepts '[ProcessError] m () 

Install an unpacked GHC distribution. This only deals with the GHC build system and nothing else.

installGHCBin Source #

Arguments

:: (MonadFail m, MonadMask m, MonadCatch m, MonadReader AppState m, MonadLogger m, MonadResource m, MonadIO m) 
=> GHCupDownloads

the download info to look up the tarball from

-> Version

the version to install

-> PlatformRequest

the platform to install on

-> Excepts '[AlreadyInstalled, BuildFailed, DigestError, DownloadFailed, NoDownload, NotInstalled, UnknownArchive, TarDirDoesNotExist, ArchiveResult] m () 

Installs GHC into ~/.ghcup/ghc/<ver> and places the following symlinks in ~/.ghcup/bin:

  • ghc-x.y.z -> ../ghc/x.y.z/bin/ghc
  • ghc-x.y -> ../ghc/x.y.z/bin/ghc (if x.y.z is the latest x.y version)

installCabalBin :: (MonadMask m, MonadCatch m, MonadReader AppState m, MonadLogger m, MonadResource m, MonadIO m, MonadFail m) => GHCupDownloads -> Version -> PlatformRequest -> Excepts '[AlreadyInstalled, CopyError, DigestError, DownloadFailed, NoDownload, NotInstalled, UnknownArchive, TarDirDoesNotExist, ArchiveResult] m () Source #

Installs cabal into ~/.ghcup/bin/cabal-<ver> and creates a default cabal -> cabal-x.y.z.q symlink for the latest installed version.

installHLSBin :: (MonadMask m, MonadCatch m, MonadReader AppState m, MonadLogger m, MonadResource m, MonadIO m, MonadFail m) => GHCupDownloads -> Version -> PlatformRequest -> Excepts '[AlreadyInstalled, CopyError, DigestError, DownloadFailed, NoDownload, NotInstalled, UnknownArchive, TarDirDoesNotExist, ArchiveResult] m () Source #

Installs hls binaries haskell-language-server-<ghcver> into ~/.ghcup/bin/, as well as haskell-languager-server-wrapper.

setGHC :: (MonadReader AppState m, MonadLogger m, MonadThrow m, MonadFail m, MonadIO m, MonadCatch m) => GHCTargetVersion -> SetGHC -> Excepts '[NotInstalled] m GHCTargetVersion Source #

Set GHC symlinks in ~/.ghcup/bin for the requested GHC version. The behavior depends on SetGHC:

  • SetGHCOnly: ~/.ghcup/bin/ghc -> ~/.ghcup/ghc/<ver>/bin/ghc
  • SetGHC_XY: ~/.ghcup/bin/ghc-X.Y -> ~/.ghcup/ghc/<ver>/bin/ghc
  • SetGHC_XYZ: ~/.ghcup/bin/ghc-<ver> -> ~/.ghcup/ghc/<ver>/bin/ghc

Additionally creates a ~/.ghcup/share -> ~/.ghcup/ghc/<ver>/share symlink for SetGHCOnly constructor.

setCabal :: (MonadReader AppState m, MonadLogger m, MonadThrow m, MonadFail m, MonadIO m) => Version -> Excepts '[NotInstalled] m () Source #

Set the ~/.ghcup/bin/cabal symlink.

setHLS :: (MonadCatch m, MonadReader AppState m, MonadLogger m, MonadThrow m, MonadFail m, MonadIO m) => Version -> Excepts '[NotInstalled] m () Source #

Set the haskell-language-server symlinks.

data ListCriteria Source #

Filter data type for listVersions.

Constructors

ListInstalled 
ListSet 

Instances

Instances details
Show ListCriteria Source # 
Instance details

Defined in GHCup

data ListResult Source #

A list result describes a single tool version and various of its properties.

Constructors

ListResult 

Fields

Instances

Instances details
Eq ListResult Source # 
Instance details

Defined in GHCup

Ord ListResult Source # 
Instance details

Defined in GHCup

Show ListResult Source # 
Instance details

Defined in GHCup

availableToolVersions :: GHCupDownloads -> Tool -> Map Version [Tag] Source #

Extract all available tool versions and their tags.

listVersions :: (MonadCatch m, MonadLogger m, MonadThrow m, MonadLogger m, MonadIO m, MonadReader AppState m) => GHCupDownloads -> Maybe Tool -> Maybe ListCriteria -> PlatformRequest -> m [ListResult] Source #

List all versions from the download info, as well as stray versions.

rmGHCVer :: (MonadReader AppState m, MonadThrow m, MonadLogger m, MonadIO m, MonadFail m, MonadCatch m) => GHCTargetVersion -> Excepts '[NotInstalled] m () Source #

Delete a ghc version and all its symlinks.

This may leave GHCup without a "set" version. Will try to fix the ghc-x.y symlink after removal (e.g. to an older version).

rmCabalVer :: (MonadReader AppState m, MonadThrow m, MonadLogger m, MonadIO m, MonadFail m, MonadCatch m) => Version -> Excepts '[NotInstalled] m () Source #

Delete a cabal version. Will try to fix the cabal symlink after removal (e.g. setting it to an older version).

rmHLSVer :: (MonadReader AppState m, MonadThrow m, MonadLogger m, MonadIO m, MonadFail m, MonadCatch m) => Version -> Excepts '[NotInstalled] m () Source #

Delete a hls version. Will try to fix the hls symlinks after removal (e.g. setting it to an older version).

compileGHC Source #

Compile a GHC from source. This behaves wrt symlinks and installation the same as installGHCBin.

upgradeGHCup Source #

Arguments

:: (MonadMask m, MonadReader AppState m, MonadCatch m, MonadLogger m, MonadThrow m, MonadResource m, MonadIO m) 
=> GHCupDownloads 
-> Maybe (Path Abs)

full file destination to write ghcup into

-> Bool

whether to force update regardless of currently installed version

-> PlatformRequest 
-> Excepts '[CopyError, DigestError, DownloadFailed, NoDownload, NoUpdate] m Version 

Upgrade ghcup and place it in ~/.ghcup/bin/ghcup, if no path is provided.

postGHCInstall :: (MonadReader AppState m, MonadLogger m, MonadThrow m, MonadFail m, MonadIO m, MonadCatch m) => GHCTargetVersion -> Excepts '[NotInstalled] m () Source #

Creates ghc-x.y.z and ghc-x.y symlinks. This is used for both installing from source and bindist.