In Elm, you could do something like
someFunc x y =
let
x2 : TypeItsNot
x2 = x
in
x + y
and the compiler would say 'thats not TypeItsNot
, it's an Int'.
It doesn't appear that the same trick works in roc so far, but maybe there's an equivalent way of getting the type.
Oh actually maybe it does work:
someFunc = \fileName ->
foo : TypeItsNot
foo = Util.readInputFile fileName
foo
yeah, that should work.
Thanks! It turns out the reason I thought it didn't work was because I was missing the last returned value there, and the compiler didn't know what I meant.
someFunc = \fileName ->
foo : TypeItsNot
foo = Util.readInputFile fileName
and I didn't read the error message closely.
Tankor Smash has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC