Commit Graph

766 Commits

Author SHA1 Message Date
Guillaume Maudoux 2af45ba385 Fix unused param warning 2020-11-18 10:04:09 +01:00
Guillaume Maudoux 5c72d9530c Restore some `sort -k4` of order in the builtins 2020-11-18 09:42:06 +01:00
Guillaume Maudoux 50baea5e1e Fix `assert` parser to accept top-level nix forms 2020-11-18 09:42:06 +01:00
Guillaume Maudoux dc31c5e64f Fix pathExists to also accept dirs 2020-11-18 09:42:06 +01:00
Guillaume Maudoux 53b4db2525 Fix builtins.substring for negative lengths 2020-11-18 09:42:06 +01:00
Guillaume Maudoux 3ac720b5aa Complete and cleanup builtins list 2020-11-18 09:42:06 +01:00
Guillaume Maudoux 2a7a447a7d Fix occurences of name-shadowing 2020-11-18 09:42:06 +01:00
Guillaume Maudoux b6b06224c5 Remove very verbose debug statements 2020-11-18 09:42:06 +01:00
Guillaume Maudoux 19790fd1fc Show faulty string in fromStringNoContext error 2020-11-18 09:42:06 +01:00
Guillaume Maudoux d32a6fbaf3 Fix isString to refrain from coercing values
Derivations can be automatically coerced to strings. They are however
not strings and `isString` should return `False` on them.
2020-11-18 09:42:06 +01:00
Guillaume Maudoux 48ed345075 Disable debug logging on thunk force 2020-11-18 09:42:06 +01:00
Guillaume Maudoux 59698de718 Handle errors located in raw strings 2020-11-18 09:42:06 +01:00
Guillaume Maudoux e2ad934492 Make `->` right assosciative
As per the nix source code 61e816217b/src/libexpr/parser.y (L296-L307)

The bug was found while parsing firefox 5030e5cdc7/pkgs/applications/networking/browsers/firefox/common.nix (L76-L77)
2020-11-16 14:32:00 +01:00
Joe Hermaszewski 75e3a73bbe
Merge pull request #741 from expipiplus1/joe-fix-qq
Fix QQ Text lifting error
2020-11-01 11:47:49 +08:00
Joe Hermaszewski c0ed91f8c2
Merge pull request #744 from expipiplus1/joe-sourcepos-whitespace
Use pre-whitespace position for source end locations
2020-11-01 11:46:38 +08:00
Joe Hermaszewski 6b9d4d1890 Restrict type of parens and brackets to prevent negative use of NExprLoc
it is not generally appropriate to have higher-order parsers operate on
annotated locations as they are liable to perform changes to the parser which
are not captured in the annotation.

