never executed always true always false
1 module GHC.Utils.CliOption
2 ( Option (..)
3 , showOpt
4 ) where
5
6 import GHC.Prelude
7
8 -- -----------------------------------------------------------------------------
9 -- Command-line options
10
11 -- | When invoking external tools as part of the compilation pipeline, we
12 -- pass these a sequence of options on the command-line. Rather than
13 -- just using a list of Strings, we use a type that allows us to distinguish
14 -- between filepaths and 'other stuff'. The reason for this is that
15 -- this type gives us a handle on transforming filenames, and filenames only,
16 -- to whatever format they're expected to be on a particular platform.
17 data Option
18 = FileOption -- an entry that _contains_ filename(s) / filepaths.
19 String -- a non-filepath prefix that shouldn't be
20 -- transformed (e.g., "/out=")
21 String -- the filepath/filename portion
22 | Option String
23 deriving ( Eq )
24
25 showOpt :: Option -> String
26 showOpt (FileOption pre f) = pre ++ f
27 showOpt (Option s) = s