packages feed

tadka-2.0.0.0: src/Tadka.hs

-- | Public API surface for @tadka@.
--
-- This module is the sole supported entry point. It re-exports the public
-- vocabulary defined across @Tadka.Internal.*@. Anything reachable only via
-- @Tadka.Internal.*@ carries no compatibility guarantee.
--
-- Phases 1–2 populate the validated primitive types, resolution-indexed spans,
-- and 'Context' construction. The @Diagnostic@ class, renderers, and the derive
-- macro, and interop adapters complete the surface. The public API matches
--  @Offset@\/@Length@ and other representation details live under
-- "Tadka.Internal" with no compatibility guarantee.
module Tadka
  ( -- * Named source
    NamedSource
  , sourceName
  , sourceText
  , mkNamedSource
  , SourceError (..)
    -- * Spans
    --
    -- Spans are the public position type; @Offset@\/@Length@ are the internal
    -- offset representation and live in "Tadka.Internal.Types" (no compatibility
    -- guarantee)
  , Span
  , ResolvedSpan
  , mkSpan
  , SpanBuildError (..)
  , resolvedStart
  , resolvedEnd
  , LineCol (..)
  , resolveSpan
  , SpanError (..)
  , spanErrorReason
  , StaleReason (..)
    -- * Annotations
  , Ann (..)
    -- * The Diagnostic class
  , Diagnostic (..)
  , SomeDiagnostic (..)
    -- * Context
  , Context (NoContext)
  , Labeled (..)
  , LabelKind (..)
  , LabelState (..)
  , contextLabelStates
  , mkContext
  , mkContextDegrading
  , ContextError (..)
    -- ** Multi-source context (Phase 12)
    --
    -- A 'Context' can hold labels resolved against more than one 'NamedSource'.
    -- Single-source construction above is unchanged; these are the entry
    -- points for a diagnostic whose labels span several files. The derive
    -- macro and 'genericContext' remain single-source only in v1 — these are
    -- hand-written-instance functions.
  , mkContextMulti
  , mkContextMultiDegrading
    -- * Rendering configuration
  , Config
  , defaultConfig
  , withColorMode
  , withUnicodeMode
  , withHyperlinkMode
  , withRelatedDepthLimit
  , withTabWidth
  , withContextLines
  , withLabelPalette
  , withTarget
  , ColorMode (..)
  , UnicodeMode (..)
  , HyperlinkMode (..)
    -- * Renderers and the render path
  , Target (..)
  , Output
  , Renderer (..)
  , SomeRenderer (..)
  , GraphicalOptions
  , NarratableOptions
  , JsonOptions
  , selectRenderer
  , render
  , reportDiagnostic
    -- * Derive macro
  , DiagnosticSpec (..)
  , defaultSpec
  , deriveDiagnostic
  , DiagnosticSumSpec
  , deriveDiagnosticSum
    -- * Generics label-wiring (context only)
  , genericContext
    -- * Diagnostic codes
  , DiagnosticCode
  , unDiagnosticCode
  , mkDiagnosticCode
  , CodeError (..)
    -- * URLs
  , Url
  , unUrl
  , mkUrl
  , UrlError (..)
    -- * Severity
  , Severity (..)
    -- * Diagnostic identity
  , DiagnosticId
  , unDiagnosticId
  , mkDiagnosticId
  ) where

import Tadka.Internal.Ann
import Tadka.Internal.Config
import Tadka.Internal.Context
import Tadka.Internal.Diagnostic
import Tadka.Internal.Generics (genericContext)
import Tadka.Internal.Render
import Tadka.Internal.Renderer.Graphical (GraphicalOptions)
import Tadka.Internal.Renderer.Json (JsonOptions)
import Tadka.Internal.Renderer.Narratable (NarratableOptions)
import Tadka.Internal.Span
import Tadka.Internal.TH
import Tadka.Internal.Types