Commit graph

232 commits

Author SHA1 Message Date
Guru Devanla dc384ee90f Merge branch 'master' of https://github.com/haskell-nix/hnix 2018-04-28 15:36:38 -07:00
Guru Devanla 8ba302265b add builtins.placeHolder to builtins 2018-04-28 15:35:01 -07:00
Alex Rozenshteyn 6734e3b73f Add builtins.storeDir 2018-04-28 15:28:57 -07:00
Tim Sears 43bb8d0558 allow floating point values to be used with builtins.add. Fixes Issue #207. 2018-04-28 15:22:28 -07:00
John Wiegley 1c5044da60 Finish builtins.genericClosure
Fixes #144
2018-04-28 15:18:45 -07:00
John Wiegley 3b304561f7 Make div dispatch on value types 2018-04-28 15:01:12 -07:00
John Wiegley d0b5ccde77 Initial implementation of genericClosure 2018-04-28 14:56:20 -07:00
John Wiegley 49953737cc
Merge pull request #256 from wavewave/builtin
add div
2018-04-28 14:55:21 -07:00
Ian-Woo Kim aa506e8555 add div 2018-04-28 14:01:14 -07:00
John Wiegley f722639b01 Minor correction to the builtins list 2018-04-28 13:49:34 -07:00
John Wiegley ec50146a25 Add a comment 2018-04-28 13:49:22 -07:00
John Wiegley 6946e713c0 For every builtin name, also an alias __name at toplevel
Relates to #243
2018-04-28 07:08:08 -07:00
John Wiegley 7282d7c153 Define builtins.langVersion == 5 (integer), add a matching test with Nix
Fixes #235
2018-04-27 20:55:03 -07:00
John Wiegley 4947f05a14 Make builtins.nixPath a synonym for __nixPath
Fixes #238
2018-04-27 20:52:09 -07:00
John Wiegley 1e2bd9eb2f Silence a warning 2018-04-26 22:30:42 -07:00
John Wiegley 6c2149f767 Remove code TODOs, which have been changed into GitHub issues 2018-04-26 17:13:22 -07:00
John Wiegley 49eea12262 Use fromValue defensively wherever possible in Builtins.hs 2018-04-25 20:46:31 -07:00
John Wiegley e8da0391e1 Fix an issue where evaluation was unintentionally too deep
Fixes #193
2018-04-25 20:23:10 -07:00
John Wiegley cfdb314f9e Simplify foldl'_ a bit 2018-04-25 01:10:15 -07:00
John Wiegley b83ccb40f3 Add provenance to thunks, and allow provenance to stack 2018-04-24 21:41:23 -07:00
John Wiegley 9864a8c7a5 Rework the way that info frames and error are handled
There is still work to be done to render the new "typed frames", and to
convert all the current string based frame into typed frames. This will pave
the way forward to smarter error messages that can be browsed in intelligent
environments like Emacs and the browser.
2018-04-24 02:15:28 -07:00
John Wiegley 596f2d160b
Merge pull request #191 from mightybyte/sort-builtins
Sort the builtins for easy comparison
2018-04-23 10:08:45 -07:00
John Wiegley 3cf02e3902 Track value provenance during evaluation 2018-04-22 14:33:38 -07:00
Doug Beardsley 26013d2e3b Sort the builtins for easy comparison 2018-04-22 13:48:55 -04:00
John Wiegley 9937453ef2 Ensure that the --trace option persists through imports 2018-04-21 10:36:32 -07:00
John Wiegley 8a93068102 Rename Nix.Core back to Nix.Eval, since Nix.Eval was now almost empty 2018-04-21 10:11:34 -07:00
John Wiegley 86b09103d6 Move production of a reduced test case to --reduce, improve --trace 2018-04-20 22:36:40 -07:00
John Wiegley 7188c71d0a Add more evaluation context information, for -v2 or higher 2018-04-18 16:12:31 -07:00
John Wiegley bd693fd3e5 And more coercion work 2018-04-17 21:53:07 -07:00
John Wiegley 91f7feb615 More work on path coercions 2018-04-17 21:49:29 -07:00
John Wiegley 114931bda8 Pass a 0 argument where needed 2018-04-17 20:44:20 -07:00
John Wiegley e92c5755af attrNames and attrValues, by using ToBuiltin, were evaluating too deeply 2018-04-17 19:01:32 -07:00
John Wiegley 02ee1c7e34 The argument order for the function passed to foldl' had gotten flipped 2018-04-17 18:30:05 -07:00
John Wiegley d16a627464 Avoid re-executing actions that yield functions in Builtins.hs 2018-04-17 17:46:27 -07:00
John Wiegley 7cf4d62868 builtins.currentSystem had the arch and os reversed 2018-04-17 14:49:47 -07:00
John Wiegley 8d25aa461d Add --json option to hnix, which can render both expressions and values 2018-04-17 14:24:52 -07:00
John Wiegley 11d074a355 Simplify more functions in Builtins.hs
Specifically, reduce the number of explicit calls to 'force'.
2018-04-16 21:47:45 -07:00
John Wiegley c9158273a4 Change all builtins to go from m (NValue m) -> m (NValue m)
This avoids a needless thunk encapsulation.
2018-04-16 21:39:41 -07:00
hsloan eef5b3fb30 use fromValue in more places in builtins
do this to avoid pattern matching and throwing errors explicitly
2018-04-16 23:18:06 -04:00
John Wiegley b1f6a99dbc Simplify more functions in Builtins using Nix.Convert 2018-04-15 23:01:22 -07:00
John Wiegley a0372918dd More minor cleanups in Builtins.hs 2018-04-15 22:01:01 -07:00
John Wiegley dc23fb71fe Some further simplifications in Builtins.hs 2018-04-15 21:03:43 -07:00
John Wiegley dacd0ca0db Restore the "normal form recursive" ToNix/FromNix type classes
This allows for very easily written Builtins
2018-04-15 20:43:04 -07:00
John Wiegley fb6191c949 Rename the internal version of ToNix/FromNix to ToValue/FromValue 2018-04-15 19:05:44 -07:00
John Wiegley ef82d5e9f2 Make ToNix monadic, to avoid making any assumptions about its use 2018-04-15 16:21:47 -07:00
John Wiegley 5ce5ac8791 Get rid of ConvertValue in favor of Nix.Context
There remains some simplification work to be done, still, as there is much
duplication in Builtins.hs as things stand now. At least for now only one type
class-based, automatic conversion mechanism exists.
2018-04-15 01:43:01 -07:00
John Wiegley a6b004d04b Make some uses of Nix.Convert with forcing more explicit 2018-04-15 00:51:50 -07:00
John Wiegley 16e02088d8 More changes in Builtins.hs to use Nix.Convert 2018-04-14 23:53:59 -07:00
John Wiegley ca0ab497a1 Resolve some warnings in Builtins.hs 2018-04-14 23:53:31 -07:00
John Wiegley ca24430bc9 Change Builtins.hs to use the ToNix/FromNix defined in Convert.hs 2018-04-14 22:58:50 -07:00
Ryan Trinkle 6366620542 Allow imports from strings 2018-04-13 23:30:21 -04:00
John Wiegley c5f001a7d4 For now, allow pathExists to accept a string 2018-04-13 18:35:51 -07:00
John Wiegley 6c9cbf241a Rewrite ToNix/FromNix, although Builtins.hs is not using it yet 2018-04-13 18:09:12 -07:00
John Wiegley 7f6a64da04 More corrections to the search path logic
Fixes #112
2018-04-13 16:37:11 -07:00
John Wiegley caa897af4a Introduce new helper function Exec.foldNixPath 2018-04-13 10:38:57 -07:00
John Wiegley c9c2db5cb8 Correct the behavior of baseNameOf 2018-04-13 01:20:33 -07:00
John Wiegley b6b3c61176 Add the __nixPath builtin 2018-04-13 01:20:24 -07:00
John Wiegley e9299dce7b Implement builtins.fetchTarball at the moment by calling nix-instantiate 2018-04-11 13:56:18 -07:00
John Wiegley ffa8d85dd2 Move handling of with statements into MonadEval 2018-04-11 11:53:30 -07:00
Doug Beardsley 714b78cbdc Fix remaining split test failure 2018-04-11 02:06:47 -04:00
John Wiegley 3233c9cb31 Restore the pretty show instance for NValue m (orphaned in Pretty for now) 2018-04-10 21:11:46 -07:00
John Wiegley 74de14dc7d Restore the linter, to some degree, at least for the language tests 2018-04-10 21:02:01 -07:00
Doug Beardsley 9ab6455bfc Fix bug in builtins.split for multiple matches 2018-04-10 12:33:31 -07:00
Doug Beardsley 13fc5bcd6d Add builtins.split
Finishes issue #113
2018-04-10 12:33:31 -07:00
John Wiegley a7e7e84795 Drop dependency on insert-ordered-containers
Fixes #161
2018-04-10 11:58:08 -07:00
John Wiegley 49d73fa767 Restore code in Builtins.hs 2018-04-10 09:02:17 -07:00
John Wiegley 4f9dec43cd More work on the megaparsec parser 2018-04-10 00:40:11 -07:00
John Wiegley 8f37f37986 Down to 16 basic test failures with megaparsec 2018-04-09 21:35:46 -07:00
John Wiegley 9d7f25d368 All is building with Megaparsec now, but many parsing tests fail 2018-04-09 17:12:16 -07:00
John Wiegley 9beb9364e0 The Megaparsec version of Parser.hs is at least compiling 2018-04-09 16:11:31 -07:00
John Wiegley 4c2eebbe40 Refactor evaluation using a type class 2018-04-09 00:52:10 -07:00
John Wiegley f6eb4c1353 Store a closure in NVClosure, instead of passing the scope 2018-04-07 22:46:05 -07:00
Ryan Trinkle 7c3b7d9482 When the user calls import on a directory, automatically append default.nix 2018-04-07 20:33:36 -04:00
John Wiegley 39e859fab5 Make use of Nix.Normal, move some more code to Nix.Value 2018-04-07 17:24:22 -07:00
John Wiegley 31e6aa8fb9 Implement __curPos as a primitive action during evaluation 2018-04-07 16:35:11 -07:00
Ryan Trinkle 33ae62534b Make map builtin lazier 2018-04-07 19:06:01 -04:00
Ryan Trinkle 628697d63b Merge branch 'master' of github.com:jwiegley/hnix
# Conflicts:
#	src/Nix/Monad.hs
#	src/Nix/Monad/Instance.hs
2018-04-07 18:39:57 -04:00
Ryan Trinkle 8b0de962b0 Add derivation builtin 2018-04-07 18:34:54 -04:00
Doug Beardsley 1b7dac071d Test to catch a bug in builtins.match
Also added infrastructure for comparing against current nix behavior,
not just current nix tests.
2018-04-07 15:07:09 -07:00
John Wiegley aaaa82820f Don't distinguish between literal and env paths in values, just exprs 2018-04-07 14:52:24 -07:00
John Wiegley ea6a98f602 Implement builtins.tryEval 2018-04-07 14:33:15 -07:00
John Wiegley a704bb045f Commit the src/ directory 2018-04-07 12:02:50 -07:00