>
> all (== test_lcv) [init_lcv, update_lcv, update_lcv']"
>
> Wouldn't this be be better as tuple avoiding list overhead or does ghc
> optimize it out?
>
If I'm not mistaken, ghc will optimize it out. From
http://hackage.haskell.org/packages/archive/base/4.5.1.0/doc/html/src/GHC-List.html#all
{-# RULES
...
"all/build" forall p (g::forall b.(a->b->b)->b->b) .
all p (build g) = g ((&&) . p) True
#-}
See the docs on List fusion for details (note how "all" is listed as a
"good consumer"):
http://www.haskell.org/ghc/docs/7.4.2/html/users_guide/rewrite-rules.html#id690070
So in fact it may be the case that the tuple version (if it were valid
Haskell) is less efficient because it can't take advantage of list fusion
and has to allocate the tuple instead.
-- Dan Burton
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell