forked from commercialhaskell/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGhcBuildParser.hs
More file actions
39 lines (36 loc) · 1.06 KB
/
Copy pathGhcBuildParser.hs
File metadata and controls
39 lines (36 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-# LANGUAGE NoImplicitPrelude #-}
module Stack.Options.GhcBuildParser
( ghcBuildParser
) where
import Options.Applicative
( Parser, completeWith, help, long, metavar, option )
import Options.Applicative.Types ( readerAsk, readerError )
import Stack.Options.Utils ( hideMods )
import Stack.Prelude
import Stack.Types.CompilerBuild ( CompilerBuild, parseCompilerBuild )
-- | GHC build parser
ghcBuildParser :: Bool -> Parser CompilerBuild
ghcBuildParser hide = option readGHCBuild
( long "ghc-build"
<> metavar "BUILD"
<> completeWith
[ "standard"
, "gmp4"
, "nopie"
, "tinfo6"
, "tinfo6-libc6-pre232"
, "tinfo6-nopie"
, "ncurses6"
, "int-native"
, "integersimple"
]
<> help "Specialized GHC build, e.g. 'gmp4' or 'standard' (usually \
\auto-detected)"
<> hideMods hide
)
where
readGHCBuild = do
s <- readerAsk
case parseCompilerBuild s of
Left e -> readerError (displayException e)
Right v -> pure v