ghcup-0.1.18.0: 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

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, ToolShadowed] m Version 

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

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 #

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, MonadResource m) 
=> FilePath

Path to the packed GHC bindist

-> Maybe TarDir

Subdir of the archive

-> InstallDirResolved 
-> Version

The GHC version

-> Bool

Force install

-> [Text]

additional configure args for bindist

-> Excepts '[BuildFailed, UnknownArchive, TarDirDoesNotExist, DirNotEmpty, ArchiveResult, ProcessError, MergeFileTreeError] 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, MonadResource m, MonadFail m) 
=> GHCupPath

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

-> InstallDirResolved

Path to install to

-> Version

The GHC version

-> Bool

Force install

-> [Text]

additional configure args for bindist

-> Excepts '[ProcessError, MergeFileTreeError] 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)

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.

rmGHCVer :: (MonadReader env m, HasDirs env, MonadThrow m, HasLog env, MonadIO m, MonadFail m, MonadCatch m, MonadMask m, MonadUnliftIO m) => GHCTargetVersion -> Excepts '[NotInstalled, UninstallFailed] 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).

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.

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, MonadResource m, HasPlatformReq env) 
=> FilePath

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

-> InstallDirResolved

Path to install to

-> Version 
-> Bool 
-> Excepts '[ProcessError, CopyError, FileAlreadyExistsError, NotInstalled, MergeFileTreeError] 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).

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 #

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

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

module GHCup.List