[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / lib / prelude / TyIO.hs
1 module PreludeIO (
2         Request(..), Response(..), IOError(..),
3         Dialogue(..), SigAct(..),
4         SuccCont(..), StrCont(..), StrListCont(..),
5         BinCont(..), FailCont(..)
6     ) where
7
8 import UTypes
9
10 -- Requests and responses:
11
12 data Request =  -- file system requests:
13                           ReadFile      String         
14                         | WriteFile     String String
15                         | AppendFile    String String
16                         | ReadBinFile   String 
17                         | WriteBinFile  String Bin
18                         | AppendBinFile String Bin
19                         | DeleteFile    String
20                         | StatusFile    String
21                 -- channel system requests:
22                         | ReadChan      String 
23                         | AppendChan    String String
24                         | ReadBinChan   String 
25                         | AppendBinChan String Bin
26                         | StatusChan    String
27                 -- environment requests:
28                         | Echo          Bool
29                         | GetArgs
30                         | GetProgName
31                         | GetEnv        String
32                         | SetEnv        String String
33                         | SigAction     Int    SigAct
34                 deriving () -- NB: Text
35
36 data SigAct =             SAIgnore
37                         | SADefault
38                         | SACatch Dialogue
39
40 data Response =           Success
41                         | Str String 
42                         | StrList [String]
43                         | Bn  Bin
44                         | Failure IOError
45                 deriving () -- NB: Text
46
47 data IOError =            WriteError   String
48                         | ReadError    String
49                         | SearchError  String
50                         | FormatError  String
51                         | OtherError   String
52                         | EOD -- 1.3
53                 deriving () -- NB: Text
54
55
56 -- Continuation-based I/O:
57
58 type Dialogue    =  [Response] -> [Request]
59 type SuccCont    =                Dialogue
60 type StrCont     =  String     -> Dialogue
61 type StrListCont =  [String]   -> Dialogue
62 type BinCont     =  Bin        -> Dialogue
63 type FailCont    =  IOError    -> Dialogue