summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-08-01 16:38:33 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2014-08-07 09:55:12 +0100
commit61baf71021976a105080b060f72df1f1f611389e (patch)
tree29f8e928d779573fb765767dbdf1ad35ef51f497
parent24a2e49e8a96a6ef5ef19386676b9f3b7d323afd (diff)
downloadhaskell-61baf71021976a105080b060f72df1f1f611389e.tar.gz
Comments and white space
-rw-r--r--compiler/coreSyn/CoreSyn.lhs44
-rw-r--r--compiler/coreSyn/CoreUtils.lhs10
-rw-r--r--compiler/iface/BuildTyCl.lhs2
3 files changed, 28 insertions, 28 deletions
diff --git a/compiler/coreSyn/CoreSyn.lhs b/compiler/coreSyn/CoreSyn.lhs
index b36cb6d8a6..86786783ca 100644
--- a/compiler/coreSyn/CoreSyn.lhs
+++ b/compiler/coreSyn/CoreSyn.lhs
@@ -180,25 +180,8 @@ 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@. 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@. 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 3bf07febf3..74fa6239c3 100644
--- a/compiler/coreSyn/CoreUtils.lhs
+++ b/compiler/coreSyn/CoreUtils.lhs
@@ -964,7 +964,7 @@ app_ok :: (PrimOp -> Bool) -> Id -> [Expr b] -> Bool
app_ok primop_ok fun args
= case idDetails fun of
DFunId _ new_type -> not new_type
- -- DFuns terminate, unless the dict is implemented
+ -- DFuns terminate, unless the dict is implemented
-- with a newtype in which case they may not
DataConWorkId {} -> True
@@ -983,14 +983,12 @@ 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
- || (n_val_args == 0 &&
+ || (n_val_args == 0 &&
isEvaldUnfolding (idUnfolding fun)) -- Let-bound values
where
n_val_args = valArgCount args
diff --git a/compiler/iface/BuildTyCl.lhs b/compiler/iface/BuildTyCl.lhs
index f2d6f7e39a..46091adf80 100644
--- a/compiler/iface/BuildTyCl.lhs
+++ b/compiler/iface/BuildTyCl.lhs
@@ -330,7 +330,7 @@ We cannot represent this by a newtype, even though it's not
existential, because there are two value fields (the equality
predicate and op. See Trac #2238
-Moreover,
+Moreover,
class (a ~ F b) => C a b where {}
Here we can't use a newtype either, even though there is only
one field, because equality predicates are unboxed, and classes