[project @ 1999-08-30 18:19:39 by simonpj]
[ghc-hetmet.git] / ghc / lib / exts / GlaExts.lhs
1 %
2 % (c) The AQUA Project, Glasgow University, 1994-1996
3 %
4 \section[GlaExts]{The @GlaExts@ interface}
5
6 Compatibility cruft: Deprecated! Don't use!  This rug will
7 dissappear from underneath your feet very soon.
8
9 This module will eventually be the interface to GHC-ONLY extensions:
10 i.e. unboxery and primitive operations over unboxed values.
11
12 OLD:
13 The @GlaExts@ packages up various Glasgow extensions and
14 exports them all through one interface. The Idea being that
15 a Haskell program using a Glasgow extension doesn't have to
16 selective import of obscure/likely-to-move (believe me, we
17 really like to move functions around for the prelude bits!)
18 GHC interfaces - instead import the GlaExts rag bag and you should be away!
19
20 \begin{code}
21 module GlaExts
22
23        (
24         ST, RealWorld,
25
26         unsafePerformIO, 
27         unsafeInterleaveIO,
28         
29         -- operations for interfacing IO and ST
30         --
31         stToIO,       -- :: ST RealWorld a -> IO a
32         ioToST,       -- :: IO a -> ST RealWorld a
33
34         -- compatibility cruft
35         PrimIO,
36         ioToPrimIO,
37         primIOToIO,
38         unsafePerformPrimIO,
39         thenPrimIO, thenIO_Prim,
40         seqPrimIO, returnPrimIO,
41
42         seqST, thenST, returnST,
43
44         -- Everything from module ByteArray:
45         module ByteArray,
46
47         -- Same for Mutable(Byte)Array interface:
48         module MutableArray,
49         
50         -- the representation of some basic types:
51         Int(..),Addr(..),Word(..),Float(..),Double(..),Integer(..),Char(..),
52
53         -- The non-standard fromInt and toInt methods
54         Num( fromInt ), Integral( toInt ),
55
56         -- Fusion
57         build, augment,
58
59         -- misc bits
60         trace,
61
62         -- and finally, all the unboxed primops of PrelGHC!
63         module PrelGHC
64
65        ) where
66
67 import PrelGHC
68 import PrelBase
69 import PrelNum ( Num(..), Integral(..) )        -- To get fromInt/toInt
70 import PrelAddr   ( Addr(..), Word(..) )
71 import PrelST
72 import IOExts
73 import PrelIOBase
74 import ByteArray
75 import MutableArray
76 import Monad
77
78 type PrimIO a = IO a
79
80 primIOToIO :: PrimIO a -> IO a
81 primIOToIO io = io
82
83 ioToPrimIO :: IO a -> PrimIO a
84 ioToPrimIO io = io
85
86 unsafePerformPrimIO :: PrimIO a -> a
87 unsafePerformPrimIO = unsafePerformIO
88
89 thenPrimIO :: PrimIO a -> (a -> PrimIO b) -> PrimIO b
90 thenPrimIO = (>>=)
91
92 seqPrimIO :: PrimIO a -> PrimIO b -> PrimIO b
93 seqPrimIO = (>>)
94
95 returnPrimIO :: a -> PrimIO a
96 returnPrimIO = return
97
98 thenIO_Prim :: PrimIO a -> (a -> IO b) -> IO b
99 thenIO_Prim = (>>=)
100
101 -- ST compatibility stubs.
102 thenST :: ST s a -> ( a -> ST s b) -> ST s b
103 thenST = (>>=)
104
105 seqST :: ST s a -> ST s b -> ST s b
106 seqST = (>>)
107
108 returnST :: a -> ST s a
109 returnST = return
110 \end{code}