Commit Graph

766 Commits

Author SHA1 Message Date
Ken Micklas 718c94e0bb Merge branch 'master' into vs-context-primops 2019-03-10 13:48:58 -04:00
John Wiegley 106fd7957f
Update to the latest hnix conventions 2019-03-10 10:41:31 -07:00
Madeline Haraj 28ab983408
Add syntactic holes 2019-03-10 10:23:28 -07:00
Emily Pillmore f3970d49b9
Add principled 'fetchurl' + tests
Tests are masked until store work is done
2019-03-10 10:07:03 -07:00
John Ericson 5ddb79009d Depend on hnix-store-core and use it for `printHash32` 2019-03-10 08:59:05 -07:00
John Wiegley eae6bf542f Split MonadFreshId off into its own file 2019-03-10 08:58:27 -07:00
Ken Micklas 75fb76a7c0 Revert "Add all the effects instances for FreshIdT"
This reverts commit 46db352af8.
2019-03-09 22:03:30 -05:00
Ken Micklas ec62bce3a0 Fix pointer equality case in thunkEq 2019-03-09 21:57:38 -05:00
Ken Micklas 695dd58d3c Fix failable pattern in fresh 2019-03-09 21:40:59 -05:00
Ken Micklas 2366aff91d Use valueEq when not pointer equal 2019-03-09 20:49:25 -05:00
Ken Micklas 8ddbe165e6 Only short-circuit pointer equality for correct types 2019-03-09 20:40:12 -05:00
Ken Micklas 05fccda825 Revert "Use thunk ID to short-circuit thunkEq"
This reverts commit c287ab8b59.
2019-03-09 20:35:39 -05:00
Ken Micklas 6a5718458d Fix MonadFreshId instances in wrong places 2019-03-09 20:26:56 -05:00
Ken Micklas 46db352af8 Add all the effects instances for FreshIdT 2019-03-09 20:26:56 -05:00
Ken Micklas c287ab8b59 Use thunk ID to short-circuit thunkEq 2019-03-09 20:26:19 -05:00
Ken Micklas d9293cf034 Fix Nix.Exec 2019-03-09 20:26:19 -05:00
Ken Micklas 91d5be6e49 Fix Nix.Lint 2019-03-09 20:26:19 -05:00
Ken Micklas 3b4af6f781 Move MonadAtomicRef ST instance to Nix.Thunk 2019-03-09 20:26:19 -05:00
Ken Micklas ae09c47b7d Fix Nix.Type.Infer 2019-03-09 20:26:19 -05:00
Ken Micklas 842dadf6da Use non-standalone GND for FreshIdT 2019-03-09 20:26:19 -05:00
Ken Micklas 69fa8884c1 Add MonadAtomicRef instance for ST 2019-03-09 20:26:19 -05:00
Ken Micklas a1fd246d01 Add MonadFix instance for FreshIdT 2019-03-09 20:26:19 -05:00
Ken Micklas fd63be4f96 Add MonadFreshId instance for FreshIdT 2019-03-09 20:26:19 -05:00
Ken Micklas 3671e6993e Fix FreshIdT instances 2019-03-09 20:26:19 -05:00
John Ericson 1abe4064c6 WIP more instances 2019-03-09 20:26:19 -05:00
John Ericson 3b5649c0a2 WIP fix equality 2019-03-09 20:26:19 -05:00
Vaibhav Sagar 4b8dff9aa8 Nix.Builtins: add getContext and appendContext primops 2019-03-09 19:30:56 -05:00
John Wiegley a6d753bbdd
Remove an unnecessary import 2019-03-09 16:00:30 -08:00
Ryan Trinkle a2b77f1d8a
Merge branch 'master' into ryantrinkle/splitVersion 2019-03-09 18:36:24 -05:00
Ryan Trinkle 883505f062
Merge branch 'master' into ryantrinkle/argsList 2019-03-09 18:34:19 -05:00
Ryan Trinkle ae463c83e8
Merge branch 'master' into ryantrinkle/ellipsisBinds 2019-03-09 18:02:22 -05:00
Ryan Trinkle d8a66c09ab Ellipsis shouldn't introduce anything into scope 2019-03-09 17:59:59 -05:00
John Wiegley 3b2593df47
Merge branch 'master' into ryantrinkle/splitVersion 2019-03-09 14:51:39 -08:00
John Wiegley 92c0f5a307
Merge branch 'master' into ryantrinkle/argsList 2019-03-09 14:51:21 -08:00
Ryan Trinkle b95710470c When converting to JSON, if NVSet has an "outPath" attribute, use that instead of converting the object's attributes 2019-03-09 16:06:54 -05:00
Ryan Trinkle bd867a3bef When forming derivationStrict arguments, supply `args` as a list rather than a string
Perhaps this used to be different, but as of nix-instantiate 2.1.3, `args` may not be a string
2019-03-09 16:04:41 -05:00
Ryan Trinkle 4e9ec1a964 Improve error message in case `read` fails in splitVersion 2019-03-09 15:55:31 -05:00
John Wiegley 07e6a5a381
Merge branch 'pending' 2019-03-09 11:39:19 -08:00
Doug Beardsley aa4156c5f6 Add test for currentSystem and remove hacky call 2019-03-08 23:22:43 -05:00
John Wiegley 624ec11234
Begin adding very basic source line printing 2019-03-03 14:48:49 -08:00
John Wiegley 3216a7f4ce
Create a stand-in function for pretty source location info 2019-01-08 11:00:09 -08:00
John Wiegley b6dfaa22e9
Resolve a compile-time warning 2019-01-08 10:24:40 -08:00
Ken Micklas 4f61c4f3e7 Use extractNixString for JSON string 2018-12-14 12:04:20 -05:00
Ken Micklas ad0d2d2bf8 Use WithStringContext(T) for nvalueToJSON 2018-12-13 16:59:51 -05:00
Ken Micklas 824615aabe Merge branch 'master' into xml-string-context 2018-12-10 15:48:29 -05:00
Doug Beardsley 7d2f9d874a Move json code into separate module 2018-12-09 13:57:58 -05:00
Ken Micklas b1d48c5364 Accumulate string context in builtins.toXML 2018-12-06 18:11:06 -05:00
Ken Micklas dcbde8c2d5 Add WithStringContext 2018-12-06 18:11:06 -05:00
Doug Beardsley 38147f81a9 Fix toJSON context handling and add test case 2018-12-05 14:59:42 -05:00
Doug Beardsley 5c6b1ff285 Fix replaceStrings and add test case to catch mistake 2018-12-05 11:53:59 -05:00
Doug Beardsley 5b1117f6b9 Add test case for placeholder and get it passing 2018-12-05 08:43:31 -05:00
Doug Beardsley 23250a3433 Misc cleanup 2018-12-05 06:26:59 -05:00
Doug Beardsley 1748e7ce7a Fix behavior of baseNameOf 2018-12-03 05:00:50 -05:00
Doug Beardsley 4b28407936 Fix eval-okay-context test failure 2018-12-03 00:48:15 -05:00
Félix Baylac 512a8e0f10 Change builtins.storeDir type to String
Co-authored-by: Basile Henry <bjm.henry@gmail.com>
2018-12-02 20:59:50 +00:00
Doug Beardsley ab3fc101dd Merge branch 'master' into remove-fromnix-text-instances 2018-11-29 10:36:03 -05:00
John Wiegley 83e5dc7aa3
Merge pull request #418 from haskell-nix/revert-xml-string-context
Revert "Merge pull request #413 from haskell-nix/xml-string-context"
2018-11-26 12:00:23 -08:00
Shea Levy 952e2603ea
Revert "Merge pull request #413 from haskell-nix/xml-string-context"
Let's try to find a way to avoid exporting the NixString constructors
first.

