[Haskell-beginners] applicative style

Williams, Wes(AWF) wewilliams at paypal.com
Fri Aug 28 18:51:46 UTC 2015


The actual code I have working is:


let estimates = [5,5,8,8,2,1,5,2]

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


What I want to do is get rid of all the parentheses except (/)

Is it possible?

Thanks,
wes

From: Beginners <beginners-bounces at haskell.org<mailto:beginners-bounces at haskell.org>> on behalf of "Williams, Wes(AWF)" <wewilliams at paypal.com<mailto:wewilliams at paypal.com>>
Reply-To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners at haskell.org<mailto:beginners at haskell.org>>
Date: Friday, August 28, 2015 at 11:31 AM
To: "beginners at haskell.org<mailto:beginners at haskell.org>" <beginners at haskell.org<mailto:beginners at haskell.org>>
Subject: [Haskell-beginners] applicative style

Awesome, I clearly am off on my understanding.

How could I do this: "foldl (+) 0 estimates <+> (Just . fromIntegral) (length estimates)" without the parenthesis?

Thanks,
Wes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150828/248382c2/attachment.html>


More information about the Beginners mailing list