Commit Graph

818 Commits

Author SHA1 Message Date
Runar Bjarnason
ebf661cdc0 diff 2018-10-17 10:56:33 -04:00
Arya Irani
717a28e4f1 fix a couple errors ghcid didn't catch at the office 2018-10-16 20:11:20 -04:00
Arya Irani
f968ce02ca filled in rename, some reorganizing of CommandLine 2018-10-16 18:02:37 -04:00
Arya Irani
4dc71a1a70 something something peekwhile 2018-10-16 16:03:49 -04:00
Arya Irani
94a59e45cf CommandLine branch / fork / merge 2018-10-16 12:57:07 -04:00
Arya Irani
fb752e1611 load branch in CommandLine / Codebase.mergeBranch to return merged branch 2018-10-16 12:09:04 -04:00
Arya Irani
4b36959374 wrapped up the queue producers 2018-10-16 10:46:09 -04:00
Paul Chiusano
833e4cde79 Merge remote-tracking branch 'origin/topic/codebase-editor' into topic/codebase-editor 2018-10-15 17:45:37 -04:00
Paul Chiusano
8b344b7ad7 initial command-line tool stuff 2018-10-15 17:45:04 -04:00
Runar Bjarnason
a8199b85fc Merge branch 'topic/codebase-editor' of github.com:unisonweb/unison into topic/tdnr5 2018-10-15 16:11:50 -04:00
Runar Bjarnason
42bd109cf5 TDNR substituting blanks correctly 2018-10-15 16:10:55 -04:00
Paul Chiusano
4824da860c putDecl/getDecl 2018-10-15 13:04:29 -04:00
Paul Chiusano
d2714eef8b
Merge pull request #260 from unisonweb/topic/prettyprint
Topic/prettyprint
2018-10-13 11:21:46 -04:00
Runar Bjarnason
cff1b8857b There's a bug somewhere. 2018-10-12 10:15:42 -04:00
Paul Chiusano
5271858b8e
Merge pull request #261 from unisonweb/topic/tdnr4
TDNR suggests terms with matching names but mismatching types
2018-10-12 07:09:47 -04:00
Runar Bjarnason
672018dac7 Forgot to filter exact suggestions 2018-10-11 22:56:30 -04:00
Runar Bjarnason
f0746a142e Now makes suggestions if the name matched but the type was different. 2018-10-11 21:49:01 -04:00
Rúnar
7113874acd
Merge pull request #259 from unisonweb/topic/tdnr3
TDNR resolves definitions in the same source file
2018-10-11 21:28:07 -04:00
Runar Bjarnason
e9f978c9a7 I broke it. 2018-10-11 21:04:31 -04:00
Chris Gibbs
dbf28307cc Fixes after rebasing topic/prettyprint onto topic/codebase-editor - 3 2018-10-11 23:31:26 +01:00
Chris Gibbs
1dff9bd9f2 Fixes after rebasing topic/prettyprint onto topic/codebase-editor - 2 2018-10-11 22:50:52 +01:00
Arya Irani
2e1e154d98 record haskell todos 2018-10-11 17:38:29 -04:00
Chris Gibbs
21372d353d Fixes after rebasing topic/prettyprint onto topic/codebase-editor 2018-10-11 22:29:03 +01:00
Arya Irani
98c0f373f7 and one more 2018-10-11 17:18:53 -04:00
Arya Irani
a4c1023c85 clean up some path stuff in codebase1 2018-10-11 17:17:31 -04:00
Arya Irani
0f0795a4a2 codebase1.getTerm/putTerm/getTypeOfTerm (some)...
add Unison.Codebase.Serialization
2018-10-11 17:11:12 -04:00
Chris Gibbs
c5b08f474e More testing of TermPrinter
All remaining work on it is now listed as TODOs in the code and tests.
2018-10-11 21:57:07 +01:00
Chris Gibbs
837bbabf23 Do a pass for nesting/grouping in TermPrinter 2018-10-11 21:57:06 +01:00
Chris Gibbs
1944edb18e Fix precedence handling in TermPrinter
Found a couple of parser snags (will raise issue later), and a question about handling of float special values.
2018-10-11 21:57:04 +01:00
Chris Gibbs
0b149c8bdc Support for patterns in TermPrinter
Completes rough cut of TermPrinter.pretty.

