Add a doc header to GHC.Types, and point at GHC.Exts
[ghc-prim.git] / GHC / Types.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module      :  GHC.Types
4 -- Copyright   :  (c) The University of Glasgow 2009
5 -- License     :  see libraries/ghc-prim/LICENSE
6 --
7 -- Maintainer  :  cvs-ghc@haskell.org
8 -- Stability   :  internal
9 -- Portability :  non-portable (GHC Extensions)
10 --
11 -- GHC type definitions.
12 -- Use GHC.Exts from the base package instead of importing this
13 -- module directly.
14 --
15 -----------------------------------------------------------------------------
16
17 {-# OPTIONS_GHC -XNoImplicitPrelude #-}
18
19 module GHC.Types (Char(..), Int(..), Float(..), Double(..), IO(..)) where
20
21 import GHC.Prim
22 -- We need Inl etc behind the scenes for the type definitions
23 import GHC.Generics ()
24
25 infixr 5 :
26
27 data [] a = [] | a : [a]
28
29 data Char = C# Char#
30
31 data Int = I# Int#
32 -- ^A fixed-precision integer type with at least the range @[-2^29 .. 2^29-1]@.
33 -- The exact range for a given implementation can be determined by using
34 -- 'Prelude.minBound' and 'Prelude.maxBound' from the 'Prelude.Bounded' class.
35
36 -- | Single-precision floating point numbers.
37 -- It is desirable that this type be at least equal in range and precision
38 -- to the IEEE single-precision type.
39 data Float      = F# Float#
40
41 -- | Double-precision floating point numbers.
42 -- It is desirable that this type be at least equal in range and precision
43 -- to the IEEE double-precision type.
44 data Double     = D# Double#
45
46 {-|
47 A value of type @'IO' a@ is a computation which, when performed,
48 does some I\/O before returning a value of type @a@.
49
50 There is really only one way to \"perform\" an I\/O action: bind it to
51 @Main.main@ in your program.  When your program is run, the I\/O will
52 be performed.  It isn't possible to perform I\/O from an arbitrary
53 function, unless that function is itself in the 'IO' monad and called
54 at some point, directly or indirectly, from @Main.main@.
55
56 'IO' is a monad, so 'IO' actions can be combined using either the do-notation
57 or the '>>' and '>>=' operations from the 'Monad' class.
58 -}
59 newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
60