Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
GHC
Commits
72b21596
Commit
72b21596
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-01-30 17:29:12 by sof]
New sections on naming conventions and NumExts
parent
4586d014
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/docs/libraries/libs.sgml
+88
-7
88 additions, 7 deletions
ghc/docs/libraries/libs.sgml
with
88 additions
and
7 deletions
ghc/docs/libraries/libs.sgml
+
88
−
7
View file @
72b21596
...
...
@@ -10,7 +10,7 @@
<title>The Hugs-GHC Extension Libraries
<author>Alastair Reid <tt/reid-alastair@cs.yale.edu/
Simon Marlow <tt/simonm@dcs.gla.ac.uk/
<date>v0.8,
14 December
199
7
<date>v0.8,
28 January
199
8
<abstract>
Hugs and GHC provide a common set of libraries to aid portability.
This document specifies the interfaces to these libraries and documents
...
...
@@ -20,6 +20,55 @@ as Standard Haskell Libraries sometime soon.
<toc>
<sect> <idx/Naming conventions/
<label id="sec:Naming conventions">
<p>
The set of interfaces specified in this document try to adhere to the
following naming conventions:
<itemize>
<item>
Actions that create a new values have the prefix <tt/new/ followed by
the name of the type of object they're creating, e.g., <tt/newIORef/,
<tt/newChan/ etc.
<item>
Operations that read a value from a mutable object are prefixed with
<tt/read/, and operations that update the contents have the prefix
<tt/write/, e.g., <tt/readChan/, <tt/readIOArray/.
Notes:
<itemize>
<item>
This differs from the convention used to name the operations for
reading and writing to a file <tt/Handle/, where <tt/get/ and <tt/put/
are used instead.
<item>
Operations provided by various concurrency abstractions, e.g., <tt/MVar/,
<tt/CVar/ , also deviate from this naming scheme. This is perhaps
defensible, since the read and write operations have additional
behaviour, e.g., <tt/takeMVar/ tries to read the current value
of an <tt/MVar/, locking it if it succeeds.
</itemize>
<item>
Conversions operators have the form <tt/AToB/ where <tt/A/ and <tt/B/
are the types we're converting between.
<item>
Operations that lazily read values from a mutable object/handle, have
the form <tt/getXContents/, e.g., <tt/Channel.getChanContents/ and
<tt/IO.hGetContents/. (OK, so the latter isn't called
<tt/getHandleContents/, but you hopefully get the picture.)
</itemize>
<sect> <idx/LazyST/ <p>
This library provides support for both <em/lazy/ and <em/strict/ state
threads, as described in the PLDI '94 paper by John Launchbury and
Simon Peyton Jones <cite id="LazyStateThreads">. In addition to the
monad <tt/ST/, it also provides mutable variables <tt/STRef/ and
mutable arrays <tt/STArray/. As the name suggests, the monad <tt/ST/
instance is <em/lazy/.
=======
<sect> <idx/ST/
<label id="sec:ST">
<p>
...
...
@@ -307,12 +356,12 @@ The types supported are as follows:
<tabular ca="ll">
type | number of bits @
<hline>
<!--
<hline>
-->
Word8 | 8 @
Word16 | 16 @
Word32 | 32 @
Word64 | 64 @
<hline>
<!--
<hline>
-->
</tabular>
For each type <it/W/ above, we provide the following functions and
...
...
@@ -402,12 +451,12 @@ supported are as follows:
<tabular ca="ll">
type | number of bits @
<hline>
<!--
<hline>
-->
Int8 | 8 @
Int16 | 16 @
Int32 | 32 @
Int64 | 64 @
<hline>
<!--
<hline>
-->
</tabular>
For each type <it/I/ above, we provide the following instances.
...
...
@@ -512,8 +561,40 @@ Hugs provides <tt/Addr/ and <tt/nullAddr/ but does not provide any of
the index, read or write functions. They can be implemented using
GreenCard if required.
<sect> <idx/ForeignObj/
<label id="sec:ForeignObj">
<sect> <idx/NumExts/
<label id="sec:NumExts">
<p>
The <tt/NumExts/ interface collect together various numeric
operations that have proven to be commonly useful
<tscreen> <verb>
-- Going between Doubles and Floats:
doubleToFloat :: Double -> Float
floatToDouble :: Float -> Double
showHex :: Integral a => a -> ShowS
showOct :: Integral a => a -> ShowS
</verb> </tscreen>
Notes:
<itemize>
<item>
If <tt/doubleToFloat/ is applied to a <tt/Double/ that is within
the representable range for <tt/Float/, the result may be the next
higher or lower representable <tt/Float/ value. If the <tt/Double/
is out of range, the result is undefined.
<item>
No loss of precision occurs in the other direction with
<tt/floatToDouble/, the floating value remains unchanged.
<item>
<tt/showOct/ and <tt/showHex/ will prefix <tt/0o/ and <tt/0x/
respectively. Like <tt/Numeric.showInt/, these show functions
work on positive numbers only.
</itemize>
<sect> <idx/Foreign/
<label id="sec:Foreign">
<p>
This module is provided by GHC but not by Hugs.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment