ghcup-0.1.17.10: ghc toolchain installer
Copyright(c) Julian Ospald 2020
LicenseLGPL-3.0
Maintainerhasufell@hasufell.de
Stabilityexperimental
Portabilityportable
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 env m, HasDirs env, HasPlatformReq env, HasSettings env, MonadThrow m, HasLog env, MonadIO m, MonadUnliftIO m, MonadFail m) 
=> FilePath

Path to the packed GHC bindist

-> Maybe TarDir

Subdir of the archive

-> InstallDirResolved 
-> Version

The GHC version

-> Bool

Force install

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

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

installUnpackedGHC Source #

Arguments

:: (MonadReader env m, HasPlatformReq env, HasDirs env, HasSettings env, MonadThrow m, HasLog env, MonadIO m, MonadUnliftIO m, MonadMask m) 
=> FilePath

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

-> InstallDirResolved

Path to install to

-> Version

The GHC version

-> Excepts '[ProcessError] m () 

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

installGHCBin Source #

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)

installCabalUnpacked Source #

Arguments

:: (MonadCatch m, HasLog env, MonadIO m, MonadReader env m) 
=> FilePath

Path to the unpacked cabal bindist (where the executable resides)

-> InstallDirResolved

Path to install to

-> Version 
-> Bool

Force Install

-> Excepts '[CopyError, FileAlreadyExistsError] m () 

Install an unpacked cabal distribution.Symbol

installCabalBin :: (MonadMask m, MonadCatch m, MonadReader env m, HasPlatformReq env, HasGHCupInfo env, HasDirs env, HasSettings env, HasLog env, MonadResource m, MonadIO m, MonadUnliftIO m, MonadFail m) => Version -> InstallDir -> Bool -> Excepts '[AlreadyInstalled, CopyError, DigestError, GPGError, DownloadFailed, NoDownload, NotInstalled, UnknownArchive, TarDirDoesNotExist, ArchiveResult, FileAlreadyExistsError] 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.

installHLSBindist Source #

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

isLegacyHLSBindist Source #

Arguments

:: FilePath

Path to the unpacked hls bindist

-> IO Bool 

installHLSUnpacked Source #

Arguments

:: (MonadMask m, MonadUnliftIO m, MonadReader env m, MonadFail m, HasLog env, HasDirs env, HasSettings env, MonadCatch m, MonadIO m) 
=> FilePath

Path to the unpacked hls bindist (where the executable resides)

-> InstallDirResolved

Path to install to

-> Version 
-> Excepts '[ProcessError, CopyError, FileAlreadyExistsError, NotInstalled] m () 

Install an unpacked hls distribution.

installHLSUnpackedLegacy Source #

Arguments

:: (MonadReader env m, MonadFail m, HasLog env, MonadCatch m, MonadIO m) 
=> FilePath

Path to the unpacked hls bindist (where the executable resides)

-> InstallDirResolved

Path to install to

-> Version 
-> Bool

is it a force install

-> Excepts '[CopyError, FileAlreadyExistsError] m () 

Install an unpacked hls distribution (legacy).

installHLSBin :: (MonadMask m, MonadCatch m, MonadReader env m, HasPlatformReq env, HasGHCupInfo env, HasDirs env, HasSettings env, HasLog env, MonadResource m, MonadIO m, MonadUnliftIO m, MonadFail m) => Version -> InstallDir -> Bool -> Excepts '[AlreadyInstalled, CopyError, DigestError, GPGError, DownloadFailed, NoDownload, NotInstalled, UnknownArchive, TarDirDoesNotExist, ArchiveResult, FileAlreadyExistsError, ProcessError, DirNotEmpty] m () Source #

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

installStackBin Source #

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

installStackUnpacked Source #

Arguments

:: (MonadReader env m, HasLog env, MonadCatch m, MonadIO m) 
=> FilePath

Path to the unpacked stack bindist (where the executable resides)

-> InstallDirResolved 
-> Version 
-> Bool

Force install

-> Excepts '[CopyError, FileAlreadyExistsError] m () 

Install an unpacked stack distribution.

setGHC :: (MonadReader env m, HasDirs env, HasLog env, MonadThrow m, MonadFail m, MonadIO m, MonadCatch m, MonadMask m, MonadUnliftIO m) => GHCTargetVersion -> SetGHC -> Maybe FilePath -> 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 :: (MonadMask m, MonadReader env m, HasDirs env, HasLog env, MonadFail m, MonadIO m, MonadUnliftIO m) => Version -> Excepts '[NotInstalled] m () Source #

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

unsetCabal :: (MonadMask m, MonadReader env m, HasDirs env, MonadIO m) => m () Source #

setHLS :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m, MonadMask m, MonadFail m, MonadUnliftIO m) => Version -> SetHLS -> Maybe FilePath -> Excepts '[NotInstalled] m () Source #

Set the haskell-language-server symlinks.

unsetHLS :: (MonadMask m, MonadReader env m, HasDirs env, MonadIO m) => m () Source #

setStack :: (MonadMask m, MonadReader env m, HasDirs env, HasLog env, MonadThrow m, MonadFail m, MonadIO m, MonadUnliftIO m) => Version -> Excepts '[NotInstalled] m () Source #

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

unsetStack :: (MonadMask m, MonadReader env m, HasDirs env, MonadIO m) => m () Source #

warnAboutHlsCompatibility :: (MonadReader env m, HasDirs env, HasLog env, MonadThrow m, MonadCatch m, MonadIO m) => m () Source #

Warn if the installed and set HLS is not compatible with the installed and set GHC version.

data ListCriteria Source #

Filter data type for listVersions.

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 VersionInfo Source #

Extract all available tool versions and their tags.

listVersions :: (MonadCatch m, HasLog env, MonadThrow m, HasLog env, MonadIO m, MonadReader env m, HasDirs env, HasPlatformReq env, HasGHCupInfo env) => Maybe Tool -> Maybe ListCriteria -> m [ListResult] Source #

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

rmGHCVer :: (MonadReader env m, HasDirs env, MonadThrow m, HasLog env, MonadIO m, MonadFail m, MonadCatch m, MonadMask m, MonadUnliftIO 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 :: (MonadMask m, MonadReader env m, HasDirs env, MonadThrow m, HasLog env, MonadIO m, MonadFail m, MonadCatch m, MonadUnliftIO 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 :: (MonadMask m, MonadReader env m, HasDirs env, MonadThrow m, HasLog env, MonadIO m, MonadFail m, MonadCatch m, MonadUnliftIO 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).

rmStackVer :: (MonadMask m, MonadReader env m, HasDirs env, MonadThrow m, HasLog env, MonadIO m, MonadFail m, MonadCatch m, MonadUnliftIO m) => Version -> Excepts '[NotInstalled] m () Source #

Delete a stack version. Will try to fix the stack symlink 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 env m, HasDirs env, HasPlatformReq env, HasGHCupInfo env, HasSettings env, MonadCatch m, HasLog env, MonadThrow m, MonadFail m, MonadResource m, MonadIO m, MonadUnliftIO m) 
=> Maybe FilePath

full file destination to write ghcup into

-> Bool

whether to force update regardless of currently installed version

-> Bool

whether to throw an error if ghcup is shadowed

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

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

postGHCInstall :: (MonadReader env m, HasDirs env, HasLog env, MonadThrow m, MonadFail m, MonadIO m, MonadCatch m, MonadMask m, MonadUnliftIO 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.

whereIsTool :: (MonadReader env m, HasDirs env, HasLog env, MonadThrow m, MonadFail m, MonadIO m, MonadCatch m, MonadMask m, MonadUnliftIO m) => Tool -> GHCTargetVersion -> Excepts '[NotInstalled] m FilePath Source #

Reports the binary location of a given tool:

  • for GHC, this reports: ~/.ghcup/ghc/<ver>/bin/ghc
  • for cabal, this reports ~/.ghcup/bin/cabal-<ver>
  • for hls, this reports ~/.ghcup/bin/haskell-language-server-wrapper-<ver>
  • for stack, this reports ~/.ghcup/bin/stack-<ver>
  • for ghcup, this reports the location of the currently running executable

checkIfToolInstalled :: (MonadIO m, MonadReader env m, HasDirs env, MonadCatch m) => Tool -> Version -> m Bool Source #

Doesn't work for cross GHC.

rmCache :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m, MonadMask m) => m () Source #

rmTmp :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m, MonadMask m) => m () Source #