[commit: ghc] master: Comments and white space (61baf71)

git at git.haskell.org git at git.haskell.org
Thu Aug 7 08:55:26 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/61baf71021976a105080b060f72df1f1f611389e/ghc

>---------------------------------------------------------------

commit 61baf71021976a105080b060f72df1f1f611389e
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Aug 1 16:38:33 2014 +0100

    Comments and white space


>---------------------------------------------------------------

61baf71021976a105080b060f72df1f1f611389e
 compiler/coreSyn/CoreSyn.lhs   | 42 ++++++++++++++++++++++--------------------
 compiler/coreSyn/CoreUtils.lhs |  6 ++----
 compiler/iface/BuildTyCl.lhs   |  0
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/compiler/coreSyn/CoreSyn.lhs b/compiler/coreSyn/CoreSyn.lhs
index b36cb6d..8678678 100644
--- a/compiler/coreSyn/CoreSyn.lhs
+++ b/compiler/coreSyn/CoreSyn.lhs
@@ -180,24 +180,7 @@ These data types are the heart of the compiler
 --    /must/ be of lifted type (see "Type#type_classification" for
 --    the meaning of /lifted/ vs. /unlifted/).
 --    
---    #let_app_invariant#
---    The right hand side of of a non-recursive 'Let' 
---    _and_ the argument of an 'App',
---    /may/ be of unlifted type, but only if the expression 
---    is ok-for-speculation.  This means that the let can be floated 
---    around without difficulty. For example, this is OK:
---    
---    > y::Int# = x +# 1#
---    
---    But this is not, as it may affect termination if the 
---    expression is floated out:
---    
---    > y::Int# = fac 4#
---    
---    In this situation you should use @case@ rather than a @let at . The function
---    'CoreUtils.needsCaseBinding' can help you determine which to generate, or
---    alternatively use 'MkCore.mkCoreLet' rather than this constructor directly,
---    which will generate a @case@ if necessary
+--    See Note [CoreSyn let/app invariant]
 --
 --    #type_let#
 --    We allow a /non-recursive/ let to bind a type variable, thus:
@@ -359,9 +342,28 @@ See #letrec_invariant#
 
 Note [CoreSyn let/app invariant]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-See #let_app_invariant#
+The let/app invariant
+     the right hand side of of a non-recursive 'Let', and
+     the argument of an 'App',
+    /may/ be of unlifted type, but only if
+    the expression is ok-for-speculation.
+
+This means that the let can be floated around
+without difficulty. For example, this is OK:
+
+   y::Int# = x +# 1#
+
+But this is not, as it may affect termination if the
+expression is floated out:
+
+   y::Int# = fac 4#
+
+In this situation you should use @case@ rather than a @let at . The function
+'CoreUtils.needsCaseBinding' can help you determine which to generate, or
+alternatively use 'MkCore.mkCoreLet' rather than this constructor directly,
+which will generate a @case@ if necessary
 
-This is intially enforced by DsUtils.mkCoreLet and mkCoreApp
+Th let/app invariant is intially enforced by DsUtils.mkCoreLet and mkCoreApp
 
 Note [CoreSyn case invariants]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs
index 3bf07fe..74fa623 100644
--- a/compiler/coreSyn/CoreUtils.lhs
+++ b/compiler/coreSyn/CoreUtils.lhs
@@ -983,10 +983,8 @@ app_ok primop_ok fun args
         -> True
 
         | otherwise
-        -> primop_ok op        -- A bit conservative: we don't really need
-        && all (expr_ok primop_ok) args
-                                  
-                                  -- to care about lazy arguments, but this is easy
+        -> primop_ok op                   -- A bit conservative: we don't really need
+        && all (expr_ok primop_ok) args   -- to care about lazy arguments, but this is easy
 
       _other -> isUnLiftedType (idType fun)          -- c.f. the Var case of exprIsHNF
              || idArity fun > n_val_args             -- Partial apps



More information about the ghc-commits mailing list