summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Char.hs
blob: 46661616b3caa532a498004c8a17281e2aa02e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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#` 0x10FFFF## = C# (chr# i#)
 | otherwise
    = error ("Prelude.chr: bad argument: " ++ showSignedInt (I# 9#) i "")