+\subsection[considerUnfolding]{Given all the info, do (not) do the unfolding}
+%* *
+%************************************************************************
+
+We have very limited information about an unfolding expression: (1)~so
+many type arguments and so many value arguments expected---for our
+purposes here, we assume we've got those. (2)~A ``size'' or ``cost,''
+a single integer. (3)~An ``argument info'' vector. For this, what we
+have at the moment is a Boolean per argument position that says, ``I
+will look with great favour on an explicit constructor in this
+position.''
+
+Assuming we have enough type- and value arguments (if not, we give up
+immediately), then we see if the ``discounted size'' is below some
+(semi-arbitrary) threshold. It works like this: for every argument
+position where we're looking for a constructor AND WE HAVE ONE in our
+hands, we get a (again, semi-arbitrary) discount [proportion to the
+number of constructors in the type being scrutinized].
+
+\begin{code}
+smallEnoughToInline :: Int -> Int -- Constructor discount and size threshold
+ -> [Bool] -- Evaluated-ness of value arguments
+ -> UnfoldingGuidance
+ -> Bool -- True => unfold it
+
+smallEnoughToInline con_discount size_threshold _ UnfoldAlways = True
+smallEnoughToInline con_discount size_threshold _ UnfoldNever = False
+smallEnoughToInline con_discount size_threshold arg_is_evald_s
+ (UnfoldIfGoodArgs m_tys_wanted n_vals_wanted discount_vec size)
+ = n_vals_wanted <= length arg_is_evald_s &&
+ discounted_size <= size_threshold
+
+ where
+ discounted_size = size - sum (zipWith arg_discount discount_vec arg_is_evald_s)
+
+ arg_discount no_of_constrs is_evald
+ | is_evald = 1 + no_of_constrs * con_discount
+ | otherwise = 1
+\end{code}
+
+We use this one to avoid exporting inlinings that we ``couldn't possibly
+use'' on the other side. Can be overridden w/ flaggery.
+Just the same as smallEnoughToInline, except that it has no actual arguments.
+
+\begin{code}
+couldBeSmallEnoughToInline :: Int -> Int -- Constructor discount and size threshold
+ -> UnfoldingGuidance
+ -> Bool -- True => unfold it
+
+couldBeSmallEnoughToInline con_discount size_threshold guidance
+ = smallEnoughToInline con_discount size_threshold (repeat True) guidance
+\end{code}
+
+%************************************************************************
+%* *