Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

zyla/haskell-nullpointer

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data.NullPointer build status

Tired of using Maybe? Wrapping values in Just makes you sick? Missing your NullPointerExceptions? Add null value to any data type using Data.NullPointer!

Example

import Prelude hiding (null)
import System.Environment (getArgs)
import Data.NullPointer

getFirstArg :: [String] -> String
getFirstArg (x:_) = x
getFirstArg [] = null

main = do
  arg <- getFirstArg <$> getArgs

  if isNull arg
    then putStrLn "No argument passed"
    else putStrLn arg

What if I forget to check if a value is null?

You'll get a NullPointerException, just like in Java! Brillant!

About

NullPointerExceptions in Haskell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.