Closed slimey closed 7 years ago
I guess your assumption is wrong. There are different ways of defining applicative instances on lists. In particular, for what is called the "ziplist applicative", pure x
is not [x]
, but is instead the infinite list [x,x,x,x,x,x,...]
.
Ah yes, makes sense - thanks. I also see that this is a better fit for List.map2 etc.
In most of the -extra packages where
andMap
appears (eg elm-community/elm-json-extra, elm-community/maybe-extra, elm-community/result-extra), it's documented to be applicative apply. In which case one would expectmap f x
and(pure f) |> andMap x
to be the same (the "fmap law").This isn't currently the case with list-extra (assuming
pure x
is[x]
as usual):This seems counter-intuitive - is it intentional?