[project @ 1999-02-23 17:20:34 by sof]
[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         -- misc bits
54         trace,
55
56         -- and finally, all the unboxed primops of PrelGHC!
57         module PrelGHC
58
59        ) where
60
61 import PrelGHC
62 import PrelBase
63 import PrelAddr   ( Addr(..), Word(..) )
64 import PrelST
65 import IOExts
66 import PrelIOBase
67 import ByteArray
68 import MutableArray
69 import Monad
70
71 type PrimIO a = IO a
72
73 primIOToIO :: PrimIO a -> IO a
74 primIOToIO io = io
75
76 ioToPrimIO :: IO a -> PrimIO a
77 ioToPrimIO io = io
78
79 unsafePerformPrimIO :: PrimIO a -> a
80 unsafePerformPrimIO = unsafePerformIO
81
82 thenPrimIO :: PrimIO a -> (a -> PrimIO b) -> PrimIO b
83 thenPrimIO = (>>=)
84
85 seqPrimIO :: PrimIO a -> PrimIO b -> PrimIO b
86 seqPrimIO = (>>)
87
88 returnPrimIO :: a -> PrimIO a
89 returnPrimIO = return
90
91 thenIO_Prim :: PrimIO a -> (a -> IO b) -> IO b
92 thenIO_Prim = (>>=)
93
94 -- ST compatibility stubs.
95 thenST :: ST s a -> ( a -> ST s b) -> ST s b
96 thenST = (>>=)
97
98 seqST :: ST s a -> ST s b -> ST s b
99 seqST = (>>)
100
101 returnST :: a -> ST s a
102 returnST = return
103 \end{code}