I’m learning ELM and got confused by the following code:
type MyType aa
= Foo
| Bar aa
-- case1: compiled
hi : Int -> MyType aa
hi ss = Foo
-- case2: not compiled
hi : Int -> MyType aa
hi ss =
case ss of
0 -> Foo
_ -> Bar ss
My question is:
Why does the case2 not work? After all, it does return an instance of type MyType aa
which comply with the function signature hi : Int -> MyType aa
, regarding the case1 compiled even without the branch Bar ss
.