0 | module System.File.Support
 1 |
 2 | %default total
 3 |
 4 | ||| Shorthand for referring to the C support library
 5 | |||
 6 | ||| @ fn the function name to refer to in the C support library
 7 | public export
 8 | supportC : (fn : String) -> String
 9 | supportC fn = "C:\{fn}, libidris2_support, idris_file.h"
10 |
11 | ||| Like `supportC`, but on Chez other threads can still collect garbage while
12 | ||| the call blocks. Chez does not allow `String` arguments in such calls, and
13 | ||| other backends do not know this calling convention, so list `supportC` for
14 | ||| the same function after it.
15 | |||
16 | ||| @ fn the function name to refer to in the C support library
17 | public export
18 | supportCSafe : (fn : String) -> String
19 | supportCSafe fn = "C__collect_safe:\{fn}, libidris2_support, idris_file.h"
20 |
21 | ||| Shorthand for referring to the Node system support library
22 | |||
23 | ||| @ fn the function name to refer to in the js/system_support_file.js file
24 | public export
25 | supportNode : (fn : String) -> String
26 | supportNode fn = "node:support:\{fn},support_system_file"
27 |
28 | ||| Wrap x in the `Right` part of an `io . Either`.
29 | export
30 | ok : HasIO io => (x : a) -> io (Either err a)
31 | ok x = pure (Right x)
32 |