sugar for data and other improvements

- parse types in let (everything but parser was there)
- add sugar for `data`
- move `joinBy` to prelude
- fix highlighting for char in vscode
- better errors for missing imports
This commit is contained in:
2024-12-28 09:24:30 -08:00
parent 0992dc1367
commit 3ec2f90770
17 changed files with 115 additions and 94 deletions

View File

@@ -65,11 +65,6 @@ bronKerbosch g rs (p :: ps) xs =
best a Nothing = a
best (Just a) (Just b) = if length a < length b then Just b else Just a
joinBy : String List String String
joinBy _ Nil = ""
joinBy _ (x :: Nil) = x
joinBy s (x :: y :: xs) = joinBy s ((x ++ s ++ y) :: xs)
run : String -> IO Unit
run fn = do
putStrLn fn

View File

@@ -126,7 +126,6 @@ check : List Gate → List Int → String → Either (String × String) Unit
check gates Nil carry = Right MkUnit
check gates (bit :: bits) carry = do
let xl = label 'x' bit
let yl = label 'x' bit
let (Just a1) = matchIn xl And | _ => fail $ "no a1 " ++ show bit
let (Just x1) = matchIn xl Xor | _ => fail $ "no x1 " ++ show bit
-- just peel of the carry for bit0
@@ -174,11 +173,6 @@ trampoline gates acc = do
putStrLn $ "SWAP " ++ a ++ " and " ++ b
trampoline (map (swapPins a b) gates) (a :: b :: acc)
joinBy : String List String String
joinBy _ Nil = ""
joinBy _ (x :: Nil) = x
joinBy s (x :: y :: xs) = joinBy s ((x ++ s ++ y) :: xs)
run : String -> IO Unit
run fn = do
putStrLn fn