Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A whole bunch of language tweaks and syntax updates #222

Merged
merged 95 commits into from Aug 6, 2018
Merged
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
9a95e7f
helper function to make it easier to produce pretty errors
pchiusano Jul 30, 2018
ed044a0
ColorText wip
aryairani Jul 30, 2018
5c19631
summarize a block of text into short segments according to its highli…
aryairani Jul 31, 2018
c5fdadd
oops, completing incomplete commit
aryairani Jul 31, 2018
c5c03a3
fixed off-by-one error
aryairani Jul 31, 2018
7c3fb56
Three different blanks
runarorama Jul 31, 2018
8a6850e
wip
runarorama Jul 31, 2018
312e066
unfinished but compiling
aryairani Jul 31, 2018
ace2ce0
finished plumbing extra Blank info through existentials of the typech…
pchiusano Jul 31, 2018
a5e7e96
Adding some machinery so we can detect and do something about existen…
pchiusano Jul 31, 2018
b26f83a
working in a sense
aryairani Jul 31, 2018
790646f
typechecker surgery to propagate info about solved existentials being…
pchiusano Jul 31, 2018
8fefcc6
about to where we can start producing pretty compiler error messages
aryairani Jul 31, 2018
f23ca96
Add retract call in synthesizeClosed to make sure all recorded existe…
pchiusano Aug 1, 2018
7c74e2a
an untested implementation of `PrintError.renderTypeError`
aryairani Aug 1, 2018
740cafd
split out a pretty-printer for type
aryairani Aug 1, 2018
2909f2f
forgot to compile tests
aryairani Aug 1, 2018
0566c26
Split `Blank` up into `Recorded` and non-recorded portion, this lets …
pchiusano Aug 1, 2018
49f4655
use Annotated typeclass; refactor to improve markup api
aryairani Aug 1, 2018
2fe89db
Type-directed resolve typechecks
runarorama Aug 1, 2018
794e88e
Calling type directed resolution
runarorama Aug 1, 2018
c0beac0
progress
runarorama Aug 1, 2018
1c3a13a
flesh out AnnotatedDocument usage and instances slightly
aryairani Aug 1, 2018
5a2ae3e
Added pre-existing terms to type env
runarorama Aug 1, 2018
32df2fd
render types using `intercalateMap`
aryairani Aug 1, 2018
423333e
wired up renderTypeError kinda
aryairani Aug 1, 2018
a92c4c9
hooked PrintError up to Bootstrap a little more
aryairani Aug 1, 2018
92554ae
Merge branch 'topic/type-directed' of github.com:unisonweb/unison int…
aryairani Aug 1, 2018
6622df4
debugging the error display for unison-src/tests/if.uu
aryairani Aug 1, 2018
572ce1e
debugging the error display for unison-src/tests/if.uu
aryairani Aug 1, 2018
74faf73
added example type
aryairani Aug 1, 2018
0e03bbd
fix missing unparenthesized types in PrintError.renderType.paren
aryairani Aug 2, 2018
1f6c4d8
use `splitAndRenderWithColor` to minimize source output
aryairani Aug 2, 2018
ed1d148
strip out some debug prints
aryairani Aug 2, 2018
3924123
syntax error in example
aryairani Aug 2, 2018
76e3691
fix Type.unApps, and add underlining because, you know, that way we'l…
aryairani Aug 2, 2018
2dfe354
add bold, because then we'll have it
aryairani Aug 2, 2018
2dc1266
Added syntax sugar: 'x for () -> x, !x for x(), and a delay layout block
pchiusano Aug 2, 2018
545f1c0
Merge remote-tracking branch 'origin/topic/pretty-errors' into topic/…
pchiusano Aug 2, 2018
9377fc5
Type.unTuple
aryairani Aug 2, 2018
1417b57
bootstrap.sh
aryairani Aug 2, 2018
5775670
Merge remote-tracking branch 'origin/topic/pretty-errors' into topic/…
pchiusano Aug 2, 2018
73849a7
merge with topic/pretty-errors, add diagnostic that shows builtin dat…
pchiusano Aug 2, 2018
b98afb5
added test.sh and updated development.markdown
pchiusano Aug 2, 2018
bbfc7bb
a bunch of cleanup of binding of builtins, fixes tests
pchiusano Aug 2, 2018
85eba3e
restore Builtin.builtinTypedTerms
pchiusano Aug 2, 2018
1da453e
Merge branch 'topic/pretty-errors' into topic/delay
pchiusano Aug 2, 2018
7dc83f6
Add a type arg to `Rendered` so as to not accidentally mix render styles
aryairani Aug 2, 2018
a314535
Merge branch 'topic/pretty-errors' of github.com:unisonweb/unison int…
aryairani Aug 2, 2018
1e52a05
more AnnotatedText / ColorText refactor/cleanup
aryairani Aug 2, 2018
63419dd
parser fix to allow `'{Remote} a -> Foo`
pchiusano Aug 2, 2018
ad1109c
Merge remote-tracking branch 'origin/topic/pretty-errors' into topic/…
pchiusano Aug 2, 2018
cd4652b
add `Describe a` node to `AnnotatedDocument a`
aryairani Aug 2, 2018
6f60a4c
update colors
aryairani Aug 2, 2018
fb8e020
add more position info to error output
aryairani Aug 2, 2018
392693f
Added Sequence.{++, drop, at}
pchiusano Aug 2, 2018
780656d
generalizing over lowercase type variables in signatures, a la haskell
pchiusano Aug 2, 2018
1f6dc50
generalizing over type signatures in `effect` constructors
pchiusano Aug 2, 2018
21e01fe
move bootstrap.sh and test.sh to scripts/ and add watch.sh also
aryairani Aug 2, 2018
f75707f
add `Describe a` node to `AnnotatedDocument a`
aryairani Aug 2, 2018
0dc470f
update colors
aryairani Aug 2, 2018
8a71e25
add more position info to error output
aryairani Aug 2, 2018
28b4af1
move bootstrap.sh and test.sh to scripts/ and add watch.sh also
aryairani Aug 2, 2018
91a5b3a
parser update to handle namespace blocks
pchiusano Aug 2, 2018
ef8e5a7
IT'S ALIVE
pchiusano Aug 2, 2018
4f0f41d
Lexer wordyId no longer consumes the `.` in `foo.` followed by spaces…
pchiusano Aug 3, 2018
52bc191
imports, can appear at start of any block
pchiusano Aug 3, 2018
a18b7ab
`import Foo.bar` now works, no need for `import Foo.[bar]`
pchiusano Aug 3, 2018
aea87a6
simplify syntax
pchiusano Aug 3, 2018
d9624e6
Merge remote-tracking branch 'origin/topic/pretty-errors' into topic/…
pchiusano Aug 3, 2018
88086f6
fix off-by-one highlight end issue
aryairani Aug 3, 2018
d402ecb
map Intrinsic over builtin types; make some tweaks to typemismatch error
aryairani Aug 3, 2018
e3e22ac
force overalltypes and mismatchsite to be shown in type mismatch exce…
aryairani Aug 3, 2018
02ccef1
Merge branch 'topic/delay' of github.com:unisonweb/unison into topic/…
aryairani Aug 3, 2018
27dea5f
add scripts for pre-commit/pre-push hooks
aryairani Aug 3, 2018
ba3a343
Tweak git hooks to run stack tests on commit, and both stack and sbt …
aryairani Aug 3, 2018
409802e
Tweak pre-push failure message
aryairani Aug 3, 2018
17b2f77
(non-compiling) holes for parser errors
aryairani Aug 3, 2018
f20ad4d
fixed issue with handling of namespace / imports
pchiusano Aug 3, 2018
8a35720
Merge remote-tracking branch 'origin/topic/pretty-errors' into topic/…
pchiusano Aug 3, 2018
027539b
added really dumb ability check failure printer, was blocked on this,…
pchiusano Aug 3, 2018
d635dcf
Merge branch 'topic/delay' of github.com:unisonweb/unison into topic/…
aryairani Aug 3, 2018
9495e97
(not compiling) filled in something for PrintError.prettyParseError
aryairani Aug 3, 2018
30dcb4c
started on map-reduce example, hit a bunch of bugs along the way
pchiusano Aug 3, 2018
5a9afe4
Eliminated the P.ShowErrorComponent instance and replaced with first …
aryairani Aug 3, 2018
4cc8848
stack's incremental recompilation failed me
aryairani Aug 3, 2018
7151bf5
Merge branch 'topic/delay' of github.com:unisonweb/unison into topic/…
aryairani Aug 3, 2018
1cc02f7
add some more basic output for previously unhandled type errors
aryairani Aug 4, 2018
92dca8c
tweaked message slightly
aryairani Aug 4, 2018
db7c8f7
more tweaking of message i've never seen displayed
aryairani Aug 4, 2018
0942f7a
added more hopefully helpful typechecker output
aryairani Aug 4, 2018
a7c2d58
Merge branch 'topic/delay' of https://github.com/unisonweb/unison int…
pchiusano Aug 5, 2018
e93aa98
got rid of delay keyword! works to just make ' bind looser than keywo…
pchiusano Aug 5, 2018
4697c27
forgot to add this to commit, updated test file for new syntax
pchiusano Aug 5, 2018
9f2a040
Merge remote-tracking branch 'origin/topic/pretty-errors' into topic/…
pchiusano Aug 6, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+94 −0
Diff settings

