Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "nullIsNothing" #36

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add "nullIsNothing" #36

wants to merge 3 commits into from

Conversation

PaulJohnson
Copy link

Implements #35. "nullIsNothing" converts a Value prism into one that accepts "null" as "Nothing".

Converts a Value prism into one that accepts "null" as "Nothing".
@paolino
Copy link

paolino commented Aug 26, 2021

Hi, while you are at that I would suggest to add the other natural null handler

nullIsDefault :: q -> Prism' Value q -> Prism' Value q
nullIsDefault q p = prism'
  do review p 
  do \case 
      Null -> Just q
      x -> preview p x 

Thanks for picking this up

@PaulJohnson
Copy link
Author

OK, done.

@ekmett
Copy link
Member

ekmett commented Mar 8, 2022

This is covered by non Null using the base lens library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants