idna2008-1.0.0.0: idna2008.cabal
cabal-version: 3.8
name: idna2008
version: 1.0.0.0
synopsis: Strict IDNA2008 for Haskell
description:
A Haskell library for parsing and validating internationalized domain
names, which may contain characters from non-Latin scripts (Greek,
Hebrew, Arabic, CJK, ...) alongside the conventional letters, digits,
and hyphens.
.
Given a domain name as the user typed it, the library checks
that every label is well-formed, encodes any non-ASCII labels
into their ACE-prefixed form for the wire, tells the
caller what kind of label each one is, and (optionally)
renders the parsed name back to display form.
.
A single domain name often mixes several kinds of labels.
The library reports each label as one of: a conventional
hostname-style letter-digit-hyphen label, a legacy reserved
label, an internationalized label encoded as Punycode, an
@\"xn--\"@-prefix that turns out not to decode cleanly, a
Unicode label, an underscore-prefixed service-discovery
label (e.g. @_25._tcp@, @_dmarc@), an arbitrary-bytes label,
or the DNS wildcard. Most existing IDNA libraries don't
make these distinctions; this library does.
.
Strict IDNA2008. Some browsers and language standard
libraries use a more permissive variant of the IDNA standard
that accepts characters strict IDNA2008 rejects; this
library does not use that variant.
.
Originally factored out of the @dnsbase@ library; conformance
test vectors are published as JSON for reuse by ports to
other languages.
author: Viktor Dukhovni
maintainer: ietf-dane@dukhovni.org
copyright: 2026 Viktor Dukhovni
license: BSD-3-Clause
license-file: LICENSE
category: Text
homepage: https://github.com/dnsbase/idna2008
bug-reports: https://github.com/dnsbase/idna2008/issues
build-type: Simple
tested-with: GHC == 9.6.7
, GHC == 9.8.4
, GHC == 9.10.3
, GHC == 9.12.4
, GHC == 9.14.1
-- The Unicode version the library's generated tables track. This is
-- the single source of truth: 'internal/tools/update' uses it as the
-- default version to fetch the UCD inputs from, and the
-- 'unicode-conformance' test suite uses it to fetch the matching
-- IdnaTestV2.txt and IdnaMappingTable.txt files. Bump this value
-- when re-running 'internal/tools/update' against a new Unicode
-- release. The @x-@ prefix marks this as a custom Cabal field that
-- the cabal tool ignores but other consumers can read.
x-unicode-version: 17.0.0
extra-doc-files:
CHANGELOG.md
README.md
-- Gzip-compressed snapshots of the UTS #46 reference data the
-- 'unicode-conformance' test suite consults. Bundled in the source
-- distribution so 'cabal test' has no network dependency. The
-- 'internal/tools/update' script regenerates these whenever the
-- 'x-unicode-version' field above is bumped. Gzip is used rather
-- than xz so that the test suite can rely on the Haskell @zlib@
-- package (which ships everywhere) rather than @lzma@ (which needs
-- the liblzma C library wired up through pkg-config).
extra-source-files:
internal/tools/genIdnaBidi.py
internal/tools/genIdnaCombining.py
internal/tools/genIdnaDerive.py
internal/tools/genIdnaEmoji.py
internal/tools/genIdnaJoining.py
internal/tools/genIdnaNFC.py
internal/tools/genIdnaNFCTables.py
internal/tools/genIdnaProperty.py
internal/tools/genIdnaScript.py
internal/tools/genIdnaSimpleLower.py
internal/tools/genIdnaWidth.py
internal/tools/update
tests/data/idna-test-v2-expected-diffs.txt
tests/data/IdnaMappingTable.txt.gz
tests/data/IdnaTestV2.txt.gz
tests/README.md
tests/vectors.json
source-repository head
type: git
location: https://github.com/dnsbase/idna2008.git
common all
ghc-options: -O2 -Wall
default-language: GHC2021
default-extensions:
BangPatterns
BlockArguments
MultiWayIf
PatternSynonyms
StrictData
common deps
build-depends:
base >=4.18 && <5
, bytestring >=0.11 && <0.13
, primitive >=0.9 && <0.10
, template-haskell >=2.20 && <2.25
, text >=2.0 && <2.2
-- Narrowly-scoped private sublibrary holding only
-- 'Text.IDNA2008.Internal.Punycode'. Its sole reason for
-- existing is to let the @punycode@ test suite (which exercises
-- the codec against RFC 3492 section 7.1 vectors as raw
-- round-trips) import the module directly without forcing the
-- entire @Text.IDNA2008.Internal.*@ surface into either the
-- public Hackage API or Haddock's view. We keep the sublibrary
-- as small as possible because @cabal haddock@ has known issues
-- generating documentation when private sublibraries carry a
-- large module set; the rest of the Internal.* modules continue
-- to live as @other-modules@ of the main library.
library punycode-internal
import: all, deps
visibility: private
hs-source-dirs: internal-punycode
exposed-modules:
Text.IDNA2008.Internal.Punycode
library
import: all, deps
hs-source-dirs: src internal
build-depends:
idna2008:punycode-internal
exposed-modules:
Text.IDNA2008
Text.IDNA2008.Wire
other-modules:
Text.IDNA2008.Internal.Bidi
Text.IDNA2008.Internal.Bidi.Data
Text.IDNA2008.Internal.Case
Text.IDNA2008.Internal.Case.Data
Text.IDNA2008.Internal.Combining
Text.IDNA2008.Internal.Combining.Data
Text.IDNA2008.Internal.Emoji
Text.IDNA2008.Internal.Emoji.Data
Text.IDNA2008.Internal.Error
Text.IDNA2008.Internal.Flags
Text.IDNA2008.Internal.Joining
Text.IDNA2008.Internal.Joining.Data
Text.IDNA2008.Internal.LabelForm
Text.IDNA2008.Internal.LabelFormSet
Text.IDNA2008.Internal.LabelInfo
Text.IDNA2008.Internal.NFC
Text.IDNA2008.Internal.NFC.Data
Text.IDNA2008.Internal.NFC.Tables
Text.IDNA2008.Internal.NFC.Tables.Data
Text.IDNA2008.Internal.Parse
Text.IDNA2008.Internal.Property
Text.IDNA2008.Internal.Property.Data
Text.IDNA2008.Internal.Ranges
Text.IDNA2008.Internal.Script
Text.IDNA2008.Internal.Script.Data
Text.IDNA2008.Internal.Tokens
Text.IDNA2008.Internal.UTS46
Text.IDNA2008.Internal.Width
Text.IDNA2008.Internal.Width.Data
-- RFC 3492 section 7.1 Punycode vectors, tested as raw codec
-- round-trips through the internal Punycode module rather than
-- through the full IDNA pipeline. The vectors live as Haskell
-- code (not in @tests/vectors.json@) because they exercise a
-- module whose API is not part of the public IDNA library
-- surface.
test-suite punycode
import: all, deps
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: punycode.hs
-- @idna2008@ is listed here even though the test only imports
-- from @idna2008:punycode-internal@. Without this fictional
-- dependency, building under @--enable-coverage@ races: Cabal
-- starts linking the punycode test before it has finished
-- building (and registering) the main library, which the
-- coverage-instrumented test links against by way of HPC's
-- cross-component tixing. Listing @idna2008@ explicitly forces
-- the build order, so a clean coverage build works on the first
-- attempt without needing a separate 'cabal build all' pass.
build-depends:
idna2008
, idna2008:punycode-internal
, tasty >=1.5 && <1.6
, tasty-hunit >=0.10 && <0.11
-- Unicode @IdnaTestV2.txt@ conformance suite. Reads
-- XZ-compressed snapshots of the UTS \#46 reference data bundled
-- under @tests/data/@ (see 'extra-source-files') so 'cabal test'
-- runs offline. Known systematic disagreements between strict
-- IDNA2008 and UTS #46 Nontransitional are listed in
-- @tests\/data\/idna-test-v2-expected-diffs.txt@; an additional
-- auto-skip uses @IdnaMappingTable.txt@ to identify codepoints
-- where UTS \#46's preprocessing legitimately differs from strict
-- IDNA2008. An @IDNA_TEST_V2_FILE@\/@IDNA_MAPPING_TABLE_FILE@
-- environment variable can point at an uncompressed local copy
-- to test against a different Unicode version without re-bundling.
test-suite unicode-conformance
import: all, deps
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: unicode_conformance.hs
build-depends:
idna2008
, idna2008:punycode-internal
, containers >=0.6 && <0.9
, directory >=1.0 && <1.4
, tasty >=1.5 && <1.6
, tasty-hunit >=0.10 && <0.11
, zlib >=0.6 && <0.8
test-suite conformance
import: all, deps
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: conformance.hs
build-depends:
idna2008
, idna2008:punycode-internal
, aeson >=2.2 && <2.4
, tasty >=1.5 && <1.6
, tasty-hunit >=0.10 && <0.11