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.

Hi and thanks for this library!

It would be nice to have a lift function in the library that ensures a value T is a Maybe<T>, without creating a Maybe<Maybe<T>>:

lift<T>(a: T | Maybe<T>): Maybe<T> {
    return Maybe.isInstance( value )
        ? value
        : Maybe.of( value )
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chriskrychocommented, Jan 12, 2019

I’ve chewed on this for a while, and given both @bmakuh’s astute comment and my own reflections on it, I’m going to close it and not implement. That said: I appreciate the thoughtful suggestion, and I hope the library continues to be useful for you!

1reaction
chriskrychocommented, Dec 15, 2018

Following up on this, I realized for the points you both just raised that we definitely wouldn’t want to change the behavior of of. I’m also inclined to say that because this is kind of an edge case, it doesn’t make sense to push handling for it into the library, especially since it’s straightforward to work around or to use andThen/flatMap to resolve the nesting. Mostly because we’re trying to walk a fine line of being idiomatic to use in TypeScript, with the assumption that we have the type checker around to help, and therefore with the most minimal set of runtime checks possible (shoving as much as possible into the type system).

Read more comments on GitHub >

github_iconTop Results From Across the Web

IdeaLift | Mindfulness and Organizational Consulting
All of IdeaLift's programs are customized and designed to meet your organization's needs, whichever focus area is involved. We will help you get...
Read more >
LIFT - IntelliJ IDEs Plugin - JetBrains Marketplace
This plugin allows novice programmers to run a Java program with command-line arguments by typing the arguments in a simple popup window.
Read more >
53 Lift hoist ideas | homemade tools, lifts & ... - Pinterest
Jan 21, 2018 - Explore Helen Thomas's board "Lift hoist ideas" on Pinterest. See more ideas about homemade tools, lifts & hoists, metal...
Read more >
What the science says about lifting mask mandates - Nature
Although there's been no formal study on the effectiveness of mask marketing, the idea might not be far-fetched. Instructions for creating fun ...
Read more >
Hello World in Java (Windows) - LIFT-CS
The installer installs and configures a Java programming environment, including OpenJDK 11 and IntelliJ IDEA Community Edition 2022.2.
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