Two compiler issues:
1) This code gets a thread panic when Num.pow was added. Removing Num.pow returned 4.0
app "point"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" }
imports [pf.Stdout]
provides [main] to pf
main =
Num.toStr (difference { x: 1.0, y: 1.0 } { x: 3.0, y: 3.0 })
|> Stdout.line
difference : { x : Frac a, y : Frac a }, { x : Frac a, y : Frac a } -> Frac a
difference = \p1, p2 -> (Num.pow (p2.x - p1.x) 2.0) + (Num.pow (p2.y - p1.y) 2.0)
2) This code gets a parsing error on the type alias
The definition of Point has an unbound type variable:
10│ Point : { x : Frac a, y : Frac a }
app "point"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" }
imports [pf.Stdout]
provides [main] to pf
main =
Num.toStr (difference { x: 1.0, y: 1.0 } { x: 3.0, y: 3.0 })
|> Stdout.line
Point : { x : Frac a, y : Frac a }
difference : Point, Point -> Frac a
difference = \p1, p2 -> (p2.x - p1.x) + (p2.y - p1.y)
I think we should raise an Issue for the first.
For the second I suspect it should be Point a : { x : Frac a, y : Frac a }
, does the compiler crash or give a nicely formatted error message?
Last updated: Jul 06 2025 at 12:14 UTC