elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
174 stars 17 forks source link

Invalid ports direct to a page that doesn't help #134

Open mgold opened 8 years ago

mgold commented 8 years ago

On Slack, a fellow reports having a module like this:

port module Main exposing (..)

-- SNIP

port decrypted : (String -> Msg) -> Sub Msg

When the file is compiled:

$ elm-make Main.elm —output elm.js
-- PORT ERROR --------------------------------------------------------- Main.elm

Port `decrypted` has an invalid type.

67| port decrypted : (String -> Msg) -> Sub Msg
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You are saying it should be:

    (String -> Main.Msg) -> Platform.Sub.Sub Main.Msg

But you need to use the particular format described here:
<http://guide.elm-lang.org/effect_managers/>

The immediate issue is that Msg should not be capitalized (#45) but if you go to the guide page on effect managers, it doesn't tell you what the format is. Either documentation needs to be written on that format, or the link should go where the documentation is. (Since the page linked to seems to be for effect manager authors, it sounds like the latter is more appropriate.)

Ryan1729 commented 8 years ago

Just because I would have found it helpful, I'll note here that a fix for this has already been merged