Commit graph

766 commits

Author SHA1 Message Date
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
hsloan c1561ea711 Implement builtins.currentTime 2018-05-02 21:32:00 -07:00
Alex Rozenshteyn a355366f32 Add builtins.hasContext 2018-05-02 20:54:51 -07:00
John Wiegley fe4629c3a4 More fixes to type inference 2018-05-02 15:08:53 -07:00
John Wiegley a2e9334648 Factor out a staticImport function in Reduce.hs 2018-05-02 15:08:53 -07:00
John Wiegley 593992eb26
Merge branch 'master' into merge257 2018-05-02 14:24:57 -07:00
John Wiegley 555ce952ae
Merge pull request #285 from jwiegley/pending
Further corrections to type checking functions that take sets
2018-05-02 14:24:05 -07:00
John Wiegley fe0357c572
Merge branch 'master' into merge257 2018-05-02 14:22:47 -07:00
John Wiegley 431006f524
Merge pull request #263 from gdevanla/master
add TopLevel placeHolder to builtins module
2018-05-02 14:19:10 -07:00
John Wiegley 0b74225bcb
Update Builtins.hs 2018-05-02 14:18:45 -07:00
gb b07927a136 cleanup exec' 2018-05-02 14:10:49 -07:00
gb 6aeaba6209 adding builtins.exec 2018-05-02 13:58:56 -07:00
gb d07888ed35 implemented builtins.trace 2018-05-02 13:58:30 -07:00
John Wiegley 18fc312112 Further corrections to type checking functions that take sets 2018-05-02 13:46:32 -07:00
John Wiegley 8538859230 Work on type inference for functions that take attr sets 2018-05-01 21:50:50 -04:00
John Wiegley 49e71222c3 Instead of EqConstOneOf, use TMany which is more fundamental
This allows both multiple function types, or a function that might return one
of many possible values, for example.
2018-05-01 21:04:10 -04:00
John Wiegley ee8ba02dfd Much more work on type inference; report multiple possible types
This is needed because of a function like this:

    x: y: x + y

This is polymorphic, but over exactly four possibilities:

    int   -> int
    int   -> float
    float -> int
    float -> float

The "type" is really the combination of the four, since we don't yet have a
mechanism like type classes, which could have rendered this as a single type:

    (Num a, Num b) => (x :: a): (y :: b): x + y

Going this route will require that we manage an implicit type classes
hierarchy, and perform unification on constraints as well as types. In the
interim, I just lifted the unification algorithm into the LogicT monad, and
use back-tracking search to find all the possible types an expression could
be.

The main problem with using LogicT, however, is that there are many types
it *couldn't* be, and in the case of a unification failure, it not yet clear
what the type should have been.  For example:

    "foo" + 2

Should the string have been a float or an integer or a path? Or should the
integer have been a string? So for now we report all the possibilities, since
it's not obvious which part of the expression is in error:

    hnix: Type error: TypeInferenceErrors
      [ UnificationFail (TCon "integer") (TCon "string")
      , UnificationFail (TCon "string") (TCon "path")
      , UnificationFail (TCon "string") (TCon "float")
      , UnificationFail (TCon "string") (TCon "integer")
      ]

This is a case where enumerating types rather than trying to make them compact
using type classes might actually be an improvement, since the errors here
would have been only slightly less numerous:

    string  != Num a => a
    string  != path
    integer != string

