11

I'm trying to import Html exposing (beginnerProgram), as it is shown there and there, but the compiler doesn't agree : "Module Html does not expose beginnerProgram".

Thanks in advance.

Algorythmis
  • 642
  • 1
  • 7
  • 19
  • Can you make sure your `elm-package.json` has `"elm-lang/html": "2.0.0 <= v < 3.0.0"`? – robertjlooby Dec 21 '16 at 00:12
  • 6
    What version of Elm are you on? 0.18 uses `Html.beginnerProgram` and `Html.program`, while the previous version used `Html.App.beginnerProgram` and `Html.App.program`. – Ryan Plant Dec 21 '16 at 01:12

2 Answers2

24

The above answer is for older versions of ELM. An updated answer is below.

Updated For Elm 0.19:

Add import statement:

import Browser exposing (sandbox)

Use sandbox: Note that we are not using Never - as in old code samples - we are using () instead:

main : Program () Model Msg
main = Browser.sandbox
       { init = initialModel
       , view = view
       , update = update
       }

Works beautifully: and I hope this helps you.

BenKoshy
  • 33,477
  • 14
  • 111
  • 80
3

Solved by importing from Html.App instead of Html.

Algorythmis
  • 642
  • 1
  • 7
  • 19
  • 2
    So this means that you are not using the latest version of Elm. If you want to continue seeking for advice on SO or other communities, you should first upgrade to the latest version (at the moment it is 0.18). – Zimm i48 Dec 22 '16 at 10:59