2020-05-18 15:59:07 +03:00
|
|
|
module System.Info
|
|
|
|
|
|
|
|
%extern prim__os : String
|
|
|
|
%extern prim__codegen : String
|
|
|
|
|
|
|
|
export
|
|
|
|
os : String
|
|
|
|
os = prim__os
|
|
|
|
|
|
|
|
export
|
|
|
|
codegen : String
|
|
|
|
codegen = prim__codegen
|
2020-05-26 12:59:14 +03:00
|
|
|
|
|
|
|
export
|
|
|
|
isWindows : Bool
|
2020-05-26 21:56:16 +03:00
|
|
|
isWindows = os `elem` ["windows", "mingw32", "cygwin32"]
|
2021-03-26 21:27:25 +03:00
|
|
|
|
2021-04-23 13:09:31 +03:00
|
|
|
%foreign "C:idris2_getNProcessors, libidris2_support, idris_support.h"
|
2021-03-26 21:27:25 +03:00
|
|
|
prim__getNProcessors : PrimIO Int
|
|
|
|
|
|
|
|
export
|
|
|
|
getNProcessors : IO (Maybe Nat)
|
|
|
|
getNProcessors = do
|
|
|
|
i <- fromPrim prim__getNProcessors
|
|
|
|
pure (if i < 0 then Nothing else Just (integerToNat (cast i)))
|