Next up is fixing precedence, nesting, and grouping, and then a bunch of testing and filling out support for things like sequences and delay syntax.
2018-10-11 21:57:03 +01:00
Chris Gibbs
6fdc3d0ee6 More work on TermPrinter
Rough cut of TermPrinter.pretty now covers all inputs, except for patterns.
2018-10-11 21:57:01 +01:00
Chris Gibbs
1de2a21543 More work on TermPrinter 2018-10-11 21:57:00 +01:00
Chris Gibbs
05f3ad09a3 Add some easy cases to TermPrinter
Not being too precise about precedence, nesting and grouping for now - will do another pass on those later.
2018-10-11 21:54:59 +01:00
Chris Gibbs
b8d9bc5387 Skeleton of a pretty-printer for terms 2018-10-11 21:54:57 +01:00
Runar Bjarnason
ca0e807fd4 TDNR resolves local definitions 2018-10-11 16:32:39 -04:00
Paul Chiusano
cd1a2a1639 got rid of Code type in favor of separate putTerm/getTerm/etc fns on Codebase 2018-10-11 15:11:32 -04:00
Paul Chiusano
37caed9996 filled in more of Codebase, added serialization for DataDecls 2018-10-11 14:32:08 -04:00
Paul Chiusano
38d2e63ab0 filled in more of IO-based Codebase impl 2018-10-11 11:49:54 -04:00
Arya Irani
c673960261 finish up V0.getBranch/putBranch 2018-10-11 10:32:37 -04:00
Arya Irani
32a62217e4 move dependents from Branch to ReferenceOps 2018-10-11 10:24:57 -04:00
Arya Irani
4760606b18 started implementing Serialization.V0 for Branch 2018-10-10 17:37:07 -04:00
Arya Irani
759433ae4c clean up Codebase/Session 2018-10-10 11:47:31 -04:00
Arya Irani
eda2da4075 add UnisonFile' (name TBD) including data/effect decls and named, typed, terms 2018-10-09 17:15:52 -04:00
Arya Irani
76631049db add Result Notes for successfully-typechecked TopLevelComponents 2018-10-09 17:00:28 -04:00
Runar Bjarnason
df9cb73d96 Track top-level lets in Term.F 2018-10-09 14:28:47 -04:00
Runar Bjarnason
b11e0a347c Builds! 2018-10-09 12:23:38 -04:00
Paul Chiusano
1fe51b602c added TopLevel note for noting types of top level bindings, and started on emitting it in the right places 2018-10-09 11:45:42 -04:00
Paul Chiusano
327781609b added some stuff 2018-10-09 10:53:19 -04:00
Paul Chiusano
20236eaf69 got rid of Release 2018-10-09 09:54:17 -04:00
Arya Irani
fe09383b91 drop Branch.backupNames and Branch.transitiveDependencies...
reduce transitiveDependencies Relation to dependents Map
and can presumably compute backupNames later from namespace + ReferenceOps.name
2018-10-08 17:11:40 -04:00
Arya Irani
3a74341ea1 finish Branch.remaining (work). it could use a test tho 2018-10-04 20:10:39 -04:00
Arya Irani
b534c420fd Merge branch 'topic/codebase-editor' of github.com:unisonweb/unison into topic/codebase-editor 2018-10-04 17:09:51 -04:00
Paul Chiusano
ffb7176086 getTerm 2018-10-04 16:58:58 -04:00
Paul Chiusano
6067e32181 putTerm 2018-10-04 16:46:33 -04:00
Paul Chiusano
7d8d0212a1 up through putType/getType 2018-10-04 15:50:21 -04:00
Paul Chiusano
942e4eef76 started on serialization code 2018-10-04 13:18:28 -04:00
Arya Irani
efa801cb0d Branch.{conflicts,RemainingWork} 2018-10-04 13:00:49 -04:00
Paul Chiusano
7718584404 delete parsec-layout 2018-10-04 11:15:50 -04:00
Arya Irani
b7801f3592 found R.memberDom = isJust . R.lookupDom 2018-10-03 22:10:49 -04:00
Arya Irani
c53671a472 backupNames contains exactly names for transitive dependencies of the branch's namespace
Added a field on Branch0, transitiveDependencies : Relation Reference Reference,
relating dependents to dependencies.

