TonyGen/mongoDB-haskell — pull request #21 by A1kmm (2012-03-29 10:06:42+00:00)
Title: Improve the parsing of HostPorts received from MongoDB to work properly with with IPv6 addresses

Improve the parsing of HostPorts received from MongoDB to work properly with with IPv6 addresses.

MongoDB's syntax is ambiguous and complex to deal with respect to IPv6 addresses, because the :
character is used to delimit both the parts of the IPv6 address, so the parser needs to be quite
complex.

This code will parse ambiguous examples like ::1:1234 as host ::1, port 1234, matching the approach
taken in MongoDB server codebase. If only one interpretation is possible, it will take that
interpretation. For example ::1:a is parsed as having no port specifier (since a is not a valid
decimal digit).

Also add a test program that tests the code with a number of cases.