
NumHs
Haskell library for a stand-in Numpy.
Overview
NumHs started as a curiosity project. The goal was simple: recreate a small slice of the NumPy experience, but in Haskell. It became an exercise in translating a very imperative, mutable-feeling workflow into something purely functional without losing usability.
Problem
Working with arrays in Haskell often feels fragmented or overly abstract for quick numerical tasks. There is a gap between low-level control and ergonomic, NumPy-like operations. This project explores whether a minimal, familiar interface can exist in that space without fighting the language.
Solution
NumHs introduces a lightweight Array type with support for 1D and 2D data, along with basic operations like element-wise arithmetic, reshape, and transpose. The design leans toward clarity over completeness. Broadcasting and matrix operations were planned with a focus on keeping behaviour predictable rather than exhaustive.
A recurring theme during development was resisting overengineering. Early versions tried to be too generic, which made even simple operations hard to reason about. The current approach intentionally limits scope to keep the API understandable and usable.
Developer Notes
The project lives mostly in a single module, which made iteration fast but occasionally messy. Testing was done incrementally, often by recreating small NumPy examples and checking behaviour manually before formalising tests.
One challenge was balancing type safety with ergonomics. Another was performance. Early implementations were correct but noticeably inefficient, which led to revisiting core representations more than once.
The roadmap reflects ideas that came up mid-development but were deferred to avoid scope creep. The repository contains the full technical details, while this entry captures the intent and trade-offs behind the project.