X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fglasgow_exts.xml;h=319104e108a4937e7f1520f7c43b35a61348c5e6;hb=d4f8ccee287199f4ac34321f0fad64316950fc25;hp=e5b7154afda20fcff90598624806b7dac300d54d;hpb=317da78a27cda0c07fce325953f096453bcef477;p=ghc-hetmet.git
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index e5b7154..319104e 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -1010,8 +1010,8 @@ in a type synonym, thus:
f :: Discard a
f x y = (x, show y)
- g :: Discard Int -> (Int,Bool) -- A rank-2 type
- g f = f Int True
+ g :: Discard Int -> (Int,String) -- A rank-2 type
+ g f = f 3 True
@@ -4236,7 +4236,46 @@ Hello
+
+
+Using Template Haskell with Profiling
+profilingwith Template Haskell
+Template Haskell relies on GHC's built-in bytecode compiler and
+interpreter to run the splice expressions. The bytecode interpreter
+runs the compiled expression on top of the same runtime on which GHC
+itself is running; this means that the compiled code referred to by
+the interpreted expression must be compatible with this runtime, and
+in particular this means that object code that is compiled for
+profiling cannot be loaded and used by a splice
+expression, because profiled object code is only compatible with the
+profiling version of the runtime.
+
+This causes difficulties if you have a multi-module program
+containing Template Haskell code and you need to compile it for
+profiling, because GHC cannot load the profiled object code and use it
+when executing the splices. Fortunately GHC provides a workaround.
+The basic idea is to compile the program twice:
+
+
+
+ Compile the program or library first the normal way, without
+ .
+
+
+ Then compile it again with , and
+ additionally use
+ to name the object files differentliy (you can choose any suffix
+ that isn't the normal object suffix here). GHC will automatically
+ load the object files built in the first step when executing splice
+ expressions. If you omit the flag when
+ building with and Template Haskell is used,
+ GHC will emit an error message.
+
+
+
+
@@ -5989,6 +6028,74 @@ r) ->
+
+Special built-in functions
+GHC has a few built-in funcions with special behaviour,
+described in this section. All are exported by
+GHC.Exts.
+
+The inline function
+
+The inline function is somewhat experimental.
+
+ inline :: a -> a
+
+The call (inline f) arranges that f
+is inlined, regardless of its size. More precisely, the call
+(inline f) rewrites to the right-hand side of f's
+definition.
+This allows the programmer to control inlining from
+a particular call site
+rather than the definition site of the function
+(c.f. INLINE pragmas ).
+
+
+This inlining occurs regardless of the argument to the call
+or the size of f's definition; it is unconditional.
+The main caveat is that f's definition must be
+visible to the compiler. That is, f must be
+let-bound in the current scope.
+If no inlining takes place, the inline function
+expands to the identity function in Phase zero; so its use imposes
+no overhead.
+
+ If the function is defined in another
+module, GHC only exposes its inlining in the interface file if the
+function is sufficiently small that it might be
+inlined by the automatic mechanism. There is currently no way to tell
+GHC to expose arbitrarily-large functions in the interface file. (This
+shortcoming is something that could be fixed, with some kind of pragma.)
+
+
+
+The inline function
+
+The lazy function restrains strictness analysis a little:
+
+ lazy :: a -> a
+
+The call (lazy e) means the same as e,
+but lazy has a magical property so far as strictness
+analysis is concerned: it is lazy in its first argument,
+even though its semantics is strict. After strictness analysis has run,
+calls to lazy are inlined to be the identity function.
+
+
+This behaviour is occasionally useful when controlling evaluation order.
+Notably, lazy is used in the library definition of
+Control.Parallel.par:
+
+ par :: a -> b -> b
+ par x y = case (par# x) of { _ -> lazy y }
+
+If lazy were not lazy, par would
+look strict in y which would defeat the whole
+purpose of par.
+
+
+
+
+
Generic classes