## TODO - [x] SortedMap.newt issue in `where` - [x] fix "insufficient patterns", wire in M or Either String - [ ] Matching _,_ when Maybe is expected should be an error - [ ] error for non-linear pattern - [ ] typeclass dependencies - need to flag internal functions to not search (or flag functions for search). I need to decide on syntax for this. - don't search functions that are currently being defined. This is subtle... We do want to recurse in bind, we don't want to do that for the isEq function. Maybe something idris like. - [ ] default implementations (use them if nothing is defined, where do we store them?) e.g. Ord compare, <, etc in Idris - [ ] syntax for negative integers - [x] Put worker in iframe on safari - [ ] Warnings or errors for missing definitions - [ ] Warnings or errors for unused cases - This is important when misspelled constructors become pattern vars - [ ] if we're staying with this version of auto, we might need to list candidates and why they're rejected. e.g. I had a bifunctor fail to solve because the right answer unblocked a Foo vs IO Foo mismatch - [ ] literals for double - [ ] add default failing case for constructor matching to catch errors - [x] Add icit to Lam - [ ] add jump to definition magic to vscode extension - [x] Cheap dump to def - dump context - [ ] TCO? Probably needed in browser, since v8 doesn't do it. bun and JavaScriptCore do support it. - [x] deconstructing `let` (and do arrows) - [x] Fix string printing to be js instead of weird Idris strings - [x] make $ special - Makes inference easier, cleaner output, and allows `foo $ \ x => ...` - remove hack from Elab.infer - [ ] `$` no longer works inside ≡⟨ ⟩ sort out how to support both that and `$ \ x => ...` (or don't bother) - [ ] **Translate newt to newt** - [ ] Support @ on the LHS - [x] if / then / else sugar - [ ] `data Foo = A | B` sugar - [ ] records - [x] where - [ ] add namespaces - [ ] magic nat? - [ ] rework `unify` case tree - Idris needs help with the case tree to keep code size down, do it in stages, one dcon at a time. - I'm not sure it can go a few steps deep and have a default hanging off the side, so we may need to put the default case in another function ourselves. - [x] Strategy to avoid three copies of `Prelude.newt` in this source tree - [ ] `mapM` needs inference help when scrutinee (see Day2.newt) - Meta hasn't been solved yet. It's Normal, but maybe our delayed solving of Auto plays into it. Idris will peek at LHS of CaseAlts to guess the type if it doesn't have one. - [ ] Can't skip an auto. We need `{{_}}` to be auto or `%search` syntax. - [x] add filenames to FC - [ ] Add full ranges to FC - [x] maybe use backtick for javascript so we don't highlight strings as JS - [x] dead code elimination - [x] imported files leak info messages everywhere - For now, take the start ix for the file and report at end starting there - [ ] update node shim to include idris2-playground changes - [ ] refactor playground to better share code with idris2-playground - [ ] accepting DCon for another type (skipping case, but should be an error) - [ ] don't allow (or dot) duplicate names on LHS - [x] remove metas from context, M has TopContext - [ ] improve test driver - maybe a file listing jobs, whether they are known broken, optional expected output, optional expected JS execution output. - [x] forall / ∀ sugar (Maybe drop this, issues with `.` and `{A}` works fine) - [x] Bad module name error has FC 0,0 instead of the module or name - [ ] Remove context lambdas when printing solutions (show names from context) - maybe build list of names and strip λ, then call pprint with names - [ ] Revisit substitution in case building - [x] Check for shadowing when declaring dcon - Handles the forward decl in `Zoo1.newt`, but we'll need different syntax if we have different core terms for TCon/DCon/Function - [ ] Require infix decl before declaring names with `_` (helps find bugs) - [x] sugar for typeclasses - [x] maybe add implicits in core to help resugar operators? - [ ] consider binders in environment, like Idris, to better mark `let` and to provide names - [x] move some top-level chattiness to `debug` - [ ] consider optionally compiling to eliminators for a second type-checking pass to help catch bugs. - [x] Allow unicode operators/names - Web playground - [x] editor - [x] view output - [x] view javascript - [x] run javascript - [x] need to shim out Buffer - [x] get rid of stray INFO from auto resolution - [x] handle `if_then_else_` style mixfix - [x] equational reasoning sample (maybe PLFA "Lists") - actual `if_then_else_` isn't practical because the language is strict - [x] Search should look at context - [ ] copattern matching - [ ] Get `Combinatory.newt` to work - [x] Remember operators from imports - [ ] Default cases for non-primitives (currently gets expanded to all constructors) - This may need a little care. But I think I could collect all constructors that only match wildcards into a single case. This would lose any information from breaking out the individual, unnamed cases though. - There are cases where we have `_` and then `Foo` on the next line, but they should all get collected into the `Foo` case. I think I sorted all of this out for primitives. - [x] Case for primitives - [ ] aoc2023 translation - [x] day1 - [x] day2 - day6 - some "real world" examples - [x] Maybe Eq and stuff would work for typeclass without dealing with unification issues yet - [x] unsolved meta errors repeat (need to freeze or only report at end) - [x] Sanitize JS idents, e.g. `_+_` - [x] Generate some programs that do stuff - [x] import - [ ] consider making meta application implicit in term, so it's more readable when printed - Currently we have explicit `App` surrounding `Meta` when inserting metas. Some people leave that implicit for efficiency. I think it would also make printing more readable. - When printing `Value`, I now print the spine size instead of spine. - [x] eval for case (see order.newt) - [x] switch from commit/mustWork to checking progress - [x] type constructors are no longer generated? And seem to have 0 arity. - [x] raw let is not yet implemented (although define used by case tree building) - [x] there is some zero argument application in generated code - [x] get equality.newt to work - [x] broken again because I added J, probably need to constrain scrutinee to value - [ ] Bad FC for missing case in where clause (probably from ctx) - [x] inline metas. Maybe zonk after TC/elab - [x] implicit patterns - [x] operators - [x] pair syntax (via comma operator) - [ ] `data` sugar: `data Maybe a = Nothing | Just a` - [x] matching on operators - [x] top level - [x] case statements - [ ] Lean / Agda ⟨ ⟩ (does agda do this or just lean?) - [ ] Lean-like .map, etc? (resolve name in namespace of target type, etc) - [x] autos / typeclass resolution - [x] very primitive version in place, not higher order, search at end - [x] monad is now working - [x] do blocks (needs typeclass, overloaded functions, or constrain to IO) - [x] some solution for `+` problem (classes? ambiguity?) - [x] show compiler failure in the editor (exit code != 0) - [x] write output to file - uses `-o` option - [ ] detect extra clauses in case statements - [ ] add test framework - [ ] decide what to do for erasure - I'm going to try explicit annotation, forall/∀ is erased - [x] Parser side - [x] push down to value/term - [x] check quantity - [x] erase in output - [ ] remove erased top level arguments - [ ] type at point in vscode NOW - [ ] repl - [ ] LSP - [x] don't match forced constructors at runtime - I think we got this by not switching for single cases - [ ] magic nat (codegen as number with appropriate pattern matching) - [ ] magic tuple? (codegen as array) - [ ] magic newtype? (drop them in codegen) - [x] vscode: syntax highlighting for String - [ ] add `pop` or variant of `pfunc` that maps to an operator, giving the js operator and precedence on RHS ### Parsing - [ ] consider allowing σ etc in identifiers - Probably need to merge oper / ident first and sort out mixfix in parsing - The mixfix parsing can handle this now, need to update lexing. - [ ] Parse error not ideal for `\x y z b=> b` (points to lambda) ### Background - [ ] Read Ulf Norell thesis - [ ] Finish reading dynamic pattern unification paper to see what is missing/wrong with the current implementation - [ ] Read "Unifiers as Equivalences" has unification with types. Look into adapting some of that (or at least read/understand it). Indexed types are mentioned here. ### Other issues - [ ] Name space flattening makes it a bit more subtle when a misspelled (or shadowed) constructor turns into a variable. ### Error Messages Missing `Monad Maybe` looks like: ``` Unsolved meta 358 Normal type U 0 constraints Unsolved meta 356 Auto type Monad (?m:355 s:0) 0 constraints Unsolved meta 355 Normal type U -> U 2 constraints * (m355 (%var0 (List (%meta 358 [1 sp]))) =?= (Maybe (List Card)) * (m355 (%var0 (%meta 358 [1 sp])) =?= (Maybe Card) ``` There is some information here, but it's obtuse. One issue is that I'm taking an Agda-inspired approach to search (try every option and see if exactly one works with our constraints) rather than Idris (assume the determinant on an interface is injective and solve `m344 %var0` with `Maybe`).