Package: maybe 1.1.0

maybe: The Maybe Monad

The maybe type represents the possibility of some value or nothing. It is often used instead of throwing an error or returning `NULL`. The advantage of using a maybe type over `NULL` is that it is both composable and requires the developer to explicitly acknowledge the potential absence of a value, helping to avoid the existence of unexpected behaviour.

Authors:Andrew McNeil [aut, cre]

maybe_1.1.0.tar.gz
maybe_1.1.0.zip(r-4.5)maybe_1.1.0.zip(r-4.4)maybe_1.1.0.zip(r-4.3)
maybe_1.1.0.tgz(r-4.4-any)maybe_1.1.0.tgz(r-4.3-any)
maybe_1.1.0.tar.gz(r-4.5-noble)maybe_1.1.0.tar.gz(r-4.4-noble)
maybe_1.1.0.tgz(r-4.4-emscripten)maybe_1.1.0.tgz(r-4.3-emscripten)
maybe.pdf |maybe.html
maybe/json (API)
NEWS

# Install 'maybe' in R:
install.packages('maybe', repos = c('https://armcn.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/armcn/maybe/issues

On CRAN:

functional-programming

34 exports 49 stars 3.36 score 1 dependencies 4 dependents 10 scripts 1.0k downloads

Last updated 1 years agofrom:1e921f6712. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 01 2024
R-4.5-winOKSep 01 2024
R-4.5-linuxOKSep 01 2024
R-4.4-winOKSep 01 2024
R-4.4-macOKSep 01 2024
R-4.3-winOKSep 01 2024
R-4.3-macOKSep 01 2024

Exports:%>%andand_thenand_then2and_then3bindfilter_justsfilter_mapfmapfrom_justfrom_maybeis_justis_maybeis_nothingjoinjustmaybemaybe_casemaybe_containsmaybe_equalmaybe_flattenmaybe_mapmaybe_map2maybe_map3not_emptynot_infinitenot_nanot_nannot_nullnot_undefinednothingorperhapswith_default

Dependencies:magrittr

Readme and manuals

Help Manual

Help pageTopics
Combine predicate functions to check if all are TRUEand
Evaluate a maybe returning function on a maybe valueand_then bind
Evaluate a binary maybe returning function on two maybe valuesand_then2
Evaluate a ternary maybe returning function on three maybe valuesand_then3
Filter and unwrap a list of 'Just' valuesfilter_justs
Map a function over a list and filter only 'Just' valuesfilter_map
Unwrap a 'Just' value or throw an errorfrom_just
Check if an object is a 'Just' valueis_just
Check if an object is a maybe valueis_maybe
Check if an object is a 'Nothing' valueis_nothing
Create a 'Just' variant of a maybe valuejust
Modify a function to return a maybe valuemaybe
Unwrap and call a function on a maybe value or return a defaultmaybe_case
Check if a maybe value contains a specific valuemaybe_contains
Check if two maybe values are equalmaybe_equal
Flatten a nested maybe valuejoin maybe_flatten
Evaluate a function on a maybe valuefmap maybe_map
Evaluate a binary function on two maybe valuesmaybe_map2
Evaluate a ternary function on three maybe valuesmaybe_map3
Check if a vector or data frame is emptynot_empty
Check if an object is not infinitenot_infinite
Check if an object is not NAnot_na
Check if an object is not NaNnot_nan
Check if an object is not NULLnot_null
Check if an object is not undefinednot_undefined
Create a 'Nothing' variant of a maybe valuenothing
Combine predicate functions to check if any are TRUEor
Modify a function to return the value or a default valueperhaps
Unwrap a maybe value or return a defaultfrom_maybe with_default