29175f1cd3bd8160bd51ba336b3325717d968749
[ghc-hetmet.git] / ghc / docs / libraries / libs.sgml
1 <!doctype linuxdoc system [
2   <!ENTITY addr       SYSTEM "Addr.sgml">
3   <!ENTITY bits       SYSTEM "Bits.sgml">
4   <!ENTITY concurrent SYSTEM "Concurrent.sgml">
5   <!ENTITY dynamic    SYSTEM "Dynamic.sgml">
6   <!ENTITY exception  SYSTEM "Exception.sgml">
7   <!ENTITY foreign    SYSTEM "Foreign.sgml">
8   <!ENTITY glaexts    SYSTEM "GlaExts.sgml">
9   <!ENTITY ioexts     SYSTEM "IOExts.sgml">
10   <!ENTITY int        SYSTEM "Int.sgml">
11   <!ENTITY ndset      SYSTEM "NDSet.sgml">
12   <!ENTITY numexts    SYSTEM "NumExts.sgml">
13   <!ENTITY pretty     SYSTEM "Pretty.sgml">
14   <!ENTITY st         SYSTEM "ST.sgml">
15   <!ENTITY weak       SYSTEM "Weak.sgml">
16   <!ENTITY word       SYSTEM "Word.sgml">
17 ]>
18
19 <!-- ToDo:
20   o Add indexing support (to linuxdoc)
21   o Fix citations in html
22   -->
23
24 <article>
25
26 <title>The Hugs-GHC Extension Libraries
27 <author>The Hugs/GHC Team 
28 <date>January 1999
29 <abstract>
30 Hugs and GHC provide a common set of libraries to aid portability.
31 This document specifies the interfaces to these libraries and documents
32 known differences.
33 </abstract>
34
35 <toc>
36
37 <sect> <idx/Naming conventions/ 
38 <label id="sec:Naming conventions">
39 <p>
40
41 The set of interfaces specified in this document try to adhere to the
42 following naming conventions: 
43
44 <itemize>
45 <item>
46 Actions that create a new values have the prefix <tt/new/ followed by
47 the name of the type of object they're creating, e.g., <tt/newIORef/,
48 <tt/newChan/ etc.
49 <item>
50 Operations that read a value from a mutable object are prefixed with
51 <tt/read/, and operations that update the contents have the prefix
52 <tt/write/, e.g., <tt/readChan/, <tt/readIOArray/.
53
54 Notes: 
55 <itemize>
56 <item>
57 This differs from the convention used to name the operations for
58 reading and writing to a file <tt/Handle/, where <tt/get/ and <tt/put/
59 are used instead.
60 <item>
61 Operations provided by various concurrency abstractions, e.g., <tt/MVar/,
62 <tt/CVar/ , also deviate from this naming scheme. This is perhaps
63 defensible, since the read and write operations have additional
64 behaviour, e.g., <tt/takeMVar/ tries to read the current value
65 of an <tt/MVar/, locking it if it succeeds.
66 </itemize>
67 <item>
68 Conversions operators have the form <tt/AToB/ where <tt/A/ and <tt/B/
69 are the types we're converting between.
70 <item>
71 Operations that lazily read values from a mutable object/handle, have
72 the form <tt/getXContents/, e.g., <tt/Channel.getChanContents/ and
73 <tt/IO.hGetContents/. (OK, so the latter isn't called
74 <tt/getHandleContents/, but you hopefully get the picture.)
75 </itemize>
76
77 <!-- ========================= -->
78
79 &addr
80 &bits
81 &concurrent
82 &dynamic
83 &exception
84 &foreign
85 &glaexts
86 &ioexts
87 &int
88
89 &numexts
90 &pretty
91 &st
92
93 <sect> <idx/LazyST/ 
94 <label id="sec:LazyST">
95 <p>
96
97 This library is identical to <tt/ST/ except that the <tt/ST/ monad
98 instance is <em/lazy/.  The lazy ST monad tends to be more prone to
99 space leaks than the strict version, so most programmers will use the
100 former unless laziness is explicitly required.  <tt/LazyST/ provides
101 two additional operations:
102
103 <tscreen> <verb>
104 lazyToStrictST :: LazyST.ST s a -> ST.ST s a
105 strictToLazyST :: ST.ST s a -> LazyST.ST s a
106 </verb> </tscreen>
107
108 These are used to convert between lazy and strict state threads.  The
109 semantics with respect to laziness are as you would expect: the strict
110 state thread passed to <tt/strictToLazyST/ is not performed until the
111 result of the lazy state thread it returns is demanded.
112
113 &weak
114 &word
115
116 <!-- ========================= -->
117
118 <biblio files="refs" style="abbrv">
119
120
121 </article>
122