Library for IP and MAC addresses.
The ip
package provides types and functions for dealing with IPv4 addresses, CIDR blocks, and MAC addresses. We provide instances for typeclasses found in commonly used packages like aeson
, vector
, and hashable
. We also provide Parser
s for working with attoparsec. . Notably, this package does not overload functions by introducing any typeclasses of its own. Neither does it prefix functions with the name of the type that they work on. Instead, functions of the same name are exported by several different modules, and it is expected that end users disambiguate by importing these modules qualified. . The only module intended to be imported unqualified is Net.Types
. The types in this package should not conflict with the types in any other commonly used packages. . The following packages are intended to be used with this package: . * `yesod-ip`: Provides orphan instances needed to work with yesod and persistent. Also, provides a `yesod-form` helper.
Instructions
Look at the haddocks for this package to learn how to use it.
Contributing
Most contributions are welcome, especially performance improvements in encoding and decoding of Text/ByteString. Please make sure to follow naming conventions followed in the modules.
Doctest
Doctest used to be provided as a test suite, but doctest-0.20
and higher do not require this to be run. To run the doctests, make sure you have doctest
on your path (i.e. run cabal install doctest
), and then run:
cabal build
cabal repl --build-depends=QuickCheck --with-ghc=doctest --repl-options='-fno-warn-orphans'
This runs incredibly slowly, but it works for now. Doctest is not run by CI, so if you make a change that adds more doctests, it needs to be run by hand by someone. (The maintainer is happy to do this if you're on a platform where doctest is finicky.)