v.0.18.0
I had a Union Type defined like:
type Test = T1 List String | T2 String
and T1 evaluated to:
<function> : List -> String -> Test
I now know that what I meant was:
type Test = T1 (List String) | T2 String
but should <function> : List -> String -> Test have been possible?
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
For organizational purposes: Related to #1598
As for your question: I'm not sure what the eventual intention is. Either the compiler makes it impossible to represent * -> * types, or, it comes fully supported. Currently, we're somewhere in between: one can have the type, but not alias it, nor construct a value of that type.
I'm not sure if this is related or not but the following (invalid) code successfully compiles:
x : List List Int
x = Debug.crash "foo"
This compiles fine too:
x : Dict Maybe List
x = Dict.empty
https://ellie-app.com/d26YftK8ma1/0 - no compile or even runtime errors with Dict.empty : Dict Maybe List
Those are cases of "no kind checking", tracked in this meta issue
I added this to the #1373 meta issue. In the past week or so I fixed the "no kind checking" by requiring that all types are used fully. So you can say Maybe a but you cannot say Maybe by itself. You can say Result x Int but you cannot say type Abc = Xyz (Result x) Int or weird stuff like that.
In the development build it looks like this:
-- TOO FEW ARGS ------------------------------------------------------- temp.elm
The `List` type was given 0 arguments:
9| type Test = T1 List String | T2 String
^^^^
But it needs 1 argument. What is missing? Are some parentheses misplaced?
Thank you for the report!
Most helpful comment
I added this to the #1373 meta issue. In the past week or so I fixed the "no kind checking" by requiring that all types are used fully. So you can say
Maybe abut you cannot sayMaybeby itself. You can sayResult x Intbut you cannot saytype Abc = Xyz (Result x) Intor weird stuff like that.