fix issue in prettier

This commit is contained in:
2024-07-11 22:17:29 -07:00
parent a4d851b563
commit b37fa56c70
4 changed files with 33 additions and 14 deletions

View File

@@ -22,10 +22,9 @@ I'd kinda like to see array run in js...
Idris does a common array for metas and defs.
Prettier was missing a Lazy.
Something exponential is going on with zoo3.newt. Adding code makes it quickly worse.
Zoo3, mostly runs aside from eqTest.
Parser:
- [x] unify broken for zoo3 `cons`

View File

@@ -33,19 +33,39 @@ refl = \ A x p px => px
list1 : List Bool
list1 = cons _ true (cons _ false (nil _))
-- 9 sec
Nat : U
Nat = (N : U) -> (N -> N) -> N -> N
-- 30 sec
five : Nat
five = \ N s z => s (s (s (s (s z))))
-- five : Nat
-- five = \ N s z => s (s (s (s (s z))))
add : Nat -> Nat -> Nat
add = \ a b N s z => a N s (b N s z)
-- add : Nat -> Nat -> Nat
-- add = \ a b N s z => a N s (b N s z)
mul : Nat -> Nat -> Nat
mul = \a b N s z => a N (b N s) z
ten : Nat
ten = add five five
hundred : Nat
hundred = mul ten ten
thousand : Nat
thousand = mul ten hundred
-- All of these fail, but are they funext?
-- works for zoo3, but maybe I'm expanding stuff too eagerly
-- eq : Eq _ true true
-- eq = refl
-- eqTest2 : Eq _ five five
-- eqTest2 = refl
-- -- This one breaks
-- eqTest : Eq _ hundred hundred
-- -- eqTest = refl _ _
-- Add the rest

View File

@@ -35,12 +35,13 @@ layout (TEXT str x) = str ++ layout x
||| Whether a documents first line fits.
fits : Nat -> DOC -> Bool
fits w x = if w < 0 then False else case x of
fits w x = if w == 0 then False else case x of
EMPTY => True
(LINE k x) => True
(TEXT s x) => fits (w `minus` length s) x
better : Nat -> Nat -> DOC -> DOC -> DOC
-- The lazy is important
better : Nat -> Nat -> DOC -> Lazy DOC -> DOC
better w k x y = if fits (w `minus` k) x then x else y
be : Nat -> Nat -> List (Nat, Doc) -> DOC

View File

@@ -55,7 +55,6 @@ processDecl (TypeSig nm tm) = do
-- FIXME - this should be in another file
processDecl (Def nm raw) = do
let m : MonadError Error M := %search
putStrLn "def \{show nm}"
ctx <- get
let pos = case raw of