When adding a Reference `r` to a namespace as `n`:
  * add names for all of its transitive dependencies to `backupNames`.
  * cache its transitive dependencies in `transitiveDependencies`

When removing a Reference `r` from a namespace:
  * get its transitive dependencies `ds`
  * remove `r` from dom(transitiveDependencies)
  * for each `d <- ds`, if `d` isn't in ran(transitiveDependencies),
                        then delete `d` from backupNames
2018-10-03 21:38:21 -04:00
Arya Irani
16de6116e6 factor out hairy conditional from Branch.renameType/renameTerm 2018-10-03 19:42:35 -04:00
Paul Chiusano
ac614270d1 compiles 2018-10-03 18:21:05 -04:00
Runar Bjarnason
29041c8091 wip 2018-10-03 17:55:04 -04:00
Arya Irani
8425384287 Branch.{add,replaceTerm} 2018-10-03 15:04:18 -04:00
Arya Irani
74dc5814c2 simpler Branch.transitiveClosure without traverse 2018-10-03 13:07:30 -04:00
Arya Irani
99d70e2bcc ReferenceOps and Branch.transitiveClosure 2018-10-03 11:59:41 -04:00
Paul Chiusano
f275592915 more progress filling in Branch 2018-10-02 18:26:37 -04:00
Paul Chiusano
c59a4c8221 some progress filling in Branch
added some missing Hashable instances
2018-10-02 17:13:01 -04:00
Paul Chiusano
d7ab8f3c15 some docs and cleanup of Causal 2018-10-02 14:22:37 -04:00
Arya Irani
9eae5a40ca explain leaf types in function arg type mismatch error 2018-09-30 21:35:10 -04:00
Arya Irani
04f9cca3c0 refactor PrintError to use expose fewer types 2018-09-29 19:10:39 -04:00
Arya Irani
e7656ee59c switch Blockquote from to Map, and eliminate Ord a constraint 2018-09-29 12:32:26 -04:00
Arya Irani
260f3cad42 some cleanup in PrintError/TypeError 2018-09-29 00:32:09 -04:00
Arya Irani
8a1157c498 fix some false negatives on type error extractors 2018-09-28 20:37:04 -05:00
Arya Irani
eec82bdf50 maybe a little tidier version of the former commit 2018-09-27 16:13:24 -05:00
Arya Irani
c539344e1a let Watch.hs start with a random flower, so that...
...when it crashes and the sequence number gets reset, you can still
get a changing flower when you re-save your typechecker-crashing
unison source, to let you know that the REPL is still being interactive.
2018-09-27 16:07:02 -05:00
Arya Irani
355b762230 update Watch.hs to watch "." recursively, rather than "unison-src" depth 1 2018-09-27 11:58:29 -05:00
Paul Chiusano
bf50b64ac1 Merge branch 'topic/codebase-editor' of https://github.com/unisonweb/unison into topic/codebase-editor 2018-09-26 18:28:00 -04:00
Runar Bjarnason
fe8f99a88d Deleted false comment 2018-09-26 17:26:48 -05:00
Paul Chiusano
e9edb70158 Merge branch 'topic/codebase-editor' of https://github.com/unisonweb/unison into topic/codebase-editor 2018-09-26 18:02:17 -04:00
Paul Chiusano
9f9511a924 fix lexer issue where ability keyword wasn't handled properly 2018-09-26 17:58:33 -04:00
Runar Bjarnason
12632d0dc6 A bit of cleanup. 2018-09-26 15:19:40 -05:00
Runar Bjarnason
c29c68e13a Merge remote-tracking branch 'origin/topic/codebase-editor' into topic/duplicatedefinitions 2018-09-26 13:01:28 -04:00
Runar Bjarnason
8a5de5769c Cleaner separation, failing only when necessary 2018-09-26 12:55:40 -04:00
Runar Bjarnason
6b2e9c4e17 Revert "."
This reverts commit 97a26c9457.
2018-09-26 11:52:21 -04:00
Runar Bjarnason
97a26c9457 . 2018-09-26 11:26:45 -04:00
Paul Chiusano
1b6d976844 file watcher watches unison-src instead of project root 2018-09-25 22:11:37 -04:00
Runar Bjarnason
1d7b8d15a6 Let's fail sooner 2018-09-25 17:26:00 -04:00
Paul Chiusano
7d9deec69a add basics.u sample file and delete a bunch of old .u files 2018-09-25 17:21:47 -04:00
Paul Chiusano
f2e2b9ed7f Merge branch 'topic/codebase-editor' of https://github.com/unisonweb/unison into topic/codebase-editor 2018-09-25 16:52:25 -04:00
Paul Chiusano
feafbf5699 message spacing 2018-09-25 16:52:22 -04:00
Arya Irani
81a92478aa multiple fixes & cleanup...
- Make more use of IsString class in PrintError.hs to reduce line noise (fromString calls) when defining messages
- consolidated showRef/showRef', showConstructor/showConstructor'
- use Type.ungeneralizeEffects in FunctionApplication message
- add Settings.debugRevealForalls for forcing top-level foralls to print in renderType

