csw-core 0.1.0

Core categorical structures for the Categorical Semantics Workbench - define categories and derive type systems
Documentation
//! Error types for categorical specification validation.

use thiserror::Error;

/// Errors that can occur when building or validating a categorical specification.
#[derive(Debug, Error, Clone, PartialEq, Eq)]
pub enum ValidationError {
    /// Exponentials require products to be present.
    #[error("exponentials require products: cannot have function types without pair types")]
    ExponentialsRequireProducts,

    /// Linear hom requires tensor to be present.
    #[error("linear hom (⊸) requires tensor (⊗): cannot have linear functions without tensor product")]
    LinearHomRequiresTensor,

    /// Cartesian structure requires terminal object.
    #[error("cartesian structure requires terminal object")]
    CartesianRequiresTerminal,

    /// Cartesian structure requires products.
    #[error("cartesian structure requires products")]
    CartesianRequiresProducts,

    /// Invalid combination of structural rules.
    #[error("invalid structural rule combination: {0}")]
    InvalidStructuralRules(String),

    /// Empty category name.
    #[error("category name cannot be empty")]
    EmptyName,

    /// Duplicate base type.
    #[error("duplicate base type: {0}")]
    DuplicateBaseType(String),
}