Always

Just for now

started on map-reduce example, hit a bunch of bugs along the way

  • Loading branch information...
pchiusano committed Aug 3, 2018
commit 30dcb4ccd7a9edf247804a0eab6321c78daaa18e
@@ -0,0 +1,94 @@

-- A simple distributed computation effect
effect Remote n where

-- Spawn a new node, of type `n`
spawn : {Remote n} n

-- Sequentially evaluate the given thunk on another node
-- then return to the current node when it completes
at : n -> '{Remote n} a -> {Remote n} a

-- Start a computation running, returning an `r` that can be forced to
-- await the result of the computation
fork : '{Remote n} a -> {Remote n} ('{Remote n} a)

type Monoid a = Monoid a (a -> a -> a)

use UInt64 + - * / ==
use Sequence halve map take drop size
use Optional None Some
use Monoid.Monoid -- import the constructor
use Remote fork spawn at

namespace Monoid where

zero : Monoid a -> a
zero m = case m of Monoid z _ -> z

op : Monoid a -> a -> a -> a
op m = case m of Monoid _ op -> op

fold-map : (a -> {e} b) -> Monoid b -> [a] -> {e} b
fold-map f m =
z = zero m
op = Monoid.op m
go as = case halve as of
None -> zero m
Some (l, r) -> go l `op` go r
go