This reverts commit ed07384563, reversing
changes made to 4bfe2cc60c.
2018-11-25 08:03:30 -05:00
Domen Kožar 48fe67748b
Fix warnings 2018-11-25 10:08:17 +00:00
John Wiegley ed07384563
Merge pull request #413 from haskell-nix/xml-string-context
Accumulate string context in builtins.toXML
2018-11-24 19:15:06 -08:00
John Wiegley 4bfe2cc60c
Merge pull request #408 from domenkozar/type-string-context
Distinguish string with or without context when revealing type
2018-11-24 19:12:42 -08:00
John Wiegley a6565b62a4
Merge pull request #414 from domenkozar/issue-412
Make -v1 default for better usability on errors
2018-11-24 19:11:02 -08:00
John Wiegley f7a370b53f
Correct an informational message 2018-11-24 19:09:28 -08:00
Doug Beardsley a39a5518ea Merge remote-tracking branch 'origin/pending' into remove-fromnix-text-instances 2018-11-24 15:22:54 -05:00
Doug Beardsley 81c649b96e Fix comment 2018-11-24 15:22:02 -05:00
Domen Kožar e0af60ef67
thunk loop -> infinite recursion 2018-11-24 14:22:46 +00:00
Domen Kožar 28bfc2cbe8
Make -v1 default for better usability on errors 2018-11-24 14:13:24 +00:00
Ken Micklas 1457362184 Accumulate string context in builtins.toXML 2018-11-23 12:48:44 -05:00
Ken Micklas a43da72f9e Expose internals of NixString 2018-11-23 12:48:44 -05:00
John Wiegley e8a6fbab16
Merge branch 'master' into fix/freeVars 2018-11-22 09:49:22 -08:00
Domen Kožar 39ef69f2f9
Merge branch 'master' into type-string-context 2018-11-22 09:55:23 +00:00
Vaibhav Sagar 017ce7667a Bump Megaparsec to 7.0.4 2018-11-22 01:16:11 -05:00
John Wiegley 5ff896f571
Merge pull request #388 from haskell-nix/prettyprinter
Switch to prettyprinter library from ansi-wl-pprint
2018-11-21 15:59:49 -08:00
Doug Beardsley 31c327c406 Rename back to hacky 2018-11-21 01:55:56 -05:00
Doug Beardsley 09d9919367 Fix misleading name 2018-11-21 01:54:15 -05:00
Doug Beardsley 9e11410f6e Make note to fix toFile 2018-11-21 01:50:24 -05:00
Doug Beardsley d87122a0f2 Fix context handling in replaceStrings 2018-11-21 01:21:53 -05:00
Domen Kožar 58a83622eb
GHC 8.6 support 2018-11-20 23:44:59 +00:00
John Ericson f227911ce0 Merge remote-tracking branch 'origin/master' into prettyprinter 2018-11-20 18:23:15 -05:00
Domen Kožar 2cc20c045f
Distinguish string with or without context when revealing type 2018-11-20 12:20:16 +00:00
John Wiegley ba5b23a6e3
Bump minimum supported version to GHC 8.4.4 2018-11-19 09:46:02 -08:00
Doug Beardsley 8a97be7250 Fix behavior of match to properly return nulls 2018-11-19 09:01:34 -05:00
Doug Beardsley 752ff745a8 Remove unnecessary cases 2018-11-19 07:13:19 -05:00
Doug Beardsley a29a54b4f9 Merge remote-tracking branch 'origin/pending' into remove-fromnix-text-instances 2018-11-19 07:10:02 -05:00
Doug Beardsley 5dd3e2d7ce Remove Text FromValue, ToValue, FromNix, and ToNix
This commit makes the handling of string context much more explicit and correct
throughout entire codebase.
2018-11-19 07:04:08 -05:00
Ryan Trinkle 0a82ab26ce Merge remote-tracking branch 'origin/pending' into abstract-scopes 2018-11-18 15:04:30 -05:00
Doug Beardsley 602c673cba
Merge pull request #397 from haskell-nix/coerceToString-boolean-blindness
Create data types to avoid coerceToString boolean blindness
2018-11-17 19:00:29 -05:00
Ken Micklas 3beeaa6a79 Add and use fromStringNoContext 2018-11-17 18:40:22 -05:00
Ken Micklas ff1166aba6 replace *StringIgnoreContextMaybe with more accurate *GetStringNoContext 2018-11-17 18:40:22 -05:00
Ken Micklas 340e97e8d3 Use principledStringIngoreContextMaybe for builtins.compareVersions 2018-11-17 18:40:22 -05:00
Ken Micklas 306d710527 Use principled* functions for builtins.splitVersion 2018-11-17 18:40:22 -05:00
Ken Micklas a488e9aa5c Add principledStringIgnoreContextMaybe 2018-11-17 18:40:22 -05:00
Ken Micklas 124f7165e4 Add principledStringMempty 2018-11-17 18:40:22 -05:00
Ken Micklas a0a89248e9 Use principledMakeNixStringWithoutContext in assembleString 2018-11-17 18:40:22 -05:00
Ken Micklas c9071db5bc Use custom force for isDerivation instead of relying on valueEq 2018-11-17 18:40:22 -05:00
Ken Micklas a7bdda4912 Ignore context when comparing strings 2018-11-17 18:40:22 -05:00
Ken Micklas ff16557e34 Add principledStringIgnoreContext 2018-11-17 18:40:22 -05:00
Ken Micklas 8dc1762f8e Use curry and LambdaCase for valueEq 2018-11-17 18:40:22 -05:00
Ken Micklas a6ab1d4e27 Use principledMakeNixStringWithoutContext in Nix.Pretty 2018-11-17 18:40:22 -05:00
Ken Micklas be8390ac79 Remove unused valueText and valueTextNoContext functions 2018-11-17 18:40:22 -05:00
Doug Beardsley 4edcda00e4 Create data types to avoid coerceToString boolean blindness 2018-11-17 18:26:10 -05:00
Doug Beardsley 5fb9dae34c
Merge pull request #393 from haskell-nix/coerceToString-returns-nix-string
Make coerceToString return NixString
2018-11-17 17:05:58 -05:00
Doug Beardsley ba7fc3446d Remove hackyModifyNixContents 2018-11-17 16:23:41 -05:00
Ryan Trinkle d60130c566 Abstract Scopes 2018-11-17 16:21:03 -05:00
Doug Beardsley cda7345647 Merge remote-tracking branch 'origin/pending' into coerceToString-returns-nix-string 2018-11-17 16:15:06 -05:00
Doug Beardsley d949b9c1e1 Make coerceToString return NixString 2018-11-17 16:08:02 -05:00
Ken Micklas f617e790a4 Make null and empty string not equal
Fixes #391.
2018-11-17 16:02:27 -05:00
Ken Micklas b7ad125c46 Remove hackyStringMappend 2018-11-17 13:52:15 -05:00
Ken Micklas 4018fd0ccf Change the only use of hackyStringMConcat to principledStringMConcat 2018-11-17 13:51:47 -05:00
Doug Beardsley f01ba97edf Export principledStringMappend 2018-11-17 13:29:34 -05:00
Doug Beardsley 2d36ccbdf5 Issue #387, hackyStringMappend 2018-11-17 13:04:08 -05:00
John Ericson 04abd357bd Switch to prettyprinter 2018-11-17 12:02:26 -05:00
Ryan Trinkle e6b189e69b Eliminate MonadIO from MonadEffects instance for Lazy 2018-11-16 21:30:55 -05:00
Ryan Trinkle c655bdb9f2 Factor out MonadIntrospect 2018-11-16 21:30:55 -05:00
Ryan Trinkle 32850cd23e Factor out instantiate and exec 2018-11-16 21:30:51 -05:00
Ryan Trinkle 7f964f8d21 WIP: Eliminate pathExists in favor of doesFileExist
Needs approval from @gbwey9

