List Monad in JavaScript

Thoughts I’m writing this more as a way to document and organize my thoughts around the list monad. This is a very important monad. A map of functional concepts I’m currently studying can be found at Functional Programming Concepts. The Code export const List = list => ({ list, map: fn => List(list.map(fn)), fold: (fn, initialValue) => List(list.reduce(fn, initialValue)), foldMap(monoid, empty) { const mappedList = list.reduce(fn, initialValue); const result = mappedList....

October 7, 2023 · Mekael Turner