<div dir="ltr">This mail got stuck in my spam filter because of auth reason.<div>Bumping in case someone else who missed it wants to answer.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-28 19:12 GMT+02:00 Williams, Wes(AWF) <span dir="ltr"><<a href="mailto:wewilliams@paypal.com" target="_blank">wewilliams@paypal.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>
<div>
<div>Hi haskellers, </div>
</div>
</div>
<div><br>
</div>
<div>I am trying to understand why I get the following error in learning applicative style.</div>
<div><br>
</div>
<div>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
Prelude> let estimates = [5,5,8,8,2,1,5,2]</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
Prelude> (/) <$> Just $ foldl (+) 0 estimates <*> Just . fromIntegral $ length estimates</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0);min-height:16px">
<br>
</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
<interactive>:54:1:</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
    Non type-variable argument in the constraint: Fractional (Maybe r)</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
    (Use FlexibleContexts to permit this)</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
    When checking that ‘it’ has the inferred type</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
      it :: forall a r.</p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
            (Fractional (Maybe r), Num a, Num (Int -> Maybe a -> r)) =></p>
<p style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">
            Maybe r -> Maybe r</p>
</div>
<div><br>
</div>
<div>All the parts work individually. If use let and assign the parts to x and y it also works.</div>
<div><br>
</div>
<div>E.g. This works</div>
<div>let x = Just $ foldl (+) estimates</div>
<div>Let y = Just . fromIntegral $ length estimates</div>
<div>(/) <$> x <*> y</div>
<div><br>
</div>
<div>I clearly do not understand exactly how these work. :-)</div>
<div><br>
</div>
<div>Thanks for any help,</div>
<div>-wes</div>
</div>

<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>