TODO:
* Actually get rid of pathExists
2018-11-16 17:29:14 -05:00
Ryan Trinkle 5acd886aca Factor out MonadEnv 2018-11-16 17:17:42 -05:00
Ryan Trinkle c2be721454 Factor out HTTP requests 2018-11-16 17:17:38 -05:00
Ryan Trinkle cc7a97b545 Factor out printing text 2018-11-16 17:17:34 -05:00
Ryan Trinkle 2884c4f918 Factor out filesystem functionality into MonadFile 2018-11-16 15:16:17 -05:00
Ryan Trinkle 02e057c5c0 Factor out addPath and toFile_ into MonadStore class 2018-11-16 14:50:58 -05:00
Ryan Trinkle 6d2daf0ecd WIP: Refactor MonadVar to use ref-tf's MonadRef instead
TODO:
* Upstream GEq (STRef s)
* Eliminate shim functions
2018-11-16 14:11:37 -05:00
Ryan Trinkle 12d9924991 Make other implementations of MonadFile possible 2018-11-16 13:31:56 -05:00
Ryan Trinkle 15c33ac4c8 Whitespace 2018-11-16 13:29:31 -05:00
Ryan Trinkle 54d139d57b Expose `Nix.Pretty.valueToExpr` 2018-11-16 13:29:20 -05:00
Silvan Mosberger 292d760b12
freeVars: Fix inherit's in rec sets and let in
Previously freeVars (rec { inherit y; }) would report nothing, when
really the `y` variable is free. The same for `let inherit y; in y`
2018-11-16 17:59:03 +01:00
John Wiegley 54492e3905
Merge branch 'master' into string_context_255 2018-10-15 12:45:05 -07:00
gb 411afaca51 remove deprecation warnings so travis will succeed 2018-10-06 18:35:56 -04:00
Patrick Hilhorst 2e330b4601
s/attribut /attribute / 2018-10-02 22:13:32 +02:00
gb 4baa4f7108 change Nix.NixString module to Nix.String 2018-09-23 16:03:44 -04:00
gb be056b3dd7 builds with -Werror -Wno-deprecations 2018-09-16 16:30:24 -04:00
gb 0a5e692b1c Merge branch 'string_context_255' of https://github.com/gbwey9/hnix into string_context_255 2018-09-16 15:22:53 -04:00
gb cfa4824fb3 remove semigroup monoid and replace with nixstring methods 2018-09-16 14:02:02 -04:00
John Wiegley dddf425a22
Merge branch 'master' into string_context_255 2018-09-15 22:35:13 -07:00
gb ae6725871b removed executable permissions 2018-09-15 20:32:38 -04:00
gb dc940b8d04 fix windows line endings on these files 2018-09-15 20:16:35 -04:00
gb 6f1ed3c2e9 documented methods;added more methods with deprecation 2018-09-15 20:04:54 -04:00
Silvan Mosberger f189b69f51
More precise freeVars 2018-09-11 05:23:58 +02:00
John Wiegley bb26529c73
Merge pull request #360 from Infinisil/parser-exports
Parser exports
2018-09-10 11:57:54 -07:00
Georges Dubus 0e3ecd5ac3 Avoid corrupting the value being printed in Pretty.dethunk 2018-09-10 17:18:34 +02:00
Silvan Mosberger 08326ce34a
Parser: export symbol and whiteSpace 2018-09-10 05:10:35 +02:00
Silvan Mosberger 9a74e0cd99
Parser: Export useful partial parsers 2018-09-10 04:28:33 +02:00
Silvan Mosberger c01fa83cb6
Parser: Unify parser names 2018-09-10 04:10:53 +02:00
Silvan Mosberger 67934d030a
Parser: Make Result Functior 2018-09-10 03:30:15 +02:00
gb a57aa711df tests run 2018-09-09 11:47:04 -04:00
gb 2fadbe3090 add new nixstring version with warnings 2018-09-09 11:01:09 -04:00
John Wiegley 833851392d
Merge remote-tracking branch 'origin/master' into pending 2018-09-07 13:16:28 -07:00
John Wiegley 99626e9ab9
The use of liftM2 (<|>) was executing too much of both arguments
This is demonstrated by the following example, courtesy of Ryan Trinkle:

    let x = with x; with { a = 5; }; a; in x

