summaryrefslogtreecommitdiff
path: root/libraries
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
parentb6772245616d424e85ee0852c0a1002854bef6af (diff)
downloadhaskell-62a506d54f930a18527f4173913f5ae002893a76.tar.gz
Move chr's definition into a new GHC.Char
This eliminates a SOURCE import
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Data/Char.hs1
-rw-r--r--libraries/base/Foreign/C/String.hs1
-rw-r--r--libraries/base/GHC/Base.lhs8
-rw-r--r--libraries/base/GHC/Char.hs15
-rw-r--r--libraries/base/GHC/Enum.lhs1
-rw-r--r--libraries/base/GHC/IO/Encoding/Failure.hs1
-rw-r--r--libraries/base/GHC/Unicode.hs1
-rw-r--r--libraries/base/Text/Read/Lex.hs1
-rw-r--r--libraries/base/base.cabal1
9 files changed, 22 insertions, 8 deletions
diff --git a/libraries/base/Data/Char.hs b/libraries/base/Data/Char.hs
index c19e8af564..26ca8a4c36 100644
--- a/libraries/base/Data/Char.hs
+++ b/libraries/base/Data/Char.hs
@@ -55,6 +55,7 @@ module Data.Char
#ifdef __GLASGOW_HASKELL__
import GHC.Base
import GHC.Arr (Ix)
+import GHC.Char
import GHC.Real (fromIntegral)
import GHC.Show
import GHC.Read (Read, readLitChar, lexLitChar)
diff --git a/libraries/base/Foreign/C/String.hs b/libraries/base/Foreign/C/String.hs
index 47ce2b2fe1..a55f856165 100644
--- a/libraries/base/Foreign/C/String.hs
+++ b/libraries/base/Foreign/C/String.hs
@@ -110,6 +110,7 @@ import Data.Word
#ifdef __GLASGOW_HASKELL__
import Control.Monad
+import GHC.Char
import GHC.List
import GHC.Real
import GHC.Num
diff --git a/libraries/base/GHC/Base.lhs b/libraries/base/GHC/Base.lhs
index bf4a8c120b..6a36eb5713 100644
--- a/libraries/base/GHC/Base.lhs
+++ b/libraries/base/GHC/Base.lhs
@@ -109,7 +109,6 @@ import GHC.Types
import GHC.Classes
import GHC.CString
import GHC.Prim
-import {-# SOURCE #-} GHC.Show
import {-# SOURCE #-} GHC.Err
import {-# SOURCE #-} GHC.IO (failIO)
@@ -458,13 +457,6 @@ type String = [Char]
"x# `ltChar#` x#" forall x#. x# `ltChar#` x# = False
#-}
--- | 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 "")
-
unsafeChr :: Int -> Char
unsafeChr (I# i#) = C# (chr# i#)
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 "")
+
diff --git a/libraries/base/GHC/Enum.lhs b/libraries/base/GHC/Enum.lhs
index b3491f2d9d..4475540afa 100644
--- a/libraries/base/GHC/Enum.lhs
+++ b/libraries/base/GHC/Enum.lhs
@@ -28,6 +28,7 @@ module GHC.Enum(
) where
import GHC.Base
+import GHC.Char
import GHC.Integer
import GHC.Num
import GHC.Show
diff --git a/libraries/base/GHC/IO/Encoding/Failure.hs b/libraries/base/GHC/IO/Encoding/Failure.hs
index 862de1fb4e..35d2d93563 100644
--- a/libraries/base/GHC/IO/Encoding/Failure.hs
+++ b/libraries/base/GHC/IO/Encoding/Failure.hs
@@ -26,6 +26,7 @@ import GHC.IO.Buffer
import GHC.IO.Exception
import GHC.Base
+import GHC.Char
import GHC.Word
import GHC.Show
import GHC.Num
diff --git a/libraries/base/GHC/Unicode.hs b/libraries/base/GHC/Unicode.hs
index bd2ed7399c..9de8ea4b6b 100644
--- a/libraries/base/GHC/Unicode.hs
+++ b/libraries/base/GHC/Unicode.hs
@@ -31,6 +31,7 @@ module GHC.Unicode (
) where
import GHC.Base
+import GHC.Char
import GHC.Real (fromIntegral)
import Foreign.C.Types (CInt(..))
diff --git a/libraries/base/Text/Read/Lex.hs b/libraries/base/Text/Read/Lex.hs
index e0573bf1ad..0af66b7034 100644
--- a/libraries/base/Text/Read/Lex.hs
+++ b/libraries/base/Text/Read/Lex.hs
@@ -35,6 +35,7 @@ import Text.ParserCombinators.ReadP
#ifdef __GLASGOW_HASKELL__
import GHC.Base
+import GHC.Char
import GHC.Num( Num(..), Integer )
import GHC.Show( Show(..) )
import {-# SOURCE #-} GHC.Unicode ( isSpace, isAlpha, isAlphaNum )
diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal
index ca28996e68..96ef062b18 100644
--- a/libraries/base/base.cabal
+++ b/libraries/base/base.cabal
@@ -38,6 +38,7 @@ Library {
Foreign.Concurrent,
GHC.Arr,
GHC.Base,
+ GHC.Char,
GHC.Conc,
GHC.Conc.IO,
GHC.Conc.Signal,