Clearly a better reporting mechanism is needed to clarify these problems. I
can imagine that in an IDE, there would be a squiggly under both sides of the
expression, each suggesting the type that was expected for that argument under
the assumption that the other argument (the one not be inspected) was the
correct one.
2018-05-01 20:49:10 -04:00
John Wiegley 18063e5acd Importing Control.Monad.ST.Unsafe was not needed in Lint.hs 2018-05-01 20:34:48 -04:00
John Wiegley acda2b3337 Use Exception rather than Frame, reduce constraints imposed by forceThunk 2018-05-01 20:34:41 -04:00
John Wiegley f662d44c56 Hindley-Milner is close to working, just the MonadFix problem again 2018-04-30 21:52:25 -04:00
John Wiegley 45beddb7d7 Revise the arguments to MonadEval.evalString 2018-04-30 21:48:45 -04:00
John Wiegley 107dd82401 Weaken the constraints required by MonadEval 2018-04-30 21:48:45 -04:00
John Wiegley f5038453ae Add all of the Nix types to Nix.Type.Type 2018-04-30 21:48:45 -04:00
John Wiegley a735d3ffb6 Add two new helper instances for Has 2018-04-30 21:48:45 -04:00
John Wiegley 3b738e3aa3 Relieve MonadEval of an unnecessary constraint 2018-04-30 21:48:45 -04:00
John Wiegley b8307d2fb5 Initial version of the attribute finder, still needs tweaking
```
hnix -I nix=$PWD/data/nix/corepkgs --find \
  --eval --expr "import $HOME/src/nix/nixpkgs {}" \
  -A pkgs.haskellPackages
```
2018-04-30 21:48:45 -04:00
John Wiegley fa25415cb7 When nix-instantiate fails, show the contents of stderr 2018-04-30 21:48:45 -04:00
John Wiegley 714c86adde Make the thunk index parameter always available, if sometimes unused 2018-04-30 21:48:45 -04:00
John Wiegley c934c690e3 Add attrsetGet helper function to Builtins.hs 2018-04-30 21:48:45 -04:00
John Wiegley bdce698e36 Merge remote-tracking branch 'origin/pr/272' 2018-04-30 19:48:14 -04:00
John Wiegley 70acb77826
Merge branch 'master' into master 2018-04-29 18:02:46 -07:00
Guru Devanla 0268b5cf2b remove extra spaces 2018-04-29 15:15:38 -07:00
Guru Devanla eefc698bde fix type of builtin.placeholder, add tests 2018-04-29 15:10:52 -07:00
Tim Sears a49a424813 add builtins.mul, issue #250 2018-04-29 11:43:06 -07:00
Guru Devanla 2819ccbc8f merged from origin 2018-04-29 10:37:16 -07:00
John Wiegley 005fe53733
Merge branch 'master' into easy-builtins 2018-04-29 10:28:13 -07:00
Alex Rozenshteyn f3cad22e1e Add builtins.true, builtins.false, and builtins.null 2018-04-29 10:07:37 -07:00
John Wiegley 829e0a63ab
Merge branch 'master' into master 2018-04-28 23:32:18 -07:00
John Wiegley ab12d3bc83 Add a missing call to const 2018-04-28 18:39:56 -07:00
John Wiegley 6ddad11de5 Further guards against using ghc-datasize on GHC 8.4 2018-04-28 18:38:43 -07:00
John Wiegley b78a44f1c7
Merge branch 'master' into simplify-builtins 2018-04-28 18:33:24 -07:00
John Wiegley 7f01cc8bb8 valueSize will not work with GHC 8.4 right now
ghc-heap-view hasn't been updated yet
2018-04-28 18:29:37 -07:00
John Wiegley 86b0dad65b Define builtins.valueSize 2018-04-28 18:29:25 -07:00
John Wiegley 1cf1a5410e Fix an hlint warning 2018-04-28 17:13:05 -07:00
John Wiegley b24598b3a3 Add top-level __valueSize
Fixes #253
2018-04-28 17:12:32 -07:00
Shea Levy 674601ad39
builtins: Simplify generating the full builtins list. 2018-04-28 16:54:16 -07:00
John Wiegley 9f41a1938f
Merge branch 'master' into master 2018-04-28 16:35:10 -07:00
John Wiegley 0b6c52eb45 Remove all warnings 2018-04-28 16:26:32 -07:00
John Wiegley a4f24f148f Comment out a function not currently being used 2018-04-28 16:26:32 -07:00
John Wiegley 100c41db6d Run the repl in the same MonadNix environment as Main.hs
Fixes #204
2018-04-28 16:26:32 -07:00
John Wiegley 1093c1ff6e
Merge pull request #261 from timsears/master
allow floating point values to be used with builtins.add. Fixes Issue…
2018-04-28 15:57:37 -07:00
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 e68a94b955 Remove some commented out code 2018-04-28 06:57:46 -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 a9c9d8bb10 Create new renderExpr and renderValue helper functions 2018-04-27 20:36:38 -07:00
John Wiegley 0a21eb755c A minor naming change for consistency 2018-04-27 20:08:47 -07:00
John Wiegley ecdb798560 Show the position when an assertion fails 2018-04-27 16:36:24 -07:00
John Wiegley 1e2bd9eb2f Silence a warning 2018-04-26 22:30:42 -07:00
John Wiegley 05b96eda5c Anything any two objects to be compared for equality or inequality 2018-04-26 22:30:32 -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 95c2ba52c9 Only gather thunk provenance if --thunks had been specified 2018-04-26 15:58:59 -07:00
John Wiegley 9cfd9f5781 Cache imports, to ensure they only happen once
This way, even if a function imports the same file multiple times, we only do
it once.

