sharkdp / numbat

A statically typed programming language for scientific computations with first class support for physical dimensions and units
https://numbat.dev
Apache License 2.0
1.26k stars 53 forks source link

Pretty printing shows superflous forall quantifiers #545

Closed sharkdp closed 2 months ago

sharkdp commented 3 months ago

The function

fn diff(f, x) = (f(x + Δx) - f(x)) / Δx
  where
    Δx = 1e-9 unit_of(x)

is pretty printed as

fn diff<A: Dim, B: Dim>(f: Fn[(B) -> A], x: B) -> A / B = (f(x + Δx) - f(x)) / Δx
  where Δx: forall A: Dim. A = 1.0e-9 × unit_of(x)

The type annotation for the local binding Δx is not correct, though. It should only say where Δx: A = ….