Although the dynamic scopes visible at 'a' happen to be [<thunk: { a = 5; }>,
<thunk: x>], we were forcing each thunk before doing the M.lookup, and then
performing (<|>) on the M.lookup.

Fixes #347
2018-09-07 13:08:30 -07:00
Jude Taylor a604a74af9 make mapAttrs take both arguments 2018-09-04 14:17:14 -07:00
Domen Kožar 4501319e81
<<loop>> is already GHC RTS error, tweak a bit 2018-09-03 21:17:50 +01:00
John Wiegley 7c9211d6e0
Merge pull request #352 from pikajude/path-tarball
Support tarballs in NIX_PATH and -I
2018-09-03 10:04:19 -07:00
John Wiegley 34054285e3
Merge pull request #332 from obsidiansystems/issue-327-fix
Fix missing parenthesis in pretty printing selector
2018-09-03 10:04:07 -07:00
John Wiegley ed99b7ad18
Merge branch 'master' into mapattrs 2018-09-02 19:15:04 -07:00
John Wiegley e31ad9cb30
Merge branch 'master' into issue-327-fix 2018-09-02 19:12:08 -07:00
Jude Taylor 84e0594139 fix ghc 8.2 build 2018-09-02 15:20:17 -07:00
Jude Taylor 368f7e038c support tarballs in NIX_PATH and -I 2018-09-02 11:25:24 -07:00
John Wiegley 7d549d67c6
Merge remote-tracking branch 'origin/master' into pending 2018-08-23 21:08:12 -07:00
Jörg Thalheim c890965bb4 add builtins.{bitAnd,bitOr,bitXor) 2018-08-20 17:04:55 -05:00
John Wiegley 0613d1d604
Finish implementation of cycle detection during normalization 2018-08-10 17:50:07 -04:00
John Wiegley f0b6b6b223
Change NValueNF to use Free instead of Fix
This allows us to detect and report cycles during normalization.

