The getNameInfo API is a little strange
- Dominant language
- Haskell
- Stars
- 366
- Forks
- 210
- Avg merge
- 22h 38m
- Merged PRs (30d)
- 5
Description
`getNameInfo` has the ability to report a name resolution error by means of returning `Nothing`. When the `NI_NAMEREQD` flag is not set, resolution will never fail because the function simply returns the IP address we were trying to look up. When `NI_NAMEREQD` is set, however, the function is supposed to fail when that address can't be resolved. Curiously enough, that failure is communicated through an `IOException` instead of simply returning `Nothing`! This is really surprising to me and I find myself writing code like
getNameInfo [NI_NAMEREQD] True False localAddr `catchIO` \_ -> return (Nothing,Nothing)
most of the time.
Is there any particular reason why an `IOException` is used to communicate a perfectly legitimate result of that function call?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.