mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-20 01:41:44 +03:00
ec77ad21ab
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
26 lines
493 B
Idris
26 lines
493 B
Idris
module System.Info
|
|
|
|
%extern prim__os : String
|
|
%extern prim__codegen : String
|
|
|
|
export
|
|
os : String
|
|
os = prim__os
|
|
|
|
export
|
|
codegen : String
|
|
codegen = prim__codegen
|
|
|
|
export
|
|
isWindows : Bool
|
|
isWindows = os `elem` ["windows", "mingw32", "cygwin32"]
|
|
|
|
%foreign "C:idris2_getNProcessors, libidris2_support"
|
|
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)))
|