Closed spacechimplives closed 2 years ago
Hello, @spacechimplives, and welcome to the community. :wave:
What is the type of the following expression?
[1, 2, 3, Math.sqrt]
We have Array ???
, but what is ???
? The array's elements are 1 :: Number
, 2 :: Number
, 3 :: Number
, and Math.sqrt :: Number -> Number
.
We could apply Math.sqrt
to a Number
to make a well-typed expression of type Array Number
:
[1, 2, 3, Math.sqrt (16)]
What is the type of the following expression?
[$.Boolean, $.Number, $.String, MyTypeWithParam]
We have Array ???
, but what is ???
? The array's elements are $.Boolean :: Type
, $.Number :: Type
, $.String :: Type
, and MyTypeWithParam :: Type -> Type
.
We could apply MyTypeWithParam
to a Type
to make a well-typed expression of type Array Type
:
[$.Boolean, $.Number, $.String, MyTypeWithParam ($.Unknown)]
Does this help to explain the difference between Type
and Type -> Type
?
Yes, thank you! Now I realize that I missed the part where only objects of type Type are allowed in the environment list. Makes perfect sense.
I'm pleased that this now makes sense. :)
In the readme it says:
I understand what this means in practice... I need to use
MyTypeWithParam ($.Unknown)
to generate a new type rather thanMyTypeWithParam :: Type -> Type
... but it says that the latter is the "wrong type" ... so I'm wondering why that is? and if there are any resources you all can point me to to understand that a little deeper.