purescript-lists icon indicating copy to clipboard operation
purescript-lists copied to clipboard

ZipList is Bind

Open worldmaker18349276 opened this issue 1 year ago • 1 comments

https://github.com/purescript/purescript-lists/blob/b113451e5b41cad87d669a3165f955c71cd863e2/src/Data/List/ZipList.purs#L57-L66

ZipList is Bind, in which join is just diagonal. It's also Monad and ~~MonadPlus~~.

Example: https://try.purescript.org/?gist=4888527a78d71d12df75fa628acd4719

worldmaker18349276 avatar Aug 02 '24 15:08 worldmaker18349276

by the way,

fix-sized array is Bind: https://github.com/sigma-andex/purescript-fast-vect/blob/209c35d9b616370dc2bb7efaa4c1d2ac4fd394bf/src/Data/FastVect/FastVect.purs#L75

ZipArray (finite nonempty array using zip longest strategy) is Bind: https://gist.github.com/ajnsit/b2aebc5f70d1192122bde7bf5f18592a#file-ziparray-purs-L100

Map is Bind: https://github.com/purescript/purescript-ordered-collections/blob/b9c8ec72b53ee56d6cb6dc962d5ad7ea4708b438/src/Data/Map/Internal.purs#L164

worldmaker18349276 avatar Aug 05 '24 10:08 worldmaker18349276