- Extract types into Docster.Types module (50 lines) - Move Mermaid processing to Docster.Mermaid module (93 lines) - Create Docster.Transform for document walking (21 lines) - Isolate LaTeX templates in Docster.LaTeX module (65 lines) - Extract compilation logic to Docster.Compiler module (90 lines) - Reduce Main.hs to minimal CLI entry point (23 lines from 233) - Add library stanza to cabal file with proper module organization - Follow Haskell conventions with Docster.ModuleName hierarchy 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
1.2 KiB
Haskell
51 lines
1.2 KiB
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
-- | Core types and error definitions for Docster
|
|
module Docster.Types
|
|
( -- * Error Types
|
|
DocsterError(..)
|
|
|
|
-- * Output Format
|
|
, OutputFormat(..)
|
|
|
|
-- * Domain Types
|
|
, SourceDir(..)
|
|
, OutputPath(..)
|
|
, DiagramId(..)
|
|
, DiagramConfig(..)
|
|
) where
|
|
|
|
import Data.Text (Text)
|
|
import Control.Exception (Exception)
|
|
|
|
-- | Custom error types for comprehensive error handling
|
|
data DocsterError
|
|
= InvalidUsage Text
|
|
| FileError Text
|
|
| PDFGenerationError Text
|
|
| ProcessError Text
|
|
deriving (Show)
|
|
|
|
instance Exception DocsterError
|
|
|
|
-- | Output format for document generation
|
|
data OutputFormat = PDF | HTML
|
|
deriving (Show, Eq)
|
|
|
|
-- | Type-safe wrapper for source directory paths
|
|
newtype SourceDir = SourceDir FilePath
|
|
deriving (Show, Eq)
|
|
|
|
-- | Type-safe wrapper for output file paths
|
|
newtype OutputPath = OutputPath FilePath
|
|
deriving (Show, Eq)
|
|
|
|
-- | Type-safe wrapper for diagram identifiers
|
|
newtype DiagramId = DiagramId Text
|
|
deriving (Show, Eq)
|
|
|
|
-- | Configuration for diagram generation
|
|
data DiagramConfig = DiagramConfig
|
|
{ dcSourceDir :: SourceDir
|
|
, dcOutputFormat :: OutputFormat
|
|
} deriving (Show) |