See #348
2018-08-09 22:09:00 -04:00
Matthew Bauer 10fe907c50 Add builtins.mapAttrs
Fixes #341
2018-08-09 18:23:13 -04:00
Matthew Bauer d538a96723 Fix missing parenthesis in pretty printing selector
Fixes #327

Another case of missing parenthesis. From the issue:

> prettyNix $ ("x" @@ "y") @. "z"
  x y.z

When it should be:
  (x y).z

Adding non-associative wrapParens seems to fix it. Not sure if this is
the best way but trying a few things & running the test suite still
seem to work.
2018-08-08 17:17:19 -04:00
John Wiegley 266793a287
Improve an error message 2018-08-07 14:06:50 -04:00
John Wiegley 456e0811bc
Merge remote-tracking branch 'origin/master' into pending 2018-08-06 16:15:14 -04:00
Domen Kožar 6033a49e6d
Implement addErrorContext as id 2018-08-06 21:09:30 +01:00
John Wiegley b0541ebd24
Some minor refactoring 2018-08-05 16:12:04 -04:00
John Wiegley 023dbe55ea
Change tracing output from normalFormBy 2018-08-05 15:51:59 -04:00
John Wiegley f262046f34
Change coerceToString to also take a coerceMore argument 2018-08-05 15:51:42 -04:00
John Wiegley 49584cbae5
Reformat a function body 2018-08-05 15:49:16 -04:00
John Wiegley 2e04e5a7b2
Change rendering of NormalLoop errors 2018-08-05 15:48:52 -04:00
John Wiegley e8a7368a92
Some whitespace changes 2018-08-05 15:48:44 -04:00
John Wiegley 1af979e836
true and false shouldn't be in the reservedNames list
Fixes #343
2018-08-05 12:20:00 -04:00
John Wiegley 8e664631e2
If an exception occurs when forcing a thunk, cleanup the "active" bit 2018-08-05 12:00:43 -04:00
John Wiegley edaf59b56a
Add a bogus MonadCatch instance for (Lint s) 2018-08-05 12:00:33 -04:00
John Wiegley bef6db5beb
Minor reformatting 2018-08-05 10:40:28 -04:00
Daniel Krol 13f548c7af Fix previous attempted cosmetic refactor which broke eval-okay-overrides test 2018-08-05 10:25:22 -04:00
John Wiegley a2771e6f23
Merge remote-tracking branch 'origin/master' into pending 2018-08-05 09:54:08 -04:00
John Wiegley 6830d88523
Fix the way that rec { foo.bar = bar; } is desugared
Fixes #338
2018-08-05 09:53:20 -04:00
John Wiegley 7b2f66e59e
Improve the Expectation error 2018-08-04 19:05:01 -04:00
Daniel Krol e8d75e4ab6 Change a lambda to an `uncurry` 2018-08-04 17:47:55 -04:00
John Wiegley 8bfec34901
Resolve a compiler warning 2018-08-04 16:40:17 -04:00
John Wiegley 50740972de
'import' should never carry over the lexical scope of its parent file
Fixes #334
2018-08-04 15:08:36 -04:00
John Wiegley 705d7c474d
Add --scopes option to print out scoping information 2018-08-04 14:40:04 -04:00
Jude Taylor b42a6e1cfd Catch InappropriateType error in pathExists 2018-08-01 20:09:26 -07:00
John Wiegley 1cf25fa26f
Merge branch 'master' into func-equal 2018-07-31 21:52:40 -04:00
Matthew Bauer 5709d52d60 Use non-associative for ‘or’ selector
When an expression looks like this:

  a.b or (0 == 0)

