Try thinking about it this way. "List a" is a container for some type "a".
The map function takes a function on type "a" and turns it into a function
on type "List a". Likewise, List.map2, List.map3, etc. do the same thing
for functions with multiple arguments.

The same is true for Result. "Result err a" is a container for some type
"a". The difference is, while a List can contain any number of elements, a
Result contains either 1 or 0.

Also, an important difference between mapping and folding is the type
signature of the function. mapX functions take multiple arguments, all of
which can have different types.

On Mon, Jul 25, 2016 at 11:47 AM, Brad Grzesiak <[email protected]> wrote:

> OK. For those of you following along, I hope the third time's a charm! (I
> already inadvisedly submitted this to the Issue tracker and elm-dev)
>
>
> It seems to me that Result.map2, Result.map3, etc should actually be
> called Result.foldl2, Result.foldl3, etc.
>
>
> As I understand it, map should be fully parallelizable, applying a func
> to items in a list without regard to the other items in the list. On the
> other hand, foldl reduces the dimensionality of the input values, often
> from 2 to 1.
>
>
> Going further, perhaps there should be a Result.foldl with the type
> signature: foldl : (a -> value -> value) -> value -> List (Result x a) ->
> Result x value
>
>
> *NB:* Forgive my inexperience in the FP world... this issue is coming
> from my experience as an OO programmer. For example, I nearly submitted
> this issue with reduce rather than foldl. :P
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to