See https://github.com/haskell-nix/hnix/pull/739 and
https://github.com/haskell-nix/hnix/pull/744 for examples.
2020-10-29 15:28:02 +02:00
Joe Hermaszewski dba7650bc5 Correct location annotation for parenthesized expressions
At the moment parentheses are not included in the location annotation
for nix expressions. This changes the code to include any parentheses in
the SrcSpan of the underlying expression. Information which is difficult
to recover otherwise.
2020-10-29 15:28:02 +02:00
Joe Hermaszewski 4202bac068 Remove Generic1 instance for NKeyName
See https://github.com/haskell-nix/hnix/issues/225
2020-10-26 18:57:17 -07:00
Joe Hermaszewski 731ed878e1 Use pre-whitespace position for source end locations
Fixes https://github.com/haskell-nix/hnix/issues/743
2020-10-25 17:47:11 +08:00
Joe Hermaszewski 9920802798 Fix QQ Text lifting error
Work around https://gitlab.haskell.org/ghc/ghc/-/issues/12596 using
https://stackoverflow.com/questions/38143464/cant-find-inerface-file-declaration-for-variable
2020-10-23 15:04:28 +08:00
Anton-Latukha 003dcb660b
clean-up: m upd: minor tweaks, dropped functor 2020-09-21 01:58:00 +03:00
Anton-Latukha 6fa53d711b
clean-up: Utils.hs: m upd doc 2020-09-21 01:58:00 +03:00
Anton-Latukha 523edca13c
clean-up: {Pretty,Utils,Utils/Fix1}.hs: imports 2020-09-21 01:58:00 +03:00
Anton-Latukha cbeae8cfa1
clean-up: rm pragmas in {Reduce, Utils/Fix1}.hs 2020-09-21 01:58:00 +03:00
Anton-Latukha 84e1d7fc17
clean-up: m upd 2020-09-21 01:58:00 +03:00
Anton-Latukha 0f3eab3aef
clean-up: Pretty.hs: rm Nix.Util as not used 2020-09-21 01:58:00 +03:00
Anton-Latukha fde6764713
clean-up: Pretty.hs: <$>: .Comonad == .Prelude; no <$> in Nix.Utils 2020-09-21 01:57:59 +03:00
Anton-Latukha 64726d71e7
clean-up: Expr/Types.hs: NExprF: upd doc 2020-09-21 01:57:59 +03:00
Anton-Latukha 9fdf471f2b
clean-up: Value.hs: m upd doc 2020-09-21 01:57:59 +03:00
Anton-Latukha c01e156fef
clean-up: Builtins.hs: nixPath: simplify parens 2020-09-21 01:57:59 +03:00
Anton-Latukha 55b0040384
clean-up: Nix/Value.hs: NValueF: fx doc
Also what 's' is referenced here?
2020-09-21 01:57:59 +03:00
Anton-Latukha eb8c2252cb
clean-up: Nix.hs: evaluateExpression: use Kleisli composition 2020-09-21 01:57:59 +03:00
Anton-Latukha b035e373d6
clean-up: m
M  src/Nix/Effects.hs
2020-09-21 01:57:58 +03:00
Anton-Latukha 10051fbfc1
clean-up: rm commented-out imports
M  main/Main.hs
M  src/Nix/Reduce.hs
M  src/Nix/Type/Infer.hs
M  tests/EvalTests.hs
2020-09-21 01:57:58 +03:00
Anton-Latukha 0cb3946ee7
clean-up: (return -> pure)
M  main/Main.hs
M  main/Repl.hs
M  src/Nix/Builtins.hs
M  src/Nix/Convert.hs
M  src/Nix/Effects.hs
M  src/Nix/Effects/Basic.hs
M  src/Nix/Eval.hs
M  src/Nix/Exec.hs
M  src/Nix/Expr/Types.hs
M  src/Nix/Json.hs
M  src/Nix/Lint.hs
M  src/Nix/Normal.hs
M  src/Nix/Options/Parser.hs
M  src/Nix/Parser.hs
M  src/Nix/Scope.hs
M  src/Nix/String.hs
M  src/Nix/TH.hs
M  src/Nix/Thunk/Basic.hs
M  src/Nix/Utils.hs
M  src/Nix/Value.hs
M  src/Nix/Value/Equal.hs
M  src/Nix/XML.hs
M  tests/EvalTests.hs
M  tests/Main.hs
M  tests/NixLanguageTests.hs
M  tests/ParserTests.hs
M  tests/TestCommon.hs
2020-09-21 01:57:52 +03:00
Anton-Latukha dd6940fe7b
clean-up: Nix/Builtins.hs: `case` to `maybe` 2020-09-18 18:43:59 +03:00
Anton-Latukha 23b143478b
Nix/Convert.hs: fuse functors in one case of `fromValueMay`
fmap (fmap (, p)) $ fmap (sequence) $ traverse fromValueMay s
fmap (fmap (, p)) . fmap (sequence) $ traverse fromValueMay s
| (fmap f . fmap g) => fmap (f . g)
fmap (fmap (, p) . (sequence)) $ traverse fromValueMay s
| fmap => <$>
fmap (, p) . sequence <$> $ traverse fromValueMay s
2020-09-18 18:43:59 +03:00
Anton-Latukha 85a098bfd5
clean-up: Nix/Convert.hs 2020-09-18 18:43:59 +03:00
Anton-Latukha 4b44d97d9b
clean-up: Nix/Convert.hs: use tuple sectioning 2020-09-18 18:43:59 +03:00
Anton-Latukha c3f4d72dfd
clean-up: parens
M  main/Repl.hs
M  src/Nix/Builtins.hs
M  src/Nix/Cited.hs
M  src/Nix/Exec.hs
M  src/Nix/Expr/Types/Annotated.hs
M  src/Nix/Pretty.hs
2020-09-18 15:58:28 +03:00
Anton-Latukha ffc82fc97e
clean-up: LANGUAGE pragmas
M  Setup.hs
M  main/Repl.hs
M  src/Nix/Builtins.hs
M  src/Nix/Cache.hs
M  src/Nix/Cited.hs
M  src/Nix/Cited/Basic.hs
M  src/Nix/Convert.hs
M  src/Nix/Exec.hs
M  src/Nix/Expr/Types.hs
M  src/Nix/Expr/Types/Annotated.hs
M  src/Nix/Lint.hs
M  src/Nix/Normal.hs
M  src/Nix/Pretty.hs
M  src/Nix/Render/Frame.hs
M  src/Nix/Scope.hs
M  src/Nix/TH.hs
M  src/Nix/Thunk.hs
M  src/Nix/Thunk/Basic.hs
M  src/Nix/Utils.hs
M  src/Nix/Value.hs
M  src/Nix/Value/Equal.hs
2020-09-14 20:54:37 +03:00
Simon Jakobi dfa0435e9e Fix since annotation 2020-09-13 19:13:08 +03:00
Anton Latukha 1beaf46cd3
Options/Parser: debugVersionOpt: comment: add `nix-build` note (#717)
[Remark](https://github.com/haskell-nix/hnix/pull/712#issuecomment-691654639) deserves a comment note in the source code.
2020-09-13 14:10:27 +03:00
Anton Latukha 83c5cea9a4
Options/Parser: add '--long-version' that adds debug information (#712)
Option for debugging and bugreporting purposes.

Current output:
```
Version: 0.9.1
Commit: 2dc211314e
  date: Sat Sep 12 13:31:59 2020 +0300
  branch: 2020-09-12-add-GitRev-to-version
```

Also date and branch is to direct contributors attention to updating (or having
in mind) that.

M  hnix.cabal
M  src/Nix/Options/Parser.hs
2020-09-13 13:51:14 +03:00
Simon Jakobi 775be0d234 Add Ord1 instances for Binding, NExprF, and NKeyName
With data-fix 0.3, these instances are required so an
Ord instance for NExpr can be inferred.
2020-09-13 12:47:24 +03:00
Anton-Latukha 2dc211314e src/Nix/Options/Parser.hs: m upd alignment 2020-09-12 13:31:59 +03:00
Anton-Latukha 38215317b9 src/Nix/Options/Parser.hs: add CLI option `--version` 2020-09-12 13:31:59 +03:00
Simon Jakobi 93ecf531c4 Remove overlapping [From,To]JSON instances for NExpr
…for compatibility with aeson-1.5.3.

Closes #690.
2020-08-19 15:22:33 -07:00
Simon Jakobi 1a2d627a58 Use prettyprinter-1.7.0
Changelog:
http://hackage.haskell.org/package/prettyprinter-1.7.0/changelog

hnix is likely to be affected by this change:

> Use floor instead of round to compute ribbon width.

…due to its use of custom `LayoutOptions`.
2020-08-07 12:21:12 +03:00
Simon Jakobi 54030284fa Update to data-fix-0.3
Changelog: http://hackage.haskell.org/package/data-fix-0.3.0/changelog

Context: https://github.com/commercialhaskell/stackage/issues/5535
2020-07-24 12:35:59 +03:00