# Type inference and incorrect compiler message

**URL:** <https://discourse.elm-lang.org/t/type-inference-and-incorrect-compiler-message/4034>\
**Category:** Learn\
**Created:** [July 22, 2019, 6:55am UTC](https://discourse.elm-lang.org/t/type-inference-and-incorrect-compiler-message/4034 "2019-07-22T06:55:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShalokShalom](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/shalokshalom/32/2203_2.png) [@ShalokShalom](https://discourse.elm-lang.org/u/ShalokShalom)\
**Post date:** [July 22, 2019, 6:55am UTC](https://discourse.elm-lang.org/t/type-inference-and-incorrect-compiler-message/4034/1 "2019-07-22T06:55:30Z")

</div>

Is Elm supposed to support coding without type annotations?

If yes, you can close this issue.

If no, you can remove line 29 [here](https://ellie-app.com/3SYtjPmN7Wja1) and then hit compile to see an interesting compiler message:

---

<div class="post-metadata">

**Author:** ![pdamoc](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/pdamoc/32/36_2.png) [@pdamoc](https://discourse.elm-lang.org/u/pdamoc)\
**Post date:** [July 22, 2019, 7:08am UTC](https://discourse.elm-lang.org/t/type-inference-and-incorrect-compiler-message/4034/2 "2019-07-22T07:08:47Z")

</div>

> [@ShalokShalom](#):
>
> Is Elm supposed to support coding without type annotations?

Yes. Elm has solid type inference capabilities.

The error you see if you remove line 29 has to do with the border of Elm. You have to have an explicit type for the program.

If you add a valid type signature for `main` (e.g. `main : Program () Model Msg`) you can leave out the type declaration on line 29. The type of `init` will be inferred.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [August 1, 2019, 7:08am UTC](https://discourse.elm-lang.org/t/type-inference-and-incorrect-compiler-message/4034/3 "2019-08-01T07:08:51Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
