question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `safeAfter` helper function to `Maybe` name space

See original GitHub issue

With all those crazy value | undefined or Something | Another | Something Else returning functions in the wild it may be handy to take care of lifting the result of functions into a Maybe based on a some predicate. While safeLift can be used to check an input before calling a function, the typical compose(safe(pred), someFunc) can be replaced with this safeAfter function. It has the following signature:

safeLift :: ((a -> Boolean) | Pred) -> (a -> b) -> a -> Maybe b

This will need the following to be accomplished:

  • Add code:
    • src/Maybe/safeAfter.js
  • Add specs
    • src/Maybe/safeAfter.spec.js
  • Documentation
    • Update ReadMe (src/Maybe/README.md)
    • Add to Docs with description and example usage (docs/src/pages/docs/crocks/Maybe.md)
    • Add link to Helpers Section (docs/src/pages/docs/functions/index.md)
  • Expose new functions to public API (src/index.js)
    • Entry for safeAfter
  • Add specs for new public functions (src/index.spec.js)
    • Entry for safeAfter

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
karthikiyengarcommented, Feb 26, 2018

@evilsoft - Also, I’m pretty sure it’s a typo, but I just wanted to confirm for good measure - the returned function should be returning Just(result), right? (instead of Just(x)).

0reactions
evilsoftcommented, Mar 6, 2018

This has been completed and merged, will go out in the next release 0.9.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Helper' functions in C++ - Stack Overflow
Overhead is not an issue, namespaces have some advantages though. You can reopen a namespace in another header, grouping things more ...
Read more >
iPhone Contacts Say "Maybe"? Here's Why & The Real Fix!
It says “Maybe” next to the name of the contact! In this article, I'll explain why your iPhone contacts say “Maybe” and show...
Read more >
Data Access - Spring
This is a proxy for a target DataSource , which wraps the target DataSource to add awareness of Spring-managed transactions.
Read more >
perldiag - man pages section 1: User Commands
Perl Programmers Reference Guide PERLDIAG(1) NAME perldiag - various Perl diagnostics ... or maybe the script needs to add the library name to...
Read more >
Developing Character through Literature - GovInfo
help our children to reflect, to decide, to become a principled person. Isn't that the under- lying purpose of all character education? Perhaps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found