| Copyright | (c) 2013 Peter Simons |
|---|---|
| License | BSD3 |
| Maintainer | simons@cryp.to |
| Safe Haskell | Safe-Inferred |
| Language | Haskell98 |
Language.Nix
Contents
Description
- run :: String -> Either Error Expr
- runEval :: Eval a -> Env -> Either Error a
- eval :: Expr -> Eval Expr
- builtins :: Env
- parseNixFile :: FilePath -> IO (Either ParseError Expr)
- parseNix :: String -> Either ParseError Expr
- parse :: NixParser a -> String -> Either ParseError a
- parse' :: NixParser a -> SourceName -> String -> Either ParseError a
- data ParseError :: *
- data Expr
- = Null
- | Lit String
- | Ident String
- | Boolean Bool
- | AttrSet Bool [Attr]
- | AttrSetP (Maybe String) [(String, Maybe Expr)]
- | List [Expr]
- | Deref Expr Expr
- | HasAttr Expr Expr
- | DefAttr Expr Expr
- | Concat Expr Expr
- | Append Expr Expr
- | Not Expr
- | Union Expr Expr
- | Equal Expr Expr
- | Inequal Expr Expr
- | And Expr Expr
- | Or Expr Expr
- | Implies Expr Expr
- | Fun Expr Expr
- | Let [Attr] Expr
- | Apply Expr Expr
- | Import Expr
- | With Expr
- | Assert Expr
- | IfThenElse Expr Expr Expr
- newtype ScopedIdent = SIdent [String]
- data Attr
- genIdentifier :: Gen String
- expr :: NixParser Expr
- listExpr :: NixParser Expr
- term :: NixParser Expr
- operatorTable :: [[NixOperator]]
- listOperatorTable :: [[NixOperator]]
- identifier :: NixParser Expr
- literal :: NixParser Expr
- nixString :: NixParser String
- literalURI :: NixParser String
- attrSet :: NixParser Expr
- scopedIdentifier :: NixParser ScopedIdent
- attribute :: NixParser Attr
- list :: NixParser Expr
- letExpr :: NixParser Expr
- attrSetPattern :: NixParser Expr
- type TokenParser = GenTokenParser String () Identity
- type LanguageDef = GenLanguageDef String () Identity
- type NixParser a = ParsecT String () Identity a
- type NixOperator = Operator String () Identity Expr
- nixLanguage :: LanguageDef
- nixLexer :: TokenParser
- symbol :: String -> NixParser String
- reserved :: String -> NixParser ()
- reservedOp :: String -> NixParser ()
- lexeme :: NixParser a -> NixParser a
- parens :: NixParser a -> NixParser a
- braces :: NixParser a -> NixParser a
- brackets :: NixParser a -> NixParser a
- natural :: NixParser String
- assign :: NixParser String
- semi :: NixParser String
- dot :: NixParser String
- commaSep1 :: NixParser a -> NixParser [a]
- whitespace :: NixParser ()
Evaluating the Nix Language
Running the Parser
parseNixFile :: FilePath -> IO (Either ParseError Expr) Source
parse' :: NixParser a -> SourceName -> String -> Either ParseError a Source
data ParseError :: *
The abstract data type ParseError represents parse errors. It
provides the source position (SourcePos) of the error
and a list of error messages (Message). A ParseError
can be returned by the function parse. ParseError is an
instance of the Show and Eq classes.
Instances
Nix Language AST
Constructors
| Null | |
| Lit String | |
| Ident String | |
| Boolean Bool | |
| AttrSet Bool [Attr] | |
| AttrSetP (Maybe String) [(String, Maybe Expr)] | |
| List [Expr] | |
| Deref Expr Expr | |
| HasAttr Expr Expr | |
| DefAttr Expr Expr | |
| Concat Expr Expr | |
| Append Expr Expr | |
| Not Expr | |
| Union Expr Expr | |
| Equal Expr Expr | |
| Inequal Expr Expr | |
| And Expr Expr | |
| Or Expr Expr | |
| Implies Expr Expr | |
| Fun Expr Expr | |
| Let [Attr] Expr | |
| Apply Expr Expr | |
| Import Expr | |
| With Expr | |
| Assert Expr | |
| IfThenElse Expr Expr Expr |
newtype ScopedIdent Source
Instances
Constructors
| Assign ScopedIdent Expr | |
| Inherit ScopedIdent [String] |
Nix Language Parsers
operatorTable :: [[NixOperator]] Source
listOperatorTable :: [[NixOperator]] Source
Parsec Language Specification
type TokenParser = GenTokenParser String () Identity Source
type LanguageDef = GenLanguageDef String () Identity Source
reservedOp :: String -> NixParser () Source
whitespace :: NixParser () Source