Commit Graph

2145 Commits

Author SHA1 Message Date
John Wiegley a992893174
Merge pull request #85 from layus/eval-binary-operators
Improve handling of `+` and `++` operators.
2018-02-20 16:06:30 -08:00
John Wiegley ae8dcd2780
Merge pull request #86 from vaibhavsagar/fix-travis
.travis.yml: use default.nix instead of build.nix
2018-02-15 11:15:48 -08:00
Guillaume Maudoux 977e48ead5 Update default.nix 2018-02-15 12:06:09 +01:00
Guillaume Maudoux 25f1da3408 Run lang tests from upstream 2018-02-15 12:06:09 +01:00
Guillaume Maudoux 2325cea1c6 Add nix v1.10 as submodule
It will be used to access upstream tests.
2018-02-15 12:06:09 +01:00
Guillaume Maudoux 507a1f24a3 Add `printNix` that prints value like nix does 2018-02-15 12:06:09 +01:00
Guillaume Maudoux 5718952e7b Add NValue constructors for builtins 2018-02-15 12:05:23 +01:00
Georges Dubus e006209be8 Some tests inline, for profiling 2018-02-14 11:33:06 +01:00
Vaibhav Sagar 192fd30ba3 .travis.yml: use default.nix instead of build.nix 2018-02-14 11:39:17 +08:00
John Wiegley 0d4b2874c0
Merge pull request #84 from layus/debug-path-lookup
improve error message on path lookup
2018-02-13 14:14:08 -08:00
John Wiegley 17a2b0f8b4
Update Eval.hs 2018-02-13 14:13:55 -08:00
Georges Dubus e73fc5d196 More WIP 2018-02-13 15:49:46 +01:00
Guillaume Maudoux bc7e9af32b Improve handling of `+` and `++` operators.
Nix strings are concatenated with `+`, as opposed to haskell `++`.
Now we also support concatenating paths, with paths and with strings.
2018-02-10 14:05:00 +01:00
Guillaume Maudoux 1877180314 improve error message on path lookup 2018-02-10 14:04:17 +01:00
Guillaume Maudoux 0914047115 Handle `let { body = ... }` expressions 2018-02-10 13:30:33 +01:00
Georges Dubus 985cd9a32a Nope, still have an infinite loop 2018-02-01 18:04:51 +01:00
Georges Dubus 9f88ac5442 Nope, still have an infinite loop 2018-02-01 18:04:14 +01:00
Georges Dubus 9722f02e6e Fixed env evalution, but not recursive args 2018-02-01 17:01:06 +01:00
Georges Dubus a4e7c246b1 WIP 2018-02-01 16:52:10 +01:00
Georges Dubus d7f5ebfbe2 Restart from scratch 2018-02-01 16:27:33 +01:00
Georges Dubus f7d3467781 More WIP 2018-01-31 18:00:09 +01:00
Georges Dubus 7b651303e2 WIP fix recursive default args 2018-01-29 19:56:58 +01:00
John Wiegley ad18c62566
Merge pull request #81 from domenkozar/merge-nix-files
Merge {build,shell,default}.nix into default.nix
2018-01-28 21:38:24 -08:00
John Wiegley ee156d4fa8
Merge pull request #80 from domenkozar/prettyprint-inherit
prettyprint: align inherit args
2018-01-28 21:38:13 -08:00
John Wiegley d883a752fb
Merge pull request #78 from madjar/set-as-env
Change the environment in evaluation to be a `Map Text (NValue m)`
2018-01-28 21:37:57 -08:00
Georges Dubus b61b5791bb Change the environment in evaluation to be a `Map Text (NValue m)`
Currently, the environment is passed as a `NValue m`, but is assumed to be
a set every single time it is used. This commit changes it `Map Text (NValue
m)`. Since this is used a lot, it defines a new type alias:

```
type ValueSet m = Map.Map Text (NValue m)
```

This has multiples benefits:
- Simplify some code by removing all the checks that the env is indeed a set
- Simplify the usage of the module by making clear that we need a set as the
  environment. (I especially like this, since it took me a while to figure out
  what that argument was supposed to be the first time).
- Make it simple to inject functions in the environment (for example to have
  builtins) since now the function definition doesn't need to unwrap the set.
2018-01-28 23:27:33 +01:00
Domen Kožar b821021cac
Merge {build,shell,default}.nix into default.nix
cabal2nix generates all of them in one go.
2018-01-28 21:58:33 +00:00
Domen Kožar afa7585009
prettyprint: align inherit args 2018-01-28 21:45:38 +00:00
John Wiegley a28a8397cd
Merge pull request #77 from domenkozar/prettyprinter-fixes
Prettyprinter fixes
2018-01-28 11:26:20 -08:00
John Wiegley e5f9b13e5a
Merge pull request #79 from madjar/pretty-value
Add a pretty-printer for NValue
2018-01-28 11:24:42 -08:00
Georges Dubus e733986f3c Add a pretty-printer for NValue
The implementation is a bit hacky: we convert the NValue to a NExpr, which
let us reuse the ast pretty-printing logic.

This commit also moves `atomText` from `Nix.Pretty` to `Nix.Eval` to avoid a
circular dependency. I don't have a strong argument for that, except that the
pretty-printer depending from the evaluator makes a bit more sense than other
way around.
2018-01-28 18:21:57 +01:00
Domen Kožar b391db0bf6
assert and with should be followed with a newline 2018-01-28 13:08:43 +00:00
Domen Kožar 22097ebe1c
dedent 'in' in 'let in' 2018-01-28 13:08:09 +00:00
Domen Kožar f867c2ccbb
Indent first line after functions 2018-01-28 13:07:36 +00:00
Domen Kožar f61fe5d53b
Format functions with args with newlines 2018-01-28 13:06:59 +00:00
John Wiegley a0264c1f0c
Merge pull request #76 from madjar/fix-recset
Fix recset evaluation logic
2018-01-27 00:40:08 -08:00
Georges Dubus 3ffba374ae Fix recset evaluation logic
Before, an evaluation of a recset would contain all the environment. Eg:
```
>>> let a = 4; in rec {x = 2;}
{x = 2; a = 4;}
```

This commit changes it to only contain the values actually bound in the set:
```
>>> let a = 4; in rec {x = 2;}
{x = 2;}
```
2018-01-26 13:19:14 +01:00
John Wiegley 8b47c8b143 Add back *.nix files for the sake of Travis 2018-01-22 18:38:04 -08:00
John Wiegley 054eb3ced5 Mention the use of cabal2nix in README.md 2018-01-22 12:15:03 -08:00
John Wiegley d3f9302c9f Bump Cabal version to 0.4 2018-01-22 12:13:30 -08:00
John Wiegley 376bde416d Delete project.nix 2018-01-22 12:13:21 -08:00
John Wiegley 41f631730c Add Makefile and .gitignore 2018-01-22 11:52:22 -08:00
John Wiegley 0bda6da9e1 Remove generated files 2018-01-22 11:51:06 -08:00
John Wiegley 23363bd3a3
Merge pull request #72 from vaibhavsagar/travis
Test with Travis
2017-12-29 14:10:28 -08:00
Vaibhav Sagar 2960a01f09 .travis.yml: init 2017-12-29 11:51:01 +08:00
John Wiegley db3f054a38
Merge pull request #71 from vaibhavsagar/eq1
Nix/Expr/Types.hs: add Eq1 instances
2017-12-27 09:56:59 -08:00
Vaibhav Sagar 130186400c Nix/Expr/Types.hs: add Eq1 instances 2017-12-27 17:11:57 +08:00
John Wiegley 07cbf0e56e
Merge pull request #69 from vaibhavsagar/import-nix-expr
Import Nix.Expr so main/Main.hs compiles
2017-11-29 08:42:29 -08:00
Vaibhav Sagar ab52fb8d00 Import Nix.Expr so main/Main.hs compiles 2017-11-29 17:42:12 +08:00
John Wiegley 35a7f64467 Merge pull request #66 from rickynils/eval_env_path
evalExpr: Add support for NEnvPath
2017-10-18 09:59:17 -07:00