Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Haskell does not force you to handle the value not existing. For example, you can do:

let Just b = HashMap.lookup k xs

If the element is not there, then lookup will return Nothing, which will fail to pattern match with 'Just b'. This can also be accomplished using the fromJust function. What Haskell does do is make it obvious where these exceptions can occur by documenting what functions can return Nothing, and by requiring you to explicitly cast between values that may be Nothing and values that cannot be Nothing.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: