|   I'd like to know what the function GHC.Prim.realWorld does exactlly
| in the STG code below:

Think of it as a fixed value.  We want the join point $w$j to be a
function, with at least one argument, otherwise it'll be evaluated
eagerly (since it has a primitive type), which is semantically wrong.
It's rather like saying (\().e), only cheaper, because passing ()
requires you to actually pass a value, whereas the 'realword' token has
a type that says "you don't need to pass anything at runtime".

GHC.Prim is a built-in module for functions and types that can't be
defined in Haskell.

The functions in GHC.Prim are enumerated in
ghc/compiler/prelude/primops.txt.pp

Simon

| 
| PrelBase.divInt# =
|     \r [x# y#]
|       let-no-escape {
|         $w$j =
|             sat-only \r [w]
|                 case <# [x# 0] of wild {
|                   GHC.Base.False -> quotInt# [x# y#];
|                   GHC.Base.True ->
|                       case ># [y# 0] of wild1 {
|                         GHC.Base.True ->
|                             case +# [x# 1] of sat_s10t {
|                               __DEFAULT ->
|                                   case quotInt# [sat_s10t y#] of
sat_s10w {
|                                     __DEFAULT -> -# [sat_s10w 1];
|                                   };
|                             };
|                         GHC.Base.False -> quotInt# [x# y#];
|                       };
|                 };
|       } in
|         case ># [x# 0] of wild {
|           GHC.Base.False -> $w$j GHC.Prim.realWorld#;
|           GHC.Base.True ->
|               case <# [y# 0] of wild1 {
|                 GHC.Base.True ->
|                     case -# [x# 1] of sat_s10I {
|                       __DEFAULT ->
|                           case quotInt# [sat_s10I y#] of sat_s10L {
|                             __DEFAULT -> -# [sat_s10L 1];
|                           };
|                     };
|                 GHC.Base.False -> $w$j GHC.Prim.realWorld#;
|               };
|         };
| 
|   Finally, where is the module GHC.Prim defined ?  I've looked for it
| in GHC source directories but I haven't found it.  Is it part of the
| runtime system ?
| 
| Thanks in advance,
| 
| --
| ________________________________
| Monique Louise B.Monteiro
| Msc Student in Computer Science
| Center of Informatics
| Federal University of Pernambuco
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to