summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Char.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-02-28 23:59:35 +0000
committerIan Lynagh <igloo@earth.li>2012-02-28 23:59:35 +0000
commit62a506d54f930a18527f4173913f5ae002893a76 (patch)
tree38b439eaaf38ac4af2c5b19d771a153fe355a82f /libraries/base/GHC/Char.hs
parentb6772245616d424e85ee0852c0a1002854bef6af (diff)
downloadhaskell-62a506d54f930a18527f4173913f5ae002893a76.tar.gz
Move chr's definition into a new GHC.Char
This eliminates a SOURCE import
Diffstat (limited to 'libraries/base/GHC/Char.hs')
-rw-r--r--libraries/base/GHC/Char.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/libraries/base/GHC/Char.hs b/libraries/base/GHC/Char.hs
new file mode 100644
index 0000000000..398ff8165c
--- /dev/null
+++ b/libraries/base/GHC/Char.hs
@@ -0,0 +1,15 @@
+
+{-# LANGUAGE NoImplicitPrelude, MagicHash #-}
+
+module GHC.Char (chr) where
+
+import GHC.Base
+import GHC.Show
+
+-- | The 'Prelude.toEnum' method restricted to the type 'Data.Char.Char'.
+chr :: Int -> Char
+chr i@(I# i#)
+ | int2Word# i# `leWord#` int2Word# 0x10FFFF# = C# (chr# i#)
+ | otherwise
+ = error ("Prelude.chr: bad argument: " ++ showSignedInt (I# 9#) i "")
+