The precedence wasn’t being applied correctly in the pretty printer.
The parenthesis were left off so that the pretty printer produced,

  a.b or 0 == 0

While they look similar, without the parenthesis the expression would
take (a.b or 0) as one expression. This caused an error in the
Pretty/Parse Property tests. Disabling associativity for the (0 == 0)
part fixed this.

Fixes #305
2018-07-31 17:55:51 -04:00
gb fd2bbb66e9 fixes to match latest master: tests ran 2018-07-28 15:32:15 -04:00
gb 9c3e5e995c update fork from master contd 2018-07-28 14:17:37 -04:00
gb ea3b675f28 update fork from master 2018-07-28 13:23:23 -04:00
Matthew Bauer 39100fa19e Fix Nixpkgs evaluation on Functions
Nix says that { f = x: x; } == { g = y: y; }. The rule says to ignore
functions when comparing attribute sets or lists. This commit follows
this rule. However, it is still true that:

(x: x) /= (y: y)

I have also added some tests that check for these cases.

Fixes #323
2018-07-25 21:00:16 -04:00
Félix Baylac-Jacqué e246bdd647
Add recursive NSelect reduction. 2018-06-26 10:28:33 +02:00
Félix Baylac-Jacqué 32fa31353c
Add missing sAttrPath base case. 2018-06-25 17:19:39 +02:00
Félix Baylac-Jacqué cd90a9aff7
Add basic NSelect reduction strategy. 2018-06-25 17:19:29 +02:00
Félix Baylac-Jacqué 13cfce4e01
Documenting reductions behaviour. 2018-06-25 17:18:36 +02:00
Félix Baylac-Jacqué d3cbcf791c
Builtins.div cannot divide by 0
Fixes #277.
2018-06-12 21:54:28 +02:00
Dmitry Rets 3a096cc93b Implement top-level __findFile.
Fixes https://github.com/haskell-nix/hnix/issues/248.
2018-05-20 23:39:24 +02:00
John Wiegley 9617c90a9e
Change the name of TArr to :~> 2018-05-17 22:16:50 -07:00
John Wiegley 738ef09bf9
Make NUnaryOp and NBinaryOp both Enum and Bounded 2018-05-14 21:22:04 -07:00
John Wiegley 60231bd38a
Merge branch 'master' into master 2018-05-14 21:15:07 -07:00
hsloan f7ff858ef9 add builtins.toFile 2018-05-14 22:54:34 -04:00
John Wiegley 7e8b0552a0 Fix to the pretty printing of @ names 2018-05-14 22:45:43 -04:00
John Wiegley fd9b77c29b Don't include Control.Applicative where not necessary 2018-05-14 22:45:43 -04:00
John Wiegley 6aa64760d1 Make use of lens-family to provide some utility lenses/traversals 2018-05-14 22:45:43 -04:00
Blair Archibald b89cba0525 Fix #280. unsafeGetAttrPos should return null.
According to the expected test output, unsafeGetAttrPos should fail silently and
return null if it can't find a position for the field (e.g when looking up
builtins).
2018-05-14 22:45:43 -04:00
Matthew Pickering ce46f58b2c Escape paths when used in a selector
./a."abc" gets parsed as App (./a.) "abc"
when pretty printing, it is necessary to escape the path to
${./a}."abc" so that it is then parsed correctly.
2018-05-14 22:45:43 -04:00
Matthew Pickering ed089f57b8 Fix pretty printing of EscapedNewline 2018-05-14 22:45:43 -04:00
John Wiegley 45da41666b Make use of attrsetGet in another place 2018-05-14 22:45:43 -04:00
John Wiegley 6b34ea3ee5 Add a Calling info frame 2018-05-14 22:45:43 -04:00
John Wiegley 7c0ba49ab1 Some very minor fixes to warnings 2018-05-14 22:45:43 -04:00
Doug Beardsley d912441e3c
Changes for building hnix for GHCJS 2018-05-13 14:17:55 -07:00
John Wiegley 84ebf8d9ae
A fix to the way inherit is parsed 2018-05-13 14:10:02 -07:00
gb 0df2bb35d6 forgot to add NixString 2018-05-13 14:13:30 -04:00
John Wiegley b60a15dc0d
Change the way that serialise is guarded from inclusion
Fixes #312
2018-05-11 12:15:18 -07:00
John Wiegley 35fb7dc974
Add instance Lift (Fix NExprF) for GHC 8.0 2018-05-10 15:35:53 -07:00
John Wiegley e06ab95236
Allow NFData instances for NExpr and NExprLoc on GHC 8.0 2018-05-10 15:26:37 -07:00
John Wiegley dbd8468862
In Builtins.hs, just include derivation.nix directly 2018-05-10 13:51:14 -07:00
John Wiegley 0d6b6e7807
Allow Nix quasi-patterns
For example:

    foo [nix| 2 + 3 |] = ...

