hasktorch-typed

Provide type-safe tensor operations in Haskell with compile-time shape verification.

6|1|Updated Nov 29, 2025
One-click install
npx skills add https://github.com/manutej/categorical-meta-prompting --skill hasktorch-typed
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hasktorch-typed
Source: https://github.com/manutej/categorical-meta-prompting/tree/main/.claude/skills/hasktorch-typed
Command: npx skills add https://github.com/manutej/categorical-meta-prompting --skill hasktorch-typed

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Traditional tensor operations in Haskell lack compile-time shape guarantees, making dimensional errors run-time hazards during model development.

Core Features & Use Cases

  • Type-safe tensors: shapes encoded in types to prevent mismatches.
  • Categorically structured networks: compose layers with preserved abstractions for safer designs.
  • Formal verification benefits: enables dependent types and rigorous ML pipelines in Haskell.

Quick Start

Install hasktorch and Torch.Typed, import the typed tensor APIs, and begin building models with type-checked shapes.

Frequently Asked Questions about hasktorch-typed

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce type-safe tensor operations in Haskell to prevent shape mismatches?

Type-safe tensors in Haskell encode tensor shapes directly within types, enabling compile-time shape verification to prevent dimensional mismatches. This requires Torch.Typed and GHC extensions for dependent types, ensuring shape errors are caught during compilation rather than at run time.

What are dependent types and how do they apply to neural networks in Haskell?

Dependent types allow types to depend on values, letting you encode tensor dimensions and categorical structure within Haskell's type system. Applied to neural networks, this creates formally verified ML pipelines where layer composition and shape preservation are mathematically guaranteed at compile time.

How do I build a typed neural network in Haskell using category theory?

Building categorically structured networks in Haskell involves composing layers with preserved abstractions for safer designs. By applying category theory principles to typed tensors, you create type-safe neural networks where categorical structure and shape invariants are maintained throughout the pipeline.

Do I need specific Haskell extensions for compile-time shape verification of tensors?

Yes, compile-time shape verification requires GHC extensions that enable dependent types in Haskell. Along with hasktorch and Torch.Typed, these extensions provide the type-level programming capabilities needed to encode tensor shapes and verify them during compilation.

What's the best way to prevent run-time tensor shape errors in Haskell ML pipelines?

The best way to prevent run-time tensor shape errors is using type-safe tensors with compile-time shape verification. By encoding tensor shapes in types via Torch.Typed, dimensional mismatches become compile-time hazards, ensuring formally verified ML pipelines before execution.

When should I not use dependent types for tensor operations in Haskell?

You should avoid dependent types for tensor operations when your Haskell ML pipelines require rapid prototyping with dynamic shapes, as compile-time shape verification adds type-level complexity. Traditional tensor operations may suit exploratory model development better than formally verified pipelines.