summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHécate <hecate+gitlab@glitchbra.in>2020-06-27 23:04:19 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-01 15:43:25 -0400
commit5c9fabb82b39aed9e61c6b78c72312b20a568c68 (patch)
tree6ddba373c16a0a2294194cbf78bbb6931af76fac
parentb316804dbafe1d0287fd33f656b7ce5711ec34f7 (diff)
downloadhaskell-5c9fabb82b39aed9e61c6b78c72312b20a568c68.tar.gz
Add most common return values for `os` and `arch`
-rw-r--r--aclocal.m44
-rw-r--r--libraries/base/System/Info.hs45
2 files changed, 47 insertions, 2 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 6db0600c6d..5a4ead657a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1919,7 +1919,9 @@ AC_MSG_CHECKING(for path to top of build tree)
# GHC_CONVERT_CPU(cpu, target_var)
# --------------------------------
-# converts cpu from gnu to ghc naming, and assigns the result to $target_var
+# Converts cpu from gnu to ghc naming, and assigns the result to $target_var.
+# Should you modify this list, you are invited to reflect the changes in
+# `libraries/base/System/Info.hs`'s documentation.
AC_DEFUN([GHC_CONVERT_CPU],[
case "$1" in
aarch64*)
diff --git a/libraries/base/System/Info.hs b/libraries/base/System/Info.hs
index c345cf9210..840a9b5a25 100644
--- a/libraries/base/System/Info.hs
+++ b/libraries/base/System/Info.hs
@@ -11,9 +11,11 @@
-- Stability : experimental
-- Portability : portable
--
--- Information about the characteristics of the host
+-- Information about the characteristics of the host
-- system lucky enough to run your program.
--
+-- For a comprehensive listing of supported platforms, please refer to
+-- https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms
-----------------------------------------------------------------------------
module System.Info
@@ -28,6 +30,10 @@ import Data.Version
-- | The version of 'compilerName' with which the program was compiled
-- or is being interpreted.
+--
+-- ==== __Example__
+-- > ghci> compilerVersion
+-- > Version {versionBranch = [8,8], versionTags = []}
compilerVersion :: Version
compilerVersion = Version [major, minor] []
where (major, minor) = compilerVersionRaw `divMod` 100
@@ -35,15 +41,52 @@ compilerVersion = Version [major, minor] []
#include "ghcplatform.h"
-- | The operating system on which the program is running.
+-- Common values include:
+--
+-- * "darwin" — macOS
+-- * "freebsd"
+-- * "linux"
+-- * "linux-android"
+-- * "mingw32" — Windows
+-- * "netbsd"
+-- * "openbsd"
os :: String
os = HOST_OS
-- | The machine architecture on which the program is running.
+-- Common values include:
+--
+-- * "aarch64"
+-- * "alpha"
+-- * "arm"
+-- * "hppa"
+-- * "hppa1_1"
+-- * "i386"
+-- * "ia64"
+-- * "m68k"
+-- * "mips"
+-- * "mipseb"
+-- * "mipsel"
+-- * "nios2"
+-- * "powerpc"
+-- * "powerpc64"
+-- * "powerpc64le"
+-- * "riscv32"
+-- * "riscv64"
+-- * "rs6000"
+-- * "s390"
+-- * "s390x"
+-- * "sh4"
+-- * "sparc"
+-- * "sparc64"
+-- * "vax"
+-- * "x86_64"
arch :: String
arch = HOST_ARCH
-- | The Haskell implementation with which the program was compiled
-- or is being interpreted.
+-- On the GHC platform, the value is "ghc".
compilerName :: String
compilerName = "ghc"