- add some type sigs to Unison.Test.TypePrinter because ghcid complained for some reason
2018-09-25 16:45:02 -04:00
Runar Bjarnason
1caf51311f Failing on duplicate bindings in the same block 2018-09-25 14:25:20 -04:00
Arya Irani
8d27d57869 Merge remote-tracking branch 'origin/topic/notebook' into wip/function-application-error 2018-09-25 12:29:24 -04:00
Arya Irani
dc793244b1 separate the root and leaf mismatched types for a function application error message 2018-09-25 10:21:31 -04:00
Arya Irani
3460be4de7 progress on wrong function arg type message 2018-09-25 10:10:44 -04:00
Paul Chiusano
960207cc98 Merge remote-tracking branch 'origin/master' into topic/notebook 2018-09-25 00:07:06 -04:00
Paul Chiusano
e922c76a6d don't capitalize 'Line' as it's always used in the middle of a sentence 2018-09-25 00:06:38 -04:00
Paul Chiusano
a44c1cf773 Merge branch 'topic/notebook' of https://github.com/unisonweb/unison into topic/notebook 2018-09-25 00:00:30 -04:00
Paul Chiusano
94f0138927 new syntax - can use (expr)? to ask for the type of an expression; uses TDNR machinery 2018-09-24 23:56:22 -04:00
Arya Irani
430af55865 fix for some false negatives on function application arg type errors 2018-09-24 22:23:07 -04:00
Arya Irani
a242094992 watchwatch will reload the last processed unison file after a haskell/scala build event...
watchwatch.sh also accepts an initial unison file as a command-line arg, e.g.
  ./scripts/watchwatch.sh scratch.u
2018-09-24 21:54:40 -04:00
Paul Chiusano
04c310638b
Merge pull request #250 from unisonweb/wip/prettyprint.hs
Type pretty-printer
2018-09-24 19:16:51 -04:00
Chris Gibbs
190f1579dd Code review markups on Type pretty-printer
* (previous commit) backed out 'ambient round trip test' CPP thing in Builtin.hs - also it turned out
it was anyway only kicking in on my tests and on parsing of Builtins!  Would need to make it kick in during file parsing.
* Nest and group App chains properly
* Some extra nesting/grouping in foralls

