nix-eval-0.1.0.2: Evaluate Haskell expressions using Nix to get packages

Safe HaskellSafe
LanguageHaskell2010

Language.Eval.Internal

Synopsis

Documentation

newtype Pkg Source

Constructors

Pkg String 

newtype Mod Source

Constructors

Mod String 

newtype Expr Source

Constructors

Expr ([Pkg], [Mod], String) 

eval :: Expr -> IO (Maybe String) Source

Evaluate an Expr; this is where the magic happens! If successful, returns Just a String, which you can do what you like with.

mkHs :: Expr -> String Source

Turn an expression into a Haskell module, complete with imports and main

trim :: String -> String Source

Strip leading and trailing whitespace

haveNix :: IO Bool Source

Check if the `nix-shell` 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`

asString :: Show a => a -> Expr Source

Convert the argument to a String, then send to raw

qualified :: Mod -> String -> Expr Source

Qualify an expression, eg. `qualified Data.Bool "not"` gives the expression not with Data.Bool in its module list

withMods :: [Mod] -> Expr -> Expr Source

Append modules to an expression's context

withPkgs :: [Pkg] -> Expr -> Expr Source

Append packages to an expression's context