par : Monoid a -> Monoid ('{Remote n} a)
par m = Monoid '(zero m) _ -- (par-apply (op m)) -- doesn't typecheck

ex : '{Remote n} UInt64
ex = delay
alice = spawn
bob = spawn
f1 = fork '(1 + 1)
f2 = fork '(2 + 2)
_ -- !f1 + !f2 -- doesn't typecheck

par-apply : (a -> b -> c) -> '{Remote n} a -> '{Remote n} b -> {Remote n} c
par-apply f a b =
x = fork a
y = fork b
_ -- f !x !y -- doesn't typecheck

map-reduce : (a -> {Remote n} b) -> Monoid b -> [a] -> {Remote n} b
map-reduce f m = _
-- doesn't typecheck, but should just be:
-- Monoid.fold-map f (a -> fork '(f a)) (Monoid.par m)

-- this currently crashes the compiler
--Remote.run-local : '{Remote UInt64} a -> a
--Remote.run-local r =
-- step : UInt64 -> Effect (Remote UInt64) a -> a
-- step nid r = case r of
-- {a} -> a
-- {Remote.fork t -> k} -> handle (step nid) in (k t)
-- {Remote.spawn -> k} -> handle (step (nid + 1)) in (k nid)
--
-- handle (step 0) in !r

uno : '{e} a -> '{e} a -> {e} a
uno a a2 = !a

dos : (a -> a -> a) -> '{e} a -> '{e} a -> {e} a
dos f a a2 = f !a !a2

(<|) : (i -> o) -> i -> o
f <| i = f i
i |> f = f i

halve : [a] -> Optional ([a], [a])
halve s =
n = size s
if n == 0 then Optional.None
else
m = n / 2
Optional.Some (take m s, drop m s)

Stream.from-uint64 1
|> Stream.take 15
|> Stream.to-sequence
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.