Also fix rendering of unary tuples so they come out as `Pair a ()` rather than the ambiguous `(a)`.
2018-09-24 23:22:15 +01:00
Chris Gibbs
bfb2cb8d2e Revert "Scaffold for round-trip test of TypePrinter"
This reverts commit a6706b6829.
2018-09-24 21:13:07 +01:00
Paul Chiusano
17309cdd44 Rename Text.concatenate to Text.++ 2018-09-24 14:38:03 -04:00
Paul Chiusano
f09da9d84d rename Int64 to just Int 2018-09-24 13:36:13 -04:00
Paul Chiusano
66962863b5 rename UInt64 to Nat 2018-09-24 13:15:40 -04:00
Paul Chiusano
83f9ce500c a bit of error message tweaks 2018-09-24 12:58:45 -04:00
Paul Chiusano
fd2fb0968f wordsmithing error message 2018-09-24 11:57:27 -04:00
Paul Chiusano
065ecc4e62 Merge remote-tracking branch 'origin/topic/java-streaming-bootstrap' into topic/notebook 2018-09-24 11:41:22 -04:00
Paul Chiusano
02e6a389e3 Merge remote-tracking branch 'origin/topic/java-streaming-bootstrap' into topic/notebook 2018-09-24 11:19:45 -04:00
Paul Chiusano
aa85bbe706 Merge remote-tracking branch 'origin/topic/error-message-updates' into topic/notebook 2018-09-24 11:19:12 -04:00
Arya Irani
c1e045a3ea un-accidentally commit debugNote True stuff 2018-09-24 11:16:34 -04:00
Arya Irani
97c8513b34 Merge branch 'topic/error-message-updates' into topic/java-streaming-bootstrap 2018-09-24 11:15:09 -04:00
Arya Irani
6a095d4dc0 added Settings.demoHideVarNumber 2018-09-24 11:14:36 -04:00
Runar Bjarnason
315442713e TDNR should solve all blanks 2018-09-24 10:56:34 -04:00
Paul Chiusano
f6bc7db824 Merge remote-tracking branch 'origin/master' into topic/notebook 2018-09-23 20:52:33 -04:00
Arya Irani
6a606f3dbe introduced some error message debug flags in Unison.Settings... 2018-09-23 12:34:14 -04:00
Paul Chiusano
e34e9a2ad0 fix parser bug where blocks that didn't end with an expression were getting their bindings reversed 2018-09-23 02:43:09 -04:00
Paul Chiusano
bfb04ae6a9 got rid of Watch AST node, it's just a builtin function now 2018-09-23 02:26:19 -04:00
Paul Chiusano
5fac61d934 Polish and bugfixes, feels pretty nice 2018-09-23 01:38:59 -04:00
Paul Chiusano
bade2b1050 grabbing current line for watch message now 2018-09-22 15:22:51 -04:00
Paul Chiusano
e65b4cb794 parser fix 2018-09-22 14:35:50 -04:00
Paul Chiusano
7f014cf12a always terminating top-level term with () in the file parser 2018-09-22 14:06:21 -04:00
Paul Chiusano
7e86d28c99 no need to reorder watch expressions within a block 2018-09-22 13:53:09 -04:00
Paul Chiusano
a571cba9c3 added Watch AST node, this ended up being a much less hacky approach, and more flexible too 2018-09-21 22:55:56 -04:00
Chris Gibbs
0fed33475b A few more Type pretty-printer tests (some still pending) 2018-09-22 00:00:43 +01:00
Chris Gibbs
a6706b6829 Scaffold for round-trip test of TypePrinter
Adding a #define line to Builtin.hs (see the code), and running the tests, instruments
every call to Builtin.t, to test that the pretty-printer and parser are consistent, i.e.
that `parse . pretty = id` on that input.

Running this didn't throw up any new problems in the Type pretty-printer.  (It did throw up
a known limitation - lack of reversal of generalizeEffects - which is also covered by a pending
test in the suite.)

People may prefer that I take this code out again?
2018-09-22 00:00:38 +01:00
Chris Gibbs
14be343515 More work on Type pretty-printer
* Various tidy-ups.
* Fix bug with nested arrows.
* Enable ' sugar for delay even for chained delays.
* Add a 'Group' node everywhere parentheses might be output.

Also added a note to say I need to make it undo the effect of generalizeEffects.  But I plan to leave that til after the Term printer is done.
2018-09-22 00:00:37 +01:00
Chris Gibbs
026dc21a2e More work on effect and delay rendering in Type pretty-printer
Got through the confusion that was preventing me debug the "a ->{e} 'b" case.

Worked around lexer limitation in "a ->'{e} b" by rendering as "a -> '{e} b".

