Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype Pkg = Pkg String
- newtype Mod = Mod String
- newtype Flag = Flag String
- data Expr = Expr {}
- eval :: Expr -> IO (Maybe String)
- eval' :: (String -> String) -> Expr -> IO (Maybe String)
- runCmdStdIO :: CreateProcess -> String -> IO (String, ExitCode)
- buildInput :: (String -> String) -> Expr -> String
- decideCmd :: Expr -> IO CreateProcess
- buildCmd :: (FilePath, [String]) -> CreateProcess
- noShellCmd :: Expr -> (String, [String])
- flagsOf :: Expr -> [String]
- hPutContents :: Handle -> String -> IO ()
- mkCmd :: Expr -> (String, [String])
- pkgOf :: Expr -> [Char]
- cmdLine :: Expr -> String
- shellEscape :: [Char] -> String
- wrapCmd' :: Expr -> [FilePath]
- wrapperPath :: FilePath
- ghcEnvWithPkgsPath :: FilePath
- mkGhcPkg :: [Pkg] -> [Char]
- pkgsToName :: [Pkg] -> [Char]
- havePkgs :: [Pkg] -> IO Bool
- needNewEnv :: [Pkg] -> IO Bool
- mkImport :: Mod -> String
- mkHs :: String -> String
- trim :: String -> String
- haveCommand :: [Char] -> IO Bool
- haveNix :: IO Bool
- haveGhcPkg :: IO Bool
- raw :: String -> Expr
- ($$) :: Expr -> Expr -> Expr
- asString :: Show a => a -> Expr
- qualified :: Mod -> Expr -> Expr
- withMods :: [Mod] -> Expr -> Expr
- withPkgs :: [Pkg] -> Expr -> Expr
- withFlags :: [Flag] -> Expr -> Expr
- withPreamble :: String -> Expr -> Expr
Documentation
eval' :: (String -> String) -> Expr -> IO (Maybe String) Source #
Same as eval
, but allows a custom formatting function to be supplied, eg.
if you want an alternative to the default "main = putStr (..)" behaviour.
runCmdStdIO :: CreateProcess -> String -> IO (String, ExitCode) Source #
Runs the given command, piping the given String into stdin, returning stdout and the ExitCode. stderr is inherited.
mkCmd :: Expr -> (String, [String]) Source #
Construct the nix-shell command. We use wrapper.sh as a layer of indirection, to work around buggy environments.
shellEscape :: [Char] -> String Source #
mkGhcPkg :: [Pkg] -> [Char] Source #
Creates a Nix expression which will use ghcEnvWithPkgs.nix to make a Haskell environment containing all of the given packages
pkgsToName :: [Pkg] -> [Char] Source #
This creates a name for our Haskell environment. We make it here once, and pass it into both Nix and wrapper.sh, to ensure consistency
havePkgs :: [Pkg] -> IO Bool Source #
Check if all of the required packages are already available, i.e. whether we need to create a new Haskell environment
needNewEnv :: [Pkg] -> IO Bool Source #
Do we need to create a new Haskell environment, because we don't have GHC available or because the packages we need aren't available?
mkHs :: String -> String Source #
Turn an expression into a Haskell module, complete with imports and main
haveGhcPkg :: IO Bool Source #
Check if the `ghc-pkg` command is available via the shell
raw :: String -> Expr Source #
A raw String of Haskell code, with no packages or modules. You can use OverloadedStrings to call this automatically.
($$) :: Expr -> Expr -> Expr infixr 8 Source #
Apply the first Expr to the second, eg. `f $$ x` ==> `f x`