[Haskell-beginners] applicative style

Brandon Allbery allbery.b at gmail.com
Fri Aug 28 17:23:10 UTC 2015


On Fri, Aug 28, 2015 at 1:12 PM, Williams, Wes(AWF) <wewilliams at paypal.com>
wrote:

> Num (Int -> Maybe a -> r))


That looks highly suspect. If it infers a function Num instance, you
probably got your parentheses wrong. Or your $-s...

...in fact, that is the problem. That final $ does not do what you think;
it produces

    (foldl (+) 0 estimates <*> Just . fromIntegral) (length estimates)

when you presumably intended

    foldl (+) 0 estimates <+> (Just . fromIntegral) (length estimates)

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150828/ec409756/attachment.html>


More information about the Beginners mailing list