Is equivalent to pattern matching on the constructors that make up the parsed
version of the expression. This can make it much quicker to identify pattern
you're looking for in a parsed body of Nix code.
2018-05-10 01:18:28 -07:00
John Wiegley 13edc1da30
Allow Nix quasi-quoter to refer to and promote Haskell variables 2018-05-10 01:14:13 -07:00
John Wiegley f59a17db72
Some refactoring and simplification in Eval.hs 2018-05-10 00:33:46 -07:00
John Wiegley 1d5c0370ae
Simplify definition of getAttr 2018-05-10 00:09:42 -07:00
John Wiegley d805fa3627
Preserve attr name positions in attrSetAlter 2018-05-10 00:09:42 -07:00
John Wiegley d5023ed3cf
Allow adding sets with outPath to strings 2018-05-09 22:17:32 -07:00
John Wiegley 8ebac49b95
Make builtins.toString much better behaved 2018-05-09 22:17:32 -07:00
John Wiegley 31f3dc0766
Desugar NSet binds as well as NRecSet, remove an always True parameter
Fixes #310
2018-05-09 15:03:11 -07:00
John Wiegley b01b7449d4
Make the --trace output a little more readable 2018-05-09 14:39:27 -07:00
John Wiegley bcadd1f89b
Tiny refactor 2018-05-09 14:39:21 -07:00
John Wiegley b186e44174
--force was a needless duplicate of --strict 2018-05-09 13:52:34 -07:00
John Wiegley e9006ff98b
Fix a problem with static processing of imports 2018-05-09 13:36:06 -07:00
John Wiegley 15baa5c8b8
Track attribute source positions in the binding, not the key name 2018-05-09 01:25:01 -07:00
John Wiegley ba0dc19d2d
Work from mightybyte: Minimize deps required, for building with GHCJS 2018-05-08 16:41:15 -07:00
gb 43c145252d NixString is in its own module hiding the constructors 2018-05-08 16:47:50 -04:00
John Wiegley 449d6611df
Remove the Uri type, it's just sugar
Fixes #308
2018-05-08 12:15:50 -07:00
gb fbcb258eb4 Merge branch 'master' of https://github.com/haskell-nix/hnix into string_context_255 2018-05-08 14:44:47 -04:00
gb 82c0d917e9 add hashable import 2018-05-08 14:40:49 -04:00
John Wiegley ce3b0d70e9
Move all of the parsing code into a single module, for optimization 2018-05-07 12:06:56 -07:00
John Wiegley 76a54f5580
Fix to the pretty printing of @ names 2018-05-06 22:14:01 -07:00
John Wiegley f1faf50bcb
Merge branch 'master' into string_context_255 2018-05-06 10:47:23 -07:00
John Wiegley b79a44bd95 Don't include Control.Applicative where not necessary 2018-05-06 10:43:43 -07:00
John Wiegley e7a6456a35 Make use of lens-family to provide some utility lenses/traversals 2018-05-06 10:43:43 -07:00
John Wiegley 05088a9dbd
Merge pull request #302 from BlairArchibald/fix/280
Fix #280. unsafeGetAttrPos should return null.
2018-05-06 10:41:38 -07:00
John Wiegley b886e5825e
Merge pull request #229 from mpickering/quickcheck-expr
Add QuickCheck test for pretty printer and parser
2018-05-06 10:41:05 -07:00
Blair Archibald aae7f13ab1 Fix #280. unsafeGetAttrPos should return null.
According to the expected test output, unsafeGetAttrPos should fail silently and
return null if it can't find a position for the field (e.g when looking up
builtins).
2018-05-06 13:17:43 +01:00
Matthew Pickering ae0167110d Escape paths when used in a selector
./a."abc" gets parsed as App (./a.) "abc"
when pretty printing, it is necessary to escape the path to
${./a}."abc" so that it is then parsed correctly.
2018-05-06 10:31:52 +00:00
Matthew Pickering 34d0552517 Fix pretty printing of EscapedNewline 2018-05-06 10:31:52 +00:00
John Wiegley 9e50e9e069 Make use of attrsetGet in another place 2018-05-06 00:35:29 -07:00
John Wiegley 11a89d2b40 Add a Calling info frame 2018-05-06 00:35:21 -07:00
John Wiegley 888944ebff Some very minor fixes to warnings 2018-05-06 00:34:38 -07:00
gb 8e7d9d32fa add string context 2018-05-03 08:07:54 -04:00
John Wiegley b1b027286b Fix a warning in Builtins.hs 2018-05-02 21:39:23 -07:00
John Wiegley a627d885e8 Implement builtins.fetchurl
Squashed commit of the following:

