├── .gitignore ├── .travis.yml ├── 16.md ├── 17-tasks.md ├── 17.md ├── CNAME ├── Gemfile ├── Makefile ├── README.md ├── _config.yml ├── _includes ├── footer.html ├── head.html └── header.html ├── _layouts ├── default.html ├── page.html └── post.html ├── _sass ├── _base.scss ├── _custom.scss ├── _layout.scss └── _syntax-highlighting.scss ├── assets ├── anchor.min.js ├── elm.js ├── filter.js └── tangram-runner.png ├── css └── main.scss ├── favicon.ico ├── index.md └── operators.html /.gitignore: -------------------------------------------------------------------------------- 1 | .jekyll-metadata 2 | .sass-cache 3 | _site 4 | Gemfile.lock 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.3 4 | script: "bundle exec jekyll build" 5 | -------------------------------------------------------------------------------- /16.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Elm 0.16 3 | layout: page 4 | --- 5 | 6 | **Warning: This page concerns Elm version 0.16.** 7 | The information here is no longer correct for the current version of Elm. 8 | 9 | For general questions about the current version see the [main FAQ page](index.html). 10 | 11 | #### Contents 12 | 13 |
14 | 15 | 16 | ### Why does elm-repl (or elm-make) report "cannot find module 'Html'"? 17 | You need to install the Html module: 18 | 19 | elm package install evancz/elm-html 20 | 21 | Several modules are [available by default](http://package.elm-lang.org/packages/elm-lang/core/latest) in the base Elm tools but other common modules like Html have to be installed in the working directory before they can be used in elm-make, elm-repl, and elm-reactor. 22 | 23 | 24 | ### How do I generate an Action as an Effect? 25 | 26 | Effects.task (Task.succeed SomeAction) 27 | 28 | 29 | ### Why isn't my StartApp-based program running any tasks? 30 | 31 | You need to set `app.port`. 32 | 33 | ```haskell 34 | port tasks : Signal (Task.Task Never ()) 35 | port tasks = 36 | app.tasks 37 | ``` 38 | 39 | 40 | ### Why doesn't the `<~` operator work? 41 | 42 | It was removed in Elm version 0.16. You can still get it (or the equivalent `andMap`) from 43 | [Signal.Extra](http://package.elm-lang.org/packages/Apanatshka/elm-signal-extra/latest/Signal-Extra) 44 | instead. 45 | 46 | 47 | ### Why doesn't my application get the initial value of Window.dimensions? 48 | 49 | For example, given this: 50 | 51 | ```haskell 52 | modelInit = { window = (-1,-1) } 53 | 54 | main = Signal.map Element.show model 55 | 56 | model = Signal.foldp (\d s -> {s | window = d}) modelInit Window.dimensions 57 | ``` 58 | 59 | the displayed value will remain at "{ window = (-1,-1) }" until the window is resized, at which time the display tracks all changes. 60 | 61 | This arises because `Signal.foldp` does not use the initial value of its input signal (`Window.dimensions` in this case). 62 | 63 | One solution is to use the `foldp'` function from the Apanatshka/elm-signal-extra package, as follows: 64 | 65 | ```haskell 66 | model = Signal.Extra.foldp' (\d s -> {s | window = d}) (\d -> { window = d }) Window.dimensions 67 | ``` 68 | 69 | Whereas `foldp` takes an initial value parameter, `foldp'` takes instead a function from the initial value of the input signal to the initial value returned by `foldp'`. 70 | 71 | Since StartApp uses `foldp` this problem with initial values can arise when it is used. Also, the problem is not specific to Window.dimensions; it can arise for any input signal whose initial value is of interest. 72 | 73 | 74 | 75 | ### Why is my app failing immediately saying "Cannot read property 'make' of undefined"? 76 | 77 | That can happen if you write custom Javascript code to call `Elm.embed()` or `Elm.fullscreen()` and the application name used there (the first parameter) does not match the main module name. 78 | 79 | For example, if Foo.elm contains the `main` function for your app then your Javascript code should call it like this: 80 | 81 | ```javascript 82 | app = Elm.embed(Elm.Foo, ...) 83 | ``` 84 | 85 | If you use a name other than `Elm.Foo` there you will likely get that "Cannot read property" error. 86 | -------------------------------------------------------------------------------- /17-tasks.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Elm 0.17 Tasks 3 | layout: page 4 | --- 5 | 6 | Here are some ways to convert Elm 0.16 code that uses `Effects.task` into Elm 0.17. 7 | 8 | The cases are sorted by priority, so use the first one that applies to your code. 9 | 10 |Elm 0.16 example | 13 |Elm 0.17 equivalent | 14 |
---|---|
task |> Task.toMaybe |> Effects.task |
17 | task |> Task.perform (always Nothing) Just |
18 |
task |> Task.toResult |> Effects.task |
21 | task |> Task.perform Err Ok |
22 |
task |> Task.map action |> Effects.task |
25 | task |> Task.Extra.performFailproof action |
26 |
task |> Effects.task |
29 | task |> Task.Extra.performFailproof identity |
30 |