mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-20 18:21:47 +03:00
1617d95961
* add `strerror` function * move `getErrno` to `System.Errno` * use `strerror` in `Show FileError` * on node there's no access to `strerror`, so `strerror` just converts the number to string
14 lines
292 B
Idris
14 lines
292 B
Idris
import System
|
|
import System.Errno
|
|
|
|
main : IO ()
|
|
main = do
|
|
-- `2` is `ENOENT` on all OS
|
|
-- and the message is the same on all OS
|
|
let s = strerror 2
|
|
True <- pure (s == "No such file or directory")
|
|
| False => do
|
|
putStrLn ("strerror for 2 is " ++ s)
|
|
exitFailure
|
|
pure ()
|