diff options
Diffstat (limited to 'ghc/docs')
-rw-r--r-- | ghc/docs/Jmakefile | 1 | ||||
-rw-r--r-- | ghc/docs/install_guide/installing.lit | 4 | ||||
-rw-r--r-- | ghc/docs/release_notes/release.lit | 2 | ||||
-rw-r--r-- | ghc/docs/state_interface/state-interface.verb | 123 | ||||
-rw-r--r-- | ghc/docs/users_guide/gone_wrong.lit | 2 | ||||
-rw-r--r-- | ghc/docs/users_guide/prof-compiler-options.lit | 6 | ||||
-rw-r--r-- | ghc/docs/users_guide/prof-output.lit | 63 | ||||
-rw-r--r-- | ghc/docs/users_guide/prof-rts-options.lit | 16 | ||||
-rw-r--r-- | ghc/docs/users_guide/profiling.lit | 2 | ||||
-rw-r--r-- | ghc/docs/users_guide/user.lit | 2 | ||||
-rw-r--r-- | ghc/docs/users_guide/utils.lit | 15 | ||||
-rw-r--r-- | ghc/docs/users_guide/vs_haskell.lit | 46 |
12 files changed, 181 insertions, 101 deletions
diff --git a/ghc/docs/Jmakefile b/ghc/docs/Jmakefile index 799f3e05d2..9e9510cac4 100644 --- a/ghc/docs/Jmakefile +++ b/ghc/docs/Jmakefile @@ -2,6 +2,7 @@ /* just documents here */ #define NoAllTargetForSubdirs +#define NoDependTargetForSubdirs #define NoRunTestsTargetForSubdirs #define NoInstallTargetForSubdirs #define NoTagTargetForSubdirs diff --git a/ghc/docs/install_guide/installing.lit b/ghc/docs/install_guide/installing.lit index 13df5b500a..5cdd18995b 100644 --- a/ghc/docs/install_guide/installing.lit +++ b/ghc/docs/install_guide/installing.lit @@ -1,5 +1,5 @@ % -% $Header: /srv/cvs/cvs.haskell.org/fptools/ghc/docs/install_guide/Attic/installing.lit,v 1.1 1996/01/08 20:25:19 partain Exp $ +% $Header: /srv/cvs/cvs.haskell.org/fptools/ghc/docs/install_guide/Attic/installing.lit,v 1.2 1996/06/27 15:57:32 partain Exp $ % \begin{onlystandalone} \documentstyle[11pt,literate]{article} @@ -12,7 +12,7 @@ University of Glasgow\\ Glasgow, Scotland\\ G12 8QQ\\ \\ -Email: glasgow-haskell-\{request,bugs\}\@dcs.glasgow.ac.uk} +Email: glasgow-haskell-\{users,bugs\}-request\@dcs.glasgow.ac.uk} \maketitle \begin{rawlatex} \tableofcontents diff --git a/ghc/docs/release_notes/release.lit b/ghc/docs/release_notes/release.lit index 16e4d24062..b98df34d3e 100644 --- a/ghc/docs/release_notes/release.lit +++ b/ghc/docs/release_notes/release.lit @@ -8,7 +8,7 @@ University of Glasgow\\ Glasgow, Scotland\\ G12 8QQ\\ \\ -Email: glasgow-haskell-\{bugs,request\}\@dcs.glasgow.ac.uk} +Email: glasgow-haskell-\{users,bugs\}-request\@dcs.glasgow.ac.uk} \maketitle \begin{rawlatex} \tableofcontents diff --git a/ghc/docs/state_interface/state-interface.verb b/ghc/docs/state_interface/state-interface.verb index 37672055c8..c51193aa97 100644 --- a/ghc/docs/state_interface/state-interface.verb +++ b/ghc/docs/state_interface/state-interface.verb @@ -349,8 +349,8 @@ data StateAndFloat# s = StateAndFloat# (State# s) Float# data StateAndDouble# s = StateAndDouble# (State# s) Double# data StateAndAddr# s = StateAndAddr# (State# s) Addr# -data StateAndStablePtr# s a = StateAndStablePtr# (State# s) (StablePtr# a) -data StateAndMallocPtr# s = StateAndMallocPtr# (State# s) MallocPtr# +data StateAndStablePtr# s a = StateAndStablePtr# (State# s) (StablePtr# a) +data StateAndForeignObj# s = StateAndForeignObj# (State# s) ForeignObj# data StateAndSynchVar# s a = StateAndSynchVar# (State# s) (SynchVar# a) data StateAndArray# s elt = StateAndArray# (State# s) (Array# elt) @@ -461,47 +461,68 @@ deRefStablePointer# :: StablePtr# a -> State# _RealWorld -> StateAndPtr _RealWor @ There is also a C procedure @FreeStablePtr@ which frees a stable pointer. -\subsubsection{``Malloc'' pointers} +% +% Rewritten and updated for MallocPtr++ -- 4/96 SOF +% +\subsubsection{Foreign objects} -A ``malloc'' pointer is an ordinary pointer from outside the Haskell world -(i.e., from the C world) where the Haskell world has been told ``Let me +A \tr{ForeignObj} is a reference to an object outside the Haskell +world (i.e., from the C world, or a reference to an object on another +machine completely.), where the Haskell world has been told ``Let me know when you're finished with this ...''. -The ``malloc'' pointer type is just a special @Addr#@ ({\em not} parameterised). +The \tr{ForeignObj} type is just a special @Addr#@ ({\em not} parameterised). @ -type MallocPtr# +type ForeignObj# @ -{\em ToDo: say more about this and how it's used...} -The main point is that when Haskell discards a -value of type @MallocPtr#@, it calls the procedure @FreeMallocPtr@, which -must be provided by the C world. @FreeMallocPtr@ might in turn call -the GHC-provided procedure @FreeStablePtr@, to deallocate a stable pointer. -No other GHC runtime system procedures should be called by @FreeMallocPtr@. +A typical use of \tr{ForeignObj} is in constructing Haskell bindings +to external libraries. A good example is that of writing a binding to +an image-processing library (which was actually the main motivation +for implementing \tr{ForeignObj}'s precursor, \tr{MallocPtr}). The +images manipulated are not stored in the Haskell heap, either because +the library insist on allocating them internally or we (sensibly) +decide to spare the GC from having to heave heavy images around. -(Implementation: a linked list of all @MallocPtr#@s is maintained to allow the -garbage collector to detect when a @MallocPtr#@ becomes garbage.) +@ +data Image = Image ForeignObj# -Like @Array@, @MallocPtr#@s are represented by heap objects. +instance _CCallable Image +@ -{\bf ToDo --- Important:} Ian Poole reports a need for functions to return a list of -CHPs. Should we add a @CHeapPtrArray@ type too? or just -hack something up? +The \tr{ForeignObj#} type is then used to refer to the externally +allocated image, and to acheive some type safety, the Haskell binding +defines the @Image@ data type. So, a value of type \tr{ForeignObj#} is +used to ``box'' up an external reference into a Haskell heap object +that we can then indirectly reference: -The only Haskell operation we might want on @MallocPtr#@s is an -equality test. However, this is easily implemented if desired: @ -> eqCHP x y = (_runST (_ccall_ equal x y) == 1::Int) +createImage :: (Int,Int) -> PrimIO Image +@ + +So far, this looks just like an @Addr#@ type, but \tr{ForeignObj#} +offers a bit more, namely that we can specify a {\em finalisation +routine} to invoke when the \tr{ForeignObj#} is discarded by the +GC. The garbage collector invokes the finalisation routine associated +with the \tr{ForeignObj#}, saying `` Thanks, I'm through with this +now..'' For the image-processing library, the finalisation routine could for +the images free up memory allocated for them. The finalisation routine has +currently to be written in C (the finalisation routine can in turn call on +@FreeStablePtr@ to deallocate a stable pointer.). -C> equal (x, y) -C> { -C> return (x == y ? 1 : 0); -C> } +Associating a finalisation routine with an external object is done by +\tr{makeForeignObj#}: + +@ +makeForeignObj# :: Addr# -- foreign reference + -> Addr# -- pointer to finalisation routine + -> StateAndForeignObj# _RealWorld ForeignObj# @ -The C world must provide a function @FreeCHeapPointer@ which -will be called (with a C Heap pointer as argument) when the garbage -collector releases a CHP. +(Implementation: a linked list of all @ForeignObj#@s is maintained to allow the + garbage collector to detect when a @ForeignObj#@ becomes garbage.) + +Like @Array@, @ForeignObj#@s are represented by heap objects. {\bf ToDo:} Decide whether @FreeCHeapPointer@ is allowed to call on a stable pointer. (I sincerely hope not since we will still be in the @@ -803,14 +824,14 @@ writeCharArray :: Ix ix => _MutableByteArray s ix -> ix -> Char -> _ST s () @ freezeArray :: Ix ix => _MutableArray s ix elt -> _ST s (Array ix elt) -freezeCharArray :: Ix ix => _MutableByteArray s ix -> _ST s (_ByteArray ix Char) +freezeCharArray :: Ix ix => _MutableByteArray s ix -> _ST s (_ByteArray ix) ... @ We have no need on one-function-per-type for unsafe freezing: @ unsafeFreezeArray :: Ix ix => _MutableArray s ix elt -> _ST s (Array ix elt) -unsafeFreezeByteArray :: Ix ix => _MutableByteArray s ix -> _ST s (_ByteArray ix elt) +unsafeFreezeByteArray :: Ix ix => _MutableByteArray s ix -> _ST s (_ByteArray ix) @ Sometimes we want to snaffle the bounds of one of these beasts: @@ -854,11 +875,13 @@ makeStablePointer :: a -> _StablePtr a freeStablePointer :: _StablePtr a -> PrimIO () @ -\subsection{``Malloc'' pointers} +\subsection{Foreign objects} Again, just boxing up. @ -data _MallocPtr = _MallocPtr MallocPtr# +data _ForeignObj = _ForeignObj ForeignObj# + +makeForeignObj :: _Addr -> _Addr -> PrimIO _ForeignObj @ \subsection{C calls} @@ -899,22 +922,22 @@ table summarises (including the standard boxed-primitive types): Boxed Type of transferd Corresp. Which is Type Prim. component C type *probably*... ------ --------------- ------ ------------- -Char Char# StgChar unsigned char -Int Int# StgInt long int -_Word Word# StgWord unsigned long int -_Addr Addr# StgAddr char * -Float Float# StgFloat float -Double Double# StgDouble double - -Array Array# StgArray StgPtr -_ByteArray ByteArray# StgByteArray StgPtr -_MutableArray MutableArray# StgArray StgPtr -_MutableByteArray MutableByteArray# StgByteArray StgPtr +Char Char# StgChar unsigned char +Int Int# StgInt long int +_Word Word# StgWord unsigned long int +_Addr Addr# StgAddr char * +Float Float# StgFloat float +Double Double# StgDouble double + +Array Array# StgArray StgPtr +_ByteArray ByteArray# StgByteArray StgPtr +_MutableArray MutableArray# StgArray StgPtr +_MutableByteArray MutableByteArray# StgByteArray StgPtr _State State# nothing! -_StablePtr StablePtr# StgStablePtr StgPtr -_MallocPtr MallocPtr# StgMallocPtr StgPtr +_StablePtr StablePtr# StgStablePtr StgPtr +_ForeignObj ForeignObj# StgForeignObj StgPtr @ All of the above are {\em C-returnable} except: @@ -959,8 +982,10 @@ are stored on the heap. ... details omitted ... -More importantly, it must construct a C Heap Pointer heap-object after -a @_ccall_@ which returns a @MallocPtr#@. +% +%More importantly, it must construct a C Heap Pointer heap-object after +%a @_ccall_@ which returns a @MallocPtr#@. +% %-------------------------------------------------------- \section{Non-primitive stuff that must be wired into GHC} @@ -977,7 +1002,7 @@ data Integer = J# Int# Int# ByteArray# -- and the other boxed-primitive types: Array, _ByteArray, _MutableArray, _MutableByteArray, - _StablePtr, _MallocPtr + _StablePtr, _ForeignObj data Bool = False | True data CMP_TAG# = LT# | EQ# | GT# -- used in derived comparisons diff --git a/ghc/docs/users_guide/gone_wrong.lit b/ghc/docs/users_guide/gone_wrong.lit index 4403d203f9..960d3b7f36 100644 --- a/ghc/docs/users_guide/gone_wrong.lit +++ b/ghc/docs/users_guide/gone_wrong.lit @@ -52,7 +52,7 @@ This is a bug just as surely as a ``panic.'' Please report it. \item[``Some confusion about a value specialised to a type...'' Huh???] (A deeply obscure and unfriendly error message.) -This message crops up when the typechecker is sees a reference in an +This message crops up when the typechecker sees a reference in an interface pragma to a specialisation of an overloaded value (function); for example, \tr{elem} specialised for type \tr{[Char]} (\tr{String}). The problem is: it doesn't {\em know} that such a diff --git a/ghc/docs/users_guide/prof-compiler-options.lit b/ghc/docs/users_guide/prof-compiler-options.lit index 21d8ca6965..0f870b431f 100644 --- a/ghc/docs/users_guide/prof-compiler-options.lit +++ b/ghc/docs/users_guide/prof-compiler-options.lit @@ -53,6 +53,12 @@ declared in the module. If no group is specified it defaults to the module name. \end{description} +In addition to the \tr{-prof} option your system might be setup to +enable you to compile and link with the \tr{-prof-details} +\index{\tr{-prof-details option}} option instead. This enables +additional detailed counts to be reported with the \tr{-P} RTS option. +%-prof-details should also enable age profiling if we get it going again ... + %Alternative profiling semantics have also been implemented. To use %these the runtime system and prelude libraries must have been built %for the alternative profiling setup. This is done using a particular diff --git a/ghc/docs/users_guide/prof-output.lit b/ghc/docs/users_guide/prof-output.lit index a246b382cc..868c98c47a 100644 --- a/ghc/docs/users_guide/prof-output.lit +++ b/ghc/docs/users_guide/prof-output.lit @@ -3,7 +3,7 @@ % When you run your profiled program with the \tr{-p} RTS option -\index{\tr{-p<sort> RTS option (profiling)}, you get the following +\index{\tr{-p<sort> RTS option (profiling)}}, you get the following information about your ``cost centres'': \begin{description} @@ -19,12 +19,6 @@ different modules. How many times this cost-centre was entered; think of it as ``I got to the \tr{_scc_} construct this many times...'' %------------------------------------------------------------- -\item[\tr{subcc}:] -How many times this cost-centre ``passed control'' to another -cost-centre; for example, \tr{scc=4} plus \tr{subscc=8} means -``This \tr{_scc_} was entered four times, but went out to -other \tr{_scc_s} eight times.'' -%------------------------------------------------------------- \item[\tr{%time}:] What part of the time was spent in this cost-centre (see also ``ticks,'' below). @@ -32,18 +26,43 @@ below). \item[\tr{%alloc}:] What part of the memory allocation was done in this cost-centre (see also ``bytes,'' below). +%------------------------------------------------------------- +\item[\tr{inner}:] +How many times this cost-centre ``passed control'' to an inner +cost-centre; for example, \tr{scc=4} plus \tr{subscc=8} means +``This \tr{_scc_} was entered four times, but went out to +other \tr{_scc_s} eight times.'' +%------------------------------------------------------------- +\item[\tr{cafs}:] +How many CAFs this cost centre evaluated. +%------------------------------------------------------------- +\item[\tr{dicts}:] +How many dictionaries this cost centre evaluated. +\end{description} + +In addition you can use the \tr{-P} RTS option \index{\tr{-P<sort> RTS + option (profiling)}} to get the following additional information: +\begin{description} +%------------------------------------------------------------- +\item[\tr{ticks}:] The raw number of time ``ticks'' which were +attributed to this cost-centre; from this, we get the \tr{%time} +figure mentioned above. +%------------------------------------------------------------- +\item[\tr{bytes}:] Number of bytes allocated in the heap while in +this cost-centre; again, this is the raw number from which we +get the \tr{%alloc} figure mentioned above. \end{description} -If you use the \tr{-P} RTS option -\index{\tr{-P<sort> RTS option (profiling)}, you will also get the -following information: +Finally if you built your program with \tr{-prof-details} +\index{\tr{-prof-details option}} the \tr{-P} RTS option will also +produce the following information: \begin{description} %------------------------------------------------------------- -\item[\tr{cafcc}:] Two columns, analogous to the \tr{scc} and \tr{subcc} -columns, except these are for CAF cost-centres: the first column -is how many times this top-level CAF cost-centre was entered; -the second column is how many times this cost-centre (CAF or otherwise) -entered another CAF cost-centre. +\item[\tr{closures}:] +How many heap objects were allocated; these objects may be of varying +size. If you divide the number of bytes (mentioned below) by this +number of ``closures'', then you will get the average object size. +(Not too interesting, but still...) %------------------------------------------------------------- \item[\tr{thunks}:] How many times we entered (evaluated) a thunk---an unevaluated @@ -60,18 +79,4 @@ How many times we entered (evaluated) a partial application (PAP), i.e., a function applied to fewer arguments than it needs. For example, \tr{Int} addition applied to one argument would be a PAP. A PAP is really just a particular form for a function. -%------------------------------------------------------------- -\item[\tr{closures}:] -How many heap objects were allocated; these objects may be of varying -size. If you divide the number of bytes (mentioned below) by this -number of ``closures'', then you will get the average object size. -(Not too interesting, but still...) -%------------------------------------------------------------- -\item[\tr{ticks}:] The raw number of time ``ticks'' which were -attributed to this cost-centre; from this, we get the \tr{%time} -figure mentioned above. -%------------------------------------------------------------- -\item[\tr{bytes}:] Number of bytes allocated in the heap while in -this cost-centre; again, this is the raw number from which we -get the \tr{%alloc} figure mentioned above. \end{description} diff --git a/ghc/docs/users_guide/prof-rts-options.lit b/ghc/docs/users_guide/prof-rts-options.lit index 022d4e3172..12325d5ba0 100644 --- a/ghc/docs/users_guide/prof-rts-options.lit +++ b/ghc/docs/users_guide/prof-rts-options.lit @@ -64,10 +64,10 @@ The heap space profile may be broken down by different criteria: \item[\tr{-hG}:] cost centre group which produced the closure. \item[\tr{-hD}:] closure description --- a string describing the closure. \item[\tr{-hY}:] closure type --- a string describing the closure's type. -\item[\tr{-hT<ints>,<start>}:] the time interval the closure was -created. \tr{<ints>} specifies the no. of interval bands plotted -(default 18) and \tr{<start>} the number of seconds after which the -reported intervals start (default 0.0). +%\item[\tr{-hT<ints>,<start>}:] the time interval the closure was +%created. \tr{<ints>} specifies the no. of interval bands plotted +%(default 18) and \tr{<start>} the number of seconds after which the +%reported intervals start (default 0.0). \end{description} By default all live closures in the heap are profiled, but particular closures of interest can be selected (see below). @@ -107,14 +107,14 @@ Selects closures which are of one of the specified closure kinds. Valid closure kinds are \tr{CON} (constructor), \tr{FN} (manifest function), \tr{PAP} (partial application), \tr{BH} (black hole) and \tr{THK} (thunk). -\item[\tr{-a<age>}:] -\index{-a<age> RTS option (profiling)} -Selects closures which have survived \pl{<age>} complete intervals. +%\item[\tr{-a<age>}:] +%\index{-a<age> RTS option (profiling)} +%Selects closures which have survived \pl{<age>} complete intervals. \end{description} The space occupied by a closure will be reported in the heap profile if the closure satisfies the following logical expression: \begin{display} -([-c] or [-m] or [-g]) and ([-d] or [-y] or [-k]) and [-a] +([-c] or [-m] or [-g]) and ([-d] or [-y] or [-k]) %and [-a] \end{display} where a particular option is true if the closure (or its attached cost centre) is selected by the option (or the option is not specified). diff --git a/ghc/docs/users_guide/profiling.lit b/ghc/docs/users_guide/profiling.lit index 68d4a7e303..9f55739411 100644 --- a/ghc/docs/users_guide/profiling.lit +++ b/ghc/docs/users_guide/profiling.lit @@ -8,7 +8,7 @@ University of Glasgow\\ Glasgow, Scotland\\ G12 8QQ\\ \\ -Email: glasgow-haskell-\{bugs,request\}\@dcs.glasgow.ac.uk} +Email: glasgow-haskell-\{users,bugs\}-request\@dcs.glasgow.ac.uk} \maketitle \begin{rawlatex} \tableofcontents diff --git a/ghc/docs/users_guide/user.lit b/ghc/docs/users_guide/user.lit index 51f63e20a5..858a12b814 100644 --- a/ghc/docs/users_guide/user.lit +++ b/ghc/docs/users_guide/user.lit @@ -8,7 +8,7 @@ University of Glasgow\\ Glasgow, Scotland\\ G12 8QQ\\ \\ -Email: glasgow-haskell-\{bugs,request\}\@dcs.glasgow.ac.uk} +Email: glasgow-haskell-\{bugs,users\}-request\@dcs.glasgow.ac.uk} \maketitle \begin{rawlatex} \tableofcontents diff --git a/ghc/docs/users_guide/utils.lit b/ghc/docs/users_guide/utils.lit index d007621521..6ec326e6f9 100644 --- a/ghc/docs/users_guide/utils.lit +++ b/ghc/docs/users_guide/utils.lit @@ -27,7 +27,9 @@ HCFLAGS = -fhaskell-1.3 -cpp -hi-diffs $(EXTRA_HC_OPTS) SRCS = Main.lhs Foo.lhs Bar.lhs OBJS = Main.o Foo.o Bar.o -.SUFFIXES : .o .lhs +.SUFFIXES : .o .hi .lhs +.o.hi: + @: .lhs.o: $(RM) $@ $(HC) -c $< $(HCFLAGS) @@ -37,6 +39,14 @@ cool_pgm : $(OBJS) $(HC) -o $@ $(HCFLAGS) $(OBJS) \end{verbatim} +Note the cheesy \tr{.o.hi} rule: It records the dependency of the +interface (\tr{.hi}) file on the source. The rule says a \tr{.hi} +file can be made from a \tr{.o} file by doing... nothing. Which is +true. + +(Sophisticated \tr{make} variants may achieve some of the above more +elegantly. What we've shown should work with any \tr{make}.) + The only thing lacking in the above \tr{Makefile} is interface-file dependencies. If \tr{Foo.lhs} imports module \tr{Bar} and the \tr{Bar} interface changes, then \tr{Foo.lhs} needs to be recompiled. @@ -64,6 +74,9 @@ effect. However, a \tr{make} run that does nothing {\em does} mean mutually-recursive modules but, again, it may take multiple iterations to ``settle.'' +To see \tr{mkdependHS}'s command-line flags, give it a duff flag, +e.g., \tr{mkdependHS -help}. + %************************************************************************ %* * \subsection[hstags]{Emacs `TAGS' for Haskell: \tr{hstags}} diff --git a/ghc/docs/users_guide/vs_haskell.lit b/ghc/docs/users_guide/vs_haskell.lit index c4fc5e5b7b..912e2df78c 100644 --- a/ghc/docs/users_guide/vs_haskell.lit +++ b/ghc/docs/users_guide/vs_haskell.lit @@ -362,13 +362,13 @@ Here is our ``crib sheet'' for converting 1.2 I/O to 1.3. In most cases, it's really easy. \begin{enumerate} \item -Change \tr{readChan stdin} to \tr{hGetContents stdin}. +Change \tr{readChan stdin} to \tr{getContents}. \item Change \tr{appendChan stdout} to \tr{putStr}, which is equivalent to \tr{hPutStr stdout}. Change \tr{appendChan stderr} to \tr{hPutStr stderr}. \item -You need to \tr{import LibSystem} if you used @getArgs@, @getEnv@, +You need to \tr{import System} if you used @getArgs@, @getEnv@, or @getProgName@. \item Assuming continuation-style @Dialogue@ code, change \tr{... exit done $} @@ -378,6 +378,36 @@ If you had any functions named \tr{(>>)}, \tr{(>>=)}, or \tr{return}, change them to something else. \end{enumerate} +Also: +1.3 I/O all the way. +\tr{Dialogue} usually turns into \tr{IO ()}. +Use of \tr{StatusFile} request: rewrite (no equivalent exists). +Add \tr{import Ratio} if you use \tr{Rationals} at all. +Ditto: \tr{import Complex} if you use complex numbers. +Ditto: \tr{import Array} if you use arrays. Also: note that +Arrays now use ordinary pairs, rather than a separate \tr{Assoc} type. +May be easier to do: +infix 1 =: +(=:) a b = (a,b) +and switch := to =: +This can happen: \tr{LiteralInt.leStringToInt}; add spaces. +For \tr{minInt}/\tr{maxInt}, \tr{minChar}/\tr{maxChar} (???) +use the \tr{Bounded} class methods, \tr{minBound} and \tr{maxBound}. +Replace class \tr{Text} with \tr{Show}; on rare occasions, +you may need to do something for \tr{Read}, too. +The functions \tr{ord} and \tr{chr} have been replaced by +the class methods \tr{fromEnum} and \tr{toEnum}, respectively. +The changes, however, can lead to ambiguous overloading. +Need \tr{import IO} for anything interesting. +What was called \tr{handle} is now called \tr{catch}. +New keyword: \tr{do}. +Other clashes: e.g., \tr{seq}, \tr{fail}. +\tr{readDec} no longer exists; use ???. +Type of \tr{fail} changed? +\tr{(a `op` b) c = ...} is bogus. +`failWith x' now `fail x' +`fail x' now `fail (userError x)' + %************************************************************************ %* * \subsection[nonio-1-3]{Non-I/O things from the 1.3-DRAFT proposal} @@ -444,10 +474,10 @@ The error type is called \tr{IOError13}, rather than \tr{IOError} so...) You probably shouldn't be messing with \tr{IOError} much, anyway. -Some of the 1.3 I/O code, notably the Extremely Cool \tr{LibPosix} +Some of the 1.3 I/O code, notably the Extremely Cool \tr{Posix} stuff, is relatively untested. Go for it, but be wary... -\index{LibPosix bugs} -\index{bugs, LibPosix} +\index{Posix library bugs} +\index{bugs, Posix library} %************************************************************************ %* * @@ -470,7 +500,7 @@ required) and put into \tr{Lib*} interfaces (import required). GHC~0.26 still provides the I/O functions via \tr{Prelude.hi} (no import required). Ignore the ``June draft'' pleadings for -\tr{import LibIO}, and you'll be fine. +\tr{import IO}, and you'll be fine. {\em There is no guarantee that the final 1.3 proposal will look anything like the current DRAFT.} It ain't a standard until the fat @@ -557,11 +587,11 @@ with \tr{-fhaskell-1.3}...) To subvert the above process, you need only provide a @mainPrimIO :: PrimIO ()@ of your own -(in a module named \tr{Main}). Do {\em not} use a \tr{-fhaskell-1.3} flag! +(in a module named \tr{GHCmain}). Do {\em not} use a \tr{-fhaskell-1.3} flag! Here's a little example, stolen from Alastair Reid: \begin{verbatim} -module Main ( mainPrimIO ) where +module GHCmain ( mainPrimIO ) where import PreludeGlaST |