Commit Graph

137 Commits

Author SHA1 Message Date
Anton-Latukha 3774516033
clean-up: Main 2020-09-21 01:57:58 +03:00
Anton-Latukha 32cda24f58
clean-up: Repl: initState: reduce do block 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 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 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
Richard Marko c9eb24626a repl: drop GHC pragams disabling warnings, prune imports 2020-07-04 18:42:16 +02:00
Richard Marko f964284c66 repl: improve tab completion 2020-07-04 18:42:16 +02:00
Richard Marko 8d0e325cf5 repl: Add ReplConfig and :set command 2020-07-04 18:42:16 +02:00
Richard Marko b84f4f6c19 repl: Support loading .hnixrc from current directory 2020-07-04 18:42:16 +02:00
Richard Marko f7704b4c28 repl: Pass result of --eval -E "..expr.." to REPL
Allows us to do
```
hnix --eval -E '{ a = 2; b = "test"; }' --repl

hnix> :browse
input = { a = 2; b = "test"; }
hnix> input.a
2
hnix> input.b
"test"
```

Closes #292.
2020-07-04 18:42:16 +02:00
Richard Marko 4ce176d1a1 repl: Better help using HelpOption type 2020-07-04 18:42:16 +02:00
Richard Marko 0e8e73ec88 repl: Extend IState, handle bindings, add browse and debug commands
Bindings are now handled correctly and you can do

```
a = 2
b = 3
c = a + b
:browse
:t c
```

Converted IState to data type instead of `newtype`.
Now tracks `replIt` for last entered expression that parsed
successfully.

`replCtx` is now extended with bindings and browseable via `:browse`.

:`debug` can be used to enable dumping of `IState` on input.

Scope taken from `replCtx` is now pushed to evaluated values.
2020-07-04 18:42:16 +02:00
Richard Marko d9303f385c repl: Refactor error handling
Drops Repline `abort`s and switches to `Maybe` result for `call` function.

Few other bits handled too:
- `M.empty` -> `mempty`
- qualified use of `Data.Text`
- minor formatting fixes for readability

Closes #505.
2020-07-04 18:42:16 +02:00
Richard Marko 59e65d094a repl: support multi-line input
```
Welcome to hnix 0.9.0. For help type :help

hnix> :paste
-- Entering multi-line mode. Press <Ctrl-D> to finish.
| { just
| =
| ''
| testing
| '';
| }
|
{ just = "<CYCLE>"; }
hnix>
Goodbye.
```

Closes #665.
2020-07-02 14:04:13 +02:00
Richard Marko 710bc84309 Support repline 0.4
Closes #651.

`haskeline` override needs `dontCheck` as it tries to run an executable.

Tested build and repl itself.
2020-07-02 14:04:13 +02:00
Anton-Latukha 76ab909958
clean-up Monoid imports
M  main/Repl.hs
M  src/Nix/Expr/Strings.hs
M  src/Nix/Utils.hs
2020-06-02 02:11:50 +03:00
Simon Jakobi 9c6003ae8b
Use haskeline-0.8 (#540)
The `MonadException` class was removed in favor of `MonadCatch`, so we
can remove its instances, enabling us to remove the library dependency
on haskeline.

To simplify dependency resolution with GHC < 8.10, this also disables
the executable in that configuration.
2020-05-30 03:32:20 +02:00
Anton Latukha 86b5da1fa1
Repl.hs: import: Repline: hide options (#582)
Report: https://github.com/haskell-nix/hnix/issues/538#issue-581377935

M  main/Repl.hs
2020-05-25 21:47:02 +03:00
Anton-Latukha c67fa20aed Repl: LANGUAGE: rm LambdaCase 2019-08-04 09:14:41 -07:00
John Wiegley 4607639774 Remove the NValueNF type, as it provides little utility 2019-03-27 21:16:01 -07:00
John Wiegley 04cf8be650
Move StdIdT out of the StandardT transformer 2019-03-23 00:56:40 -07:00
John Wiegley 77c52fd43c Revise Nix.Standard 2019-03-23 00:49:03 -07:00
John Wiegley d1ada44817
Run brittany 2019-03-18 21:47:43 -07:00
John Wiegley 9b046a80c7
Remove unnecessary trailing space 2019-03-18 21:41:27 -07:00
John Wiegley 2c0c896871
Everything compiling again, but 25 tests failing 2019-03-18 17:30:31 -07:00
John Wiegley a006769124
Factor some common patterns back into Standard 2019-03-17 21:58:35 -07:00
John Wiegley 7b5d134d22
Factor out FreshIdT from Standard 2019-03-17 19:04:38 -07:00
John Wiegley 015ced236e
Simplify Standard by splitting off Cited.Basic 2019-03-17 18:43:23 -07:00
John Wiegley aa66560bf7
Get rid of implicit conversions to and from thunks 2019-03-17 15:30:20 -07:00
John Wiegley 94e0be3882
Reformat all sources with Brittany, to restore consistency 2019-03-17 14:47:38 -07:00
John Wiegley 6e4a3de15c
Remove a comment that is no longer necessary 2019-03-16 16:10:34 -07:00
John Wiegley 6ae5764221
All type checks, but many instance definitions are still missing 2019-03-16 01:10:47 -07:00
John Wiegley 145e69c9a4
Further work on Standard.hs 2019-03-15 22:54:29 -07:00
John Wiegley e9236aa55c
Now down to Main.hs and the tests 2019-03-15 17:20:10 -07:00
John Wiegley 107f29d3fd
Move certain constraints from MonadThunk to the BasicThunk instance 2019-03-11 13:55:40 -07:00
John Wiegley 39fd51c1a8 Split Nix.Thunk into Nix.Var, Nix.Thunk and Nix.Thunk.Basic
This is in preparation for further generalization of the thunk/value scheme
used by the execution code.
2019-03-11 08:42:46 -07:00
John Wiegley f397b80a9c Factor out citation information to its own data structure 2019-03-10 16:07:13 -07:00
Jörg Thalheim 8b10c79e41
improve hnix REPL help
all commands needs to prefixed by :
2019-01-27 20:07:43 +00: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 810821087a Fix hnix exe type error 2018-12-07 17:02:38 -05:00
Shea Levy f63ec259e0
Partial Revert "Revert "Fix compilation""
Still need the repl fix.

This reverts commit 2bba6c84e6.
2018-11-27 14:37:31 -05:00
Shea Levy 2bba6c84e6
Revert "Fix compilation"
This fix isn't necessary now that the XML context change is
reverted.

This reverts commit 51d493f484.
2018-11-27 14:22:04 -05:00
Domen Kožar 51d493f484
Fix compilation 2018-11-25 10:01:14 +00:00
Domen Kožar c450af4dcd
repl: add welcome text and :help command 2018-11-24 20:17:45 +00:00
Domen Kožar b0f346fc5a
Fix GHC 8.6 compilation 2018-11-23 13:43:36 +00:00