Realised that failure of "''a" is just a lexer limitation - "'('a)" works - so
intend to remove the code I added to prevent pretty-printer outputting chained
delays using the ' sugar.
2018-09-22 00:00:35 +01:00
Chris Gibbs
05f362e359 More work on effect and delay rendering in Type pretty-printer
Tricky interactions between the two...

Possibly uncovered a parser issue - see Test\TypePrinter.hs.
2018-09-22 00:00:34 +01:00
Chris Gibbs
7304708255 Add support for tuple and delay sugar to type-printer
The latter is unfinished.

Also fix a bug in the Pure' type smart pattern.
2018-09-22 00:00:32 +01:00
Chris Gibbs
0b18e0eb3e Code review markups on Type pretty-printer
Making changes as per Paul's comments at df938b2d85
2018-09-22 00:00:31 +01:00
Chris Gibbs
4fd2350f51 Integrate the Type pretty-printer with PrettyPrint.hs
Add line-break points at
* the space in a function application
* the space before the -> of an arrow
* the space after a comma in an effect list.

Presumably we might one day want to be able to express a preference between
breaking lines at these various points, and be able to control where
we indent to after the line break.

Still need to re-sugar pairs (,) and delay '

Also look into a regression where it seems like "Pair a b" is being parsed
as "Pair a (Pair b ())" (or at least printed that way).
2018-09-22 00:00:27 +01:00
Chris Gibbs
3db821f8f1 Add precedence support to the Type pretty-printer
...not that there are many levels of precedence to support - just 0 (normal) and 10 (type operator application).

Also render `Sequence a` as `[a]`.
2018-09-22 00:00:22 +01:00
Chris Gibbs
1c3ea375f3 Add EffectfulArrows' pattern for matching on Type
As per Paul's comment, except the for the extra `Maybe` so we can spot the difference between `a -> b` and `a ->{} b`.

So the pattern returns the following

  `(AnnotatedType v a, [(Maybe [AnnotatedType v a], AnnotatedType v a)])`

which gives the spine of function arguments, plus optional ability specifications on each arrow.

Plus use of this pattern in the Type pretty-printer.
2018-09-22 00:00:21 +01:00
Chris Gibbs
6dc1fe58bc Add basic pretty-printer for Types
Add pretty-printer for types, currently lacking precedence-awareness to suppress superfluous parentheses, and lacking integration with PrettyPrint.hs for line-breaking.

Next step is to fix those omissions, then move on to pretty-printing Terms, and data and effect declarations.
2018-09-22 00:00:19 +01:00
Arya Irani
c9e2f82041 start of PrettyPrinter.hs 2018-09-22 00:00:17 +01:00
Paul Chiusano
ae83ebfad9 update file parser 2018-09-21 18:58:16 -04:00
Paul Chiusano
fc69dc45df Merge remote-tracking branch 'origin/topic/java-streaming-bootstrap' into topic/notebook 2018-09-21 17:51:02 -04:00
Paul Chiusano
af0eab0f49 relax parser to not require blocks to end in an expression (instead get helpful msg from typechecker) 2018-09-21 17:50:09 -04:00
Arya Irani
ce2a02f259 fix watcher to not bomb on parse errors 2018-09-21 17:48:18 -04:00
Paul Chiusano
bc7b5ff0ce Merge remote-tracking branch 'origin/topic/java-streaming-bootstrap' into topic/notebook 2018-09-21 16:52:22 -04:00
Paul Chiusano
5d2f3bbb73 some groundwork for revamping file parser to have interleaved watch expressions 2018-09-21 16:52:01 -04:00
Arya Irani
ddd626bb07 create stack executable "watcher" which automatically evaluates .u files in the project root 2018-09-21 16:30:48 -04:00
Paul Chiusano
dc75192bf8 added ability as a keyword alias for effect, will remove effect later 2018-09-20 19:12:39 -04:00
Paul Chiusano
7c6dc750f8 fix bug with Source.fromSocketChannel/fromByteBuffer interaction 2018-09-20 18:42:48 -04:00
Paul Chiusano
751e2b7037 now actually spawning the java process, just need to know the class name 2018-09-20 17:10:51 -04:00
Paul Chiusano
439ab64d9a server for watching files and evaluating them 2018-09-20 16:50:04 -04:00