[Haskell-beginners] Where is the accumulator in the expression foldr (<=<) return (replicate x oveKnight)? -- from LYAH example

Ut Primum utprimum at gmail.com
Thu Jul 26 06:11:28 UTC 2018


Hi,
Looking at the structure of the expression, you should have

foldr operator accumulator list

So in your example the accumulator should be "return" (because it is the
second argument)

Il gio 26 lug 2018, 03:45 Olumide <50295 at web.de> ha scritto:

> Dear List,
>
> Chapter 13 of LYAH
> (
> http://learnyouahaskell.com/for-a-few-monads-more#useful-monadic-functions)
>
> has the following code block
>
> import Data.List
>
> inMany :: Int -> KnightPos -> [KnightPos]
> inMany x start = return start >>= foldr (<=<) return (replicate x
> oveKnight)
>
> What I'd like to know is where the accumulator of foldr is in this example.
>
> Regards,
>
> - Olumide
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180726/f8ed5708/attachment.html>


More information about the Beginners mailing list