Skip to content

JavaScript: fix FFI calls in Posix.Internals

In base:System.Posix.Internals, there are many JavaScript FFI calls that unnecessarily use the JavaScript fat arrow syntax, like:

foreign import javascript interruptible "(($1_1,$1_2,$2,$3,$c) => { return h$base_open($1_1,$1_2,$2,$3,$c); })"
   c_safe_open_ :: CFilePath -> CInt -> CMode -> IO CInt
foreign import javascript interruptible "(($1,$2_1,$2_2,$3,$c) => { return h$base_read($1,$2_1,$2_2,$3,$c); })"
   c_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize

Since these are just applying the same arguments in the same order, we can just replace these with the function name:

foreign import javascript interruptible "h$base_open"
   c_safe_open_ :: CFilePath -> CInt -> CMode -> IO CInt
foreign import javascript interruptible "h$base_read"
   c_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information