Note that the REPL will need a way to expunge things from this cache if they
are changed during the session, by listening to filesystem notifications.
2018-04-25 21:02:53 -07:00
John Wiegley defc5ed66d Add a new --values option for selectively displaying value provenance 2018-04-25 20:49:16 -07:00
John Wiegley 5f4a4096cf Whitespace fix 2018-04-25 20:46:46 -07:00
John Wiegley 49eea12262 Use fromValue defensively wherever possible in Builtins.hs 2018-04-25 20:46:31 -07:00
John Wiegley ee60ef6435 Fix printing of recursive thunks in Pretty.hs 2018-04-25 20:30:44 -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 56d72cacf9 Cleanup coerceToString and its use 2018-04-25 20:22:48 -07:00
John Wiegley 3ddba86a78 Add a comment about future work to Frame.hs 2018-04-25 20:22:40 -07:00
John Wiegley 7759d171e8 Add new convertNix function in Convert.hs 2018-04-25 20:22:31 -07:00
John Wiegley bb361afa3c Add an improvement to the reduction code for later 2018-04-25 14:58:16 -07:00
John Wiegley 05ca87a732 Several improvements to error reporting; add new --thunks option 2018-04-25 13:00:41 -07:00
John Wiegley 19973d7529 Drop inherit (null) ... during reduction; add a comment 2018-04-25 01:10:40 -07:00
John Wiegley 7af4c13455 Some minor improvements to evalSelect 2018-04-25 01:10:25 -07:00
John Wiegley cfdb314f9e Simplify foldl'_ a bit 2018-04-25 01:10:15 -07:00
John Wiegley 35b1071665 A few more provenance fixes, but more to come 2018-04-24 23:24:26 -07:00
John Wiegley 68d81dd57c More work on provenance reporting 2018-04-24 23:09:43 -07:00
John Wiegley b83ccb40f3 Add provenance to thunks, and allow provenance to stack 2018-04-24 21:41:23 -07:00
John Wiegley 2de8c7cf84 More fixes to error reporting 2018-04-24 12:25:40 -07:00
John Wiegley 01bcb86d3f Further improvements to error rendering, but not all done yet 2018-04-24 11:12:20 -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 caf0a4a6a2 Add support for building with GHC 8.4.1, also on Travis 2018-04-23 16:39:37 -07:00
John Wiegley 2aa418d60a Record contextual provenance more fully in some places 2018-04-23 10:18:47 -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 4ff0c483bf Improve printing of provenance information, add more info 2018-04-23 10:06:49 -07:00
John Wiegley 3cf02e3902 Track value provenance during evaluation 2018-04-22 14:33:38 -07:00
John Wiegley a63d3ac30d Remove some commented out code 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 c7b6465016
Merge pull request #190 from domenkozar/pretty-tilde 2018-04-22 09:24:42 -07:00
Domen Kožar 7ef7a0bb00
Pretty: handle tilde in paths 2018-04-22 15:06:57 +01:00
John Wiegley 9e5c8a340e Move nNull into Annotated.hs 2018-04-21 22:16:32 -07:00
John Wiegley 8003b96f9c In Nix.Convert, instance are now for NValueF m r instead of NValue m
This will allow the re-use of many of these instances for NValueLoc m.
2018-04-21 18:18:03 -07:00
John Wiegley e934695640 Add another functional dependency to MonadThunk 2018-04-21 18:17:53 -07:00
John Wiegley 44ff385c1d Make the Deferred type Functor, Foldable and Traversable 2018-04-21 18:17:42 -07:00
John Wiegley 7cebf1e019 Very minor code simplification 2018-04-21 10:52:01 -07:00
John Wiegley c9b258788d Allow comparison of sets with null 2018-04-21 10:51:54 -07:00
John Wiegley 9937453ef2 Ensure that the --trace option persists through imports 2018-04-21 10:36:32 -07:00
John Wiegley 96a0c387dd Merge Nix.Trace and Nix.Reduce into Nix.Reduce
Since almost all of that code had to do with program reduction. addTracing and
tracingEvalExpr have moved into Exec.hs, since they depend on MonadNix.
2018-04-21 10:28:09 -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 fc85f1a7b9 Delete some commented out code in Reduce.hs 2018-04-21 00:54:40 -07:00
John Wiegley 89185b5bd3 When --reduce-sets is on, try providing defaults for all function arguments 2018-04-21 00:48:04 -07:00
John Wiegley c2a79cb100 Enable --reduce-lists and --reduce-sets 2018-04-21 00:48:04 -07:00
Kaushik Chakraborty bbb72654d7
Parser: support tilde in paths 2018-04-21 11:47:57 +05:30
John Wiegley 86b09103d6 Move production of a reduced test case to --reduce, improve --trace 2018-04-20 22:36:40 -07:00
John Wiegley 47e8829a28 Rename Nix.StringOperations to Nix.Strings 2018-04-20 17:05:21 -07:00
John Wiegley e68e369de2 Simplify the type of 'adi' 2018-04-20 12:31:46 -07:00
John Wiegley 986a3043da Add a constant-folding tree transformer: Reduce.reduceExpr 2018-04-20 02:57:23 -07:00
John Wiegley bf0dd66624 Add pattern synonyms for matching on NExprLocF types 2018-04-20 01:33:37 -07:00
John Wiegley bc832ed58a Generalize some definitions in Trace.hs 2018-04-20 01:33:37 -07:00
Domen Kožar 9fb4047bdc
Pretty: handle variadic params + tests 2018-04-20 01:05:20 +01:00
John Wiegley b8af0ce22b Change a use of traceM to putStrLn 2018-04-19 12:47:24 -07:00
John Wiegley 8fc1b831f9 Drop a comment 2018-04-19 12:47:20 -07:00
John Wiegley 3ad944b619 Several fixes to the --trace logic 2018-04-19 01:39:12 -07:00
John Wiegley 5039ac9c34 Clarify an unexpected situation 2018-04-19 01:20:27 -07:00
John Wiegley aad7bcd525 Pretty printer was dropping antiquoted selector paths 2018-04-19 01:20:17 -07:00
John Wiegley 9950d917a0 In Nix world, 1 is the highest precedence, 14 the lowest 2018-04-19 01:09:57 -07:00
John Wiegley dc7cc25a48 Remove an incorrect comment 2018-04-19 00:53:33 -07:00
John Wiegley 2182288bbd More fixes to --trace 2018-04-19 00:43:50 -07:00
John Wiegley 61bf676cbf Add a comment to Pretty.hs 2018-04-19 00:43:41 -07:00
John Wiegley bb0e0d987c Slight improvements to the pretty printing output 2018-04-19 00:24:01 -07:00
John Wiegley 4163d35a09 nixpkgs allows let with no bindings in some places
At the beginning of arangodb/default.nix:

