Use null for erased values to aid serialization
This commit is contained in:
@@ -8,12 +8,12 @@ pfunc readFile uses (fs MkIORes Left Right) : (fn : String) -> IO (Either String
|
||||
let result
|
||||
try {
|
||||
let content = fs.readFileSync(fn, 'utf8')
|
||||
result = Right(undefined, undefined, content)
|
||||
result = Right(null, null, content)
|
||||
} catch (e) {
|
||||
let err = ""+e
|
||||
result = Left(undefined, undefined, e)
|
||||
result = Left(null, null, e)
|
||||
}
|
||||
return MkIORes(undefined, result, w)
|
||||
return MkIORes(null, result, w)
|
||||
}`
|
||||
|
||||
-- I wonder if I should automatically `uses` the constructors in the types
|
||||
@@ -21,12 +21,12 @@ pfunc writeFile uses (fs MkIORes MkUnit) : String → String → IO (Either Stri
|
||||
let result
|
||||
try {
|
||||
fs.writeFileSync(fn, content, 'utf8')
|
||||
result = Right(undefined, undefined, MkUnit)
|
||||
result = Right(null, null, MkUnit)
|
||||
} catch (e) {
|
||||
let err = ""+e
|
||||
result = Left(undefined, undefined, e)
|
||||
result = Left(null, null, e)
|
||||
}
|
||||
return MkIORes(undefined, result, w)
|
||||
return MkIORes(null, result, w)
|
||||
}`
|
||||
|
||||
-- maybe System.exit or something, like the original putStrLn msg >> exitFailure
|
||||
|
||||
Reference in New Issue
Block a user