c-expr-runtime: Haskell DSL for simple C arithmetic expressions

[ bsd3, library, system ] [ Propose Tags ] [ Report a vulnerability ]

This library provides a Haskell DSL for simple C arithmetic expressions, implementing the arithmetic conversion and integral promotion rules of the C standard.

For example, addition is defined with the following type class:

infixl 2 +
type Add :: Type -> Type -> Constraint
class Add a b where
  type family AddRes a b :: Type
  (+) :: a -> b -> AddRes a b

That is, we can add arguments of different types, e.g. an integer and a floating-point number, in which case the integer will first get converted to the floating-point format before performing the addition.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.16 && <4.23), containers (>=0.5 && <0.9), data-array-byte (>=0.1.0.1 && <0.2), fin (>=0.3.2 && <0.4), some (>=1.0.6 && <1.1), template-haskell (>=2.18 && <2.25), vec (>=0.5 && <0.6) [details]
Tested with ghc ==9.2.8 || ==9.4.8 || ==9.6.7 || ==9.8.4 || ==9.10.3 || ==9.12.2 || ==9.14.1
License BSD-3-Clause
Author Well-Typed LLP
Maintainer info@well-typed.com
Uploaded by dschrempf at 2026-07-22T04:41:33Z
Category System
Source repo head: git clone https://github.com/well-typed/c-expr.git(c-expr-runtime)
this: git clone https://github.com/well-typed/c-expr.git(tag release-0.1.0.0)(c-expr-runtime)
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1 total (1 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-07-22 [all 1 reports]

Readme for c-expr-runtime-0.1.0.0

[back to package description]

c-expr-runtime

c-expr-runtime is a Haskell library providing the runtime support for c-expr-dsl: a type-level universe of C types and a class-per-operator hierarchy whose associated type families encode the C standard's integral-promotion and arithmetic-conversion rules. It supports the hs-bindgen project but can be used independently.

Its test suite cross-checks operator result types against a real C compiler, and so requires an LLVM/Clang installation.

See the main README for more information, and the changelog for release notes.