summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Prim/Deprecated.hs
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/GHC/Prim/Deprecated.hs')
-rw-r--r--libraries/base/GHC/Prim/Deprecated.hs39
1 files changed, 39 insertions, 0 deletions
diff --git a/libraries/base/GHC/Prim/Deprecated.hs b/libraries/base/GHC/Prim/Deprecated.hs
new file mode 100644
index 0000000000..2cd8f20234
--- /dev/null
+++ b/libraries/base/GHC/Prim/Deprecated.hs
@@ -0,0 +1,39 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+-- | Provide some functions with the same names and interfaces as removed
+-- primops.
+module GHC.Prim.Deprecated
+ (
+ -- narrowing ops
+ narrow8Int#
+ , narrow16Int#
+ , narrow32Int#
+ , narrow8Word#
+ , narrow16Word#
+ , narrow32Word#
+ ) where
+
+import GHC.Prim
+import GHC.Types () -- Make implicit dependency known to build system
+
+default () -- Double and Integer aren't available yet
+
+narrow8Int# :: Int# -> Int#
+narrow8Int# i = int8ToInt# (intToInt8# i)
+
+narrow16Int# :: Int# -> Int#
+narrow16Int# i = int16ToInt# (intToInt16# i)
+
+narrow32Int# :: Int# -> Int#
+narrow32Int# i = int32ToInt# (intToInt32# i)
+
+narrow8Word# :: Word# -> Word#
+narrow8Word# i = word8ToWord# (wordToWord8# i)
+
+narrow16Word# :: Word# -> Word#
+narrow16Word# i = word16ToWord# (wordToWord16# i)
+
+narrow32Word# :: Word# -> Word#
+narrow32Word# i = word32ToWord# (wordToWord32# i)