[PATCH 2/3] Inline nand, nor, nany and nall

Dan Doel dan.doel at gmail.com
Thu Feb 27 17:38:16 UTC 2014


With regard to this patch (disregarding all the other things that people
have weighed in on).... Does it actually do anything? These are all very
short functions; I'd rather expect that GHC (and other compilers) would
decide to inline them itself.


Hope you're not getting too discouraged. :)

-- Dan


On Thu, Feb 27, 2014 at 10:13 AM, Alexander Berntsen
<alexander at plaimi.net>wrote:

> ---
>  GHC/List.lhs | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/GHC/List.lhs b/GHC/List.lhs
> index a8b8950..7fb751a 100644
> --- a/GHC/List.lhs
> +++ b/GHC/List.lhs
> @@ -530,6 +530,7 @@ or (x:xs)       =  x || or xs
>  --
>  -- /Since: 4.7.0.0/
>  nand :: [Bool] -> Bool
> +{-# INLINE nand #-}
>  nand = not . and
>
>  -- | 'nor' returns the negated disjunction of a Boolean list.  For the
> result
> @@ -538,6 +539,7 @@ nand = not . and
>  --
>  -- /Since: 4.7.0.0/
>  nor :: [Bool] -> Bool
> +{-# INLINE nor #-}
>  nor = not . or
>
>  -- | Applied to a predicate and a list, 'any' determines if any element
> @@ -577,6 +579,7 @@ all p (x:xs)    =  p x && all p xs
>  -- 'True', the list must be finite; 'False', however, results from a
> 'True'
>  -- value for the predicate applied to an element at a finite index of a
> finite or infinite list.
>  nany :: (a -> Bool) -> [a] -> Bool
> +{-# INLINE nany #-}
>  nany p = not . any p
>
>  -- | Applied to a predicate and a list, 'nall' determines if not all
> elements
> @@ -584,6 +587,7 @@ nany p = not . any p
>  -- 'False', the list must be finite; 'True', however, results from a
> 'False'
>  -- value for the predicate applied to an element at a finite index of a
> finite or infinite list.
>  nall :: (a -> Bool) -> [a] -> Bool
> +{-# INLINE nall #-}
>  nall p = not . all p
>
>  -- | 'elem' is the list membership predicate, usually written in infix
> form,
> --
> 1.8.3.2
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140227/4548bed1/attachment.html>


More information about the Libraries mailing list