Switch to esm, add #export statement to newt, tweaks to LSP

This commit is contained in:
2026-02-21 15:08:15 -08:00
parent c54b856f0b
commit 0a5ad3cc9b
22 changed files with 251 additions and 165 deletions

View File

@@ -389,7 +389,9 @@ instance HasIO IO where
liftIO a = a
pfunc primPutStrLn uses (MkIORes MkUnit) : String IO Unit := `(s) => (w) => {
require('fs').writeSync(1, s + '\n')
// https://nodejs.org/api/process.html#a-note-on-process-io
// Previously console.log, but that is _not_ always synchronous
fs.writeSync(1, s + '\n')
return Prelude_MkIORes(Prelude_MkUnit,w)
}`
@@ -956,3 +958,7 @@ foldlM f a xs = foldl (\ ma b => ma >>= flip f b) (pure a) xs
pfunc unsafePerformIO : a. IO a a := `(a, f) => f().h1 `
pfunc prim_getTime uses (MkIORes): IO Int := `w => Prelude_MkIORes(+new Date(),w)`
getTime : io. {{HasIO io}} io Int
getTime = liftIO prim_getTime