[Haskell-cafe] Usage of . and $

Jeff Polakow jeff.polakow at db.com
Tue Mar 6 15:35:40 EST 2007


Jefferson Heard <jeff at renci.org> wrote on 03/06/2007 03:18:40 PM:

> Nope, I'm asking why 
> 
> um . IntMap.elems . IntMap.IntersectionWith (\x y -> x*y) queryVector 
> rationalProjection
> 
> won't work.
> 
We have (simplifying away some typeclass details):
 
    sum . elems :: IntMap a -> a

and:

    intersectionWith (*) :: IntMap a -> IntMap a -> IntMap a

but:

    ((sum . elems) .) :: (IntMap a -> IntMap a) -> IntMap a -> a

so you need something like: 

    sum . elems . uncurry (intersectionWith (*)) $ (queryVector, 
rationalProjection)

-Jeff


---

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070306/8adf6592/attachment.htm


More information about the Haskell-Cafe mailing list