Repository navigation
FP Mojo 1.0.0
The first release of FP Mojo: functional programming for Mojo 1.1.
- Pipelines and composition:
pipe,piped,flow,compose,flipandpartial, with every intermediate type inferred and errors kept with their own types. - Lazy iteration and folds over native iterators and owned collections:
map,filter,filter_map,flat_map,scan_left,fold_left,fold_until,reduce,find,any,all. - Results:
Resultwithmap,flat_map,map_err,or_elseand folds, plusattempt,raise_on_errandcollect_resultsbetween raised and stored errors. - Algebraic data types and pattern matching: declare a type from ordinary structs and match it with
fp.match, checked for exhaustiveness when the program compiles. Recursive values are evaluated in a loop, with no recursion depth limit.Choicestores a non-recursive value in place, andResult,ControlFlowandOptionalare matched the same way. - Loops as expressions:
while_loop,fori_loopand carry/outputscan. - Functor, Applicative, Monad, Traversable and Monoid, with Identity, Optional, Result and List instances, and Reader, State, Writer, OptionalT and ResultT transformers.
Works with Mojo 1.1.x on Linux x86-64 and macOS arm64.
Install from the Modular community channel (available once modular/modular-community#387 is merged):
# pixi.toml
[workspace]
channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"]pixi add fp_mojoDocumentation: https://spellbound-mojo.github.io/fp_mojo/