```
{ stdenv, fetchFromGitHub
, openssl, zlib, python2Packages, readline, cmake, python }:

let
in stdenv.mkDerivation rec {
  version = "3.3.4";
  name    = "arangodb-${version}";
```
2018-04-18 23:42:13 -07:00
John Wiegley 512e3bb01d When using --trace, first statically import all referenced files
This helps with reducing down the test case to a single file.
2018-04-18 23:22:05 -07:00
John Wiegley 40742d3b7b Remove some tracing statements 2018-04-18 23:21:30 -07:00
John Wiegley 2c80225241 Add a new --trace option, separate from verbosity levels 2018-04-18 23:20:58 -07:00
John Wiegley c7cdbb3fbf Delete some commented out code 2018-04-18 21:54:38 -07:00
John Wiegley 0ff6c7a1e4 Move tracing code into its own file 2018-04-18 21:43:18 -07:00
John Wiegley dc421037d3 First take at extending tracing evaluator to print the evaluated tree 2018-04-18 21:39:50 -07:00
John Wiegley c1accf39f4 Some changes to the tracing info 2018-04-18 17:35:05 -07:00
John Wiegley 8ae7cd3c7d Add additional tracing statement around NSelect 2018-04-18 16:45:43 -07:00
John Wiegley 92217059b5 Add --flags=tracing, and document it in README.md 2018-04-18 16:28:21 -07:00
John Wiegley 7188c71d0a Add more evaluation context information, for -v2 or higher 2018-04-18 16:12:31 -07:00
John Wiegley 2bce4f818d Add more tracing statements in Eval.hs 2018-04-18 16:10:04 -07:00
John Wiegley 6ce3764ae7 Remove commented out #define from Utils.hs; this should be passed to cabal 2018-04-18 16:09:12 -07:00
John Wiegley 1cb30042df Add better tracing in Thunk.hs when <<loop>> is encountered
This relies on an unsafe global counter, so it's only available when
ENABLE_TRACING is defined.
2018-04-18 16:09:08 -07:00
John Wiegley 03512cc4e6 Use MonadThunk in Lint.hs 2018-04-18 14:42:41 -07:00
John Wiegley e7ec507db8 Use Void to make an intention clearer 2018-04-18 13:28:19 -07:00
John Wiegley 20ac31db52 Change a putStrLn into a traceM 2018-04-18 13:27:25 -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 718b6e4220 Also coerce URIs to paths 2018-04-17 21:43:57 -07:00
John Wiegley 25f1e02966 Coerce URIs to strings 2018-04-17 21:41:26 -07:00
John Wiegley b4ef85ae1c Whitespace changes in Exec.hs 2018-04-17 21:34:41 -07:00
John Wiegley fe2bb1df25 Improvement to the implementation of derivationStrict
Things are still not 100% complete yet, though
2018-04-17 21:32:20 -07:00
John Wiegley 114931bda8 Pass a 0 argument where needed 2018-04-17 20:44:20 -07:00
John Wiegley f64c8fc78b Some notes and minor improvements 2018-04-17 20:44:10 -07:00
John Wiegley 22b4f028cc Simplify some code in Exec.hs 2018-04-17 20:44:01 -07:00
John Wiegley 50553ba6a7 Guard normalization against forcing too deeply 2018-04-17 20:43:47 -07:00
John Wiegley f7d4374da5 Sets can coerce to strings if they contain an "outPath" key 2018-04-17 19:10:36 -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 a773e0b17a Some scoping clarifications in buildArgument 2018-04-17 18:57:58 -07:00
John Wiegley ac662e1686 Evaluate function arguments within their lexical scope 2018-04-17 18:54:32 -07:00
John Wiegley 1545c39978 Don't use fromValueMay if the conversion is not optional 2018-04-17 18:52:08 -07:00
John Wiegley 27b41403b8 Always evaluate the argument to 'with' in its enclosing lexical scope 2018-04-17 18:46:36 -07:00
John Wiegley dcf30e2c74 Simplify some code relating to inherit 2018-04-17 18:44: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 dfe9869472 Add new option --force, which forces evaluation results to normal form 2018-04-17 18:12:19 -07:00
John Wiegley 6650dd827a Delete some overly verbose tracing output 2018-04-17 18:12:09 -07:00
John Wiegley 29d52e3648 Extend some tracing output in Exec.hs 2018-04-17 18:11:58 -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 77c6b099df Minor code refactor 2018-04-17 17:31:52 -07:00
John Wiegley c3f34e62ce Use verbosity to control how much is displayed in error messages 2018-04-17 17:25:59 -07:00
John Wiegley 01bf245e31 Simplify a function in Eval.hs using Nix.Convert 2018-04-17 14:59:24 -07:00
John Wiegley fd70f913c2 Add more information to an error message 2018-04-17 14:53:50 -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 a21d88657a Add several more JSON related instances 2018-04-17 14:06:59 -07:00
John Wiegley d8828bfe56 Add more instances to Expr.Types.Annotated 2018-04-17 13:55:34 -07:00
John Wiegley 146780c024 Add ToJSON/FromJSON for NExpr itself 2018-04-17 13:54:42 -07:00
John Wiegley 9d2834099e Expand the hashability of NExpr and related structures 2018-04-17 13:54:42 -07:00
John Wiegley 64a10669ac Provide ToJSON/FromJSON instances for NExpr
This is not the same as the JSON format used by Nix, but is intended for other
uses where one wishes to write analysis programs over expression trees, where
hnix is only being used to convert the source code to its JSON representation.
2018-04-17 12:58:56 -07:00
John Wiegley 8dad64c10d Add more instances to Atoms and Expr.Types 2018-04-17 12:53:41 -07:00
John Wiegley a3c4bbfb76 Use NonEmpty for let bindings and attribute selector paths
Note that Nix allows inherit; and inherit (foo);, so we cannot make the list
of inherited names non-empty, even though the former constructions have no
meaning.
2018-04-17 12:46:41 -07:00
John Wiegley 5bda1b48c3 Hashable r => NExprF r is now Hashable 2018-04-17 11:59:54 -07:00
John Wiegley bf08deed58 Handle "pathed" rec set attrs by desugaring binds to nested rec sets 2018-04-17 11:53:35 -07:00
John Wiegley f4fbbe7903 Make NKeyName and NString instances of Hashable 2018-04-17 11:33:20 -07:00
John Wiegley 895921bca4 Fix typo 2018-04-16 22:35:21 -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 8c4b134622 A minor simplification in the parser 2018-04-16 18:45:28 -07:00
John Wiegley ea0942a86e Minor code simplification 2018-04-16 15:02:04 -07:00
John Wiegley 3901a32e15 Remove MText abstraction, which also duplicated effort in Nix.Convert 2018-04-16 10:56:29 -07:00
John Wiegley df9092b4d2 Allow implicit coercion from paths to strings via FromValue/FromNix 2018-04-16 10:55:57 -07:00
John Wiegley c7ad39b151 Fix error reporting due to failed conversions 2018-04-16 10:54:55 -07:00
John Wiegley 18337535ca Allow coercion from floats to integers 2018-04-16 10:12:29 -07:00
John Wiegley 5711f96743 Add a missing Path coercion 2018-04-16 10:12:15 -07:00
John Wiegley 9d378d61d1 Provide a default implementation that can be used for evalWith 2018-04-16 10:10:47 -07:00
John Wiegley b1f6a99dbc Simplify more functions in Builtins using Nix.Convert 2018-04-15 23:01:22 -07:00
John Wiegley ddb125aea9 Add new instances in Nix.Convert 2018-04-15 23:00:09 -07:00