commit 15b10d898e0457237f07cda9e5e9525bac0e95f6
Author: John Wiegley <johnw@newartisans.com>
Date:   Wed May 2 16:33:30 2018 -0700

    Update Exec.hs

commit d4a886dccf2715f1c1790e01adc242c352e7f427
Merge: 02afb27 4caacc1
Author: John Wiegley <johnw@newartisans.com>
Date:   Wed May 2 16:08:55 2018 -0700

    Merge branch 'master' into http

commit 02afb275f2078c1184a901da3ea0262630fefeea
Author: John Wiegley <johnw@newartisans.com>
Date:   Wed May 2 16:08:42 2018 -0700

    Update Exec.hs

commit 3733ce5888adb7161d2f57a16204ab953e9c4d7d
Author: John Wiegley <johnw@newartisans.com>
Date:   Wed May 2 16:07:08 2018 -0700

    Update Builtins.hs

commit 4402be6d04ac34156d50f8ee29f9af300de75ce5
Merge: 2c60097 13f3ebd
Author: John Wiegley <johnw@newartisans.com>
Date:   Wed May 2 15:06:28 2018 -0700

    Merge branch 'master' into http

commit 2c600976bb3a5d9267a0f313487dd0ab1a6ce1f7
Merge: 4a9d1a5 555ce95
Author: John Wiegley <johnw@newartisans.com>
Date:   Wed May 2 14:25:59 2018 -0700

    Merge branch 'master' into http

commit 4a9d1a56d463567ad155a58fc39f5b24e2636120
Merge: 4dd46f2 431006f
Author: John Wiegley <johnw@newartisans.com>
Date:   Wed May 2 14:20:57 2018 -0700

    Merge branch 'master' into http

commit 4dd46f21e3f594c4f7ae5bee8412a7841e566d4c
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sun Apr 29 12:51:11 2018 -0700

    generated hnix.cabal

commit c87ae993fb7dbb1117f03133862799e1549c4259
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 16:55:11 2018 -0700

    remove dep from hnix.cabal

commit 0bb8856c8759ad3c67a0b4eb1d26b6195da82667
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 16:53:54 2018 -0700

    remove http-client stuff from default.nix

commit d298756a2ba4376f8cb3c54fb723a00697e0821d
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 15:49:59 2018 -0700

    getURL is implemented for both http and https

commit a3d66c07a097aedb03f30bcc636fcb3d5717e1fe
Merge: c4cb48a a73eae5
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 15:14:32 2018 -0700

    Merge branch 'builtin2' into http

commit c4cb48a8a756e82fb7d389ff501b2a85001dba38
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 15:13:25 2018 -0700

    add getURL function

commit ff23fc18ed16075353a58725d7d08f41605a6070
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 15:06:40 2018 -0700

    use http-client-* instead of HTTP

commit fcbe40f3bea84607a9d7849a9f3d2fc3a6cb9bef
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 14:58:07 2018 -0700

    add HTTP

commit a73eae573a193dbb8361e03b584a6cd55e7c427a
Author: Ian-Woo Kim <ianwookim@gmail.com>
Date:   Sat Apr 28 14:36:24 2018 -0700

    implement fetchurl (as a copy of fetchTarball)
2018-05-02 21:38:39 -07:00