Created
May 25, 2016 13:11
-
-
Save ccapndave/e900cc4c437c48055ae5b7186fd6d131 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onMenuLoaded : (Http.Error -> msg) -> (Menu -> msg) -> Sub msg | |
onMenuLoaded onError onSuccess = | |
let | |
decodeOnSuccess : String -> msg | |
decodeOnSuccess str = | |
case (decodeString Menu.decoder str) of | |
Ok menu -> | |
onSuccess menu | |
Err err -> | |
onError <| Http.UnexpectedPayload err | |
in | |
getMenuStringSuccess decodeOnSuccess | |
port getMenuString : String -> Cmd msg | |
port getMenuStringSuccess : (String -> msg) -> Sub msg | |
{- | |
-- TYPE MISMATCH ---------------------------------------- ././app/elm/Loader.elm | |
The type annotation for `onMenuLoaded` does not match its definition. | |
8| onMenuLoaded : (Http.Error -> msg) -> (Menu -> msg) -> Sub msg | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
The type annotation is saying: | |
(Http.Error -> a) -> (Menu -> a) -> Sub a | |
But I am inferring that the definition has this type: | |
(Http.Error -> a) -> (Menu -> a) -> Sub b | |
Hint: A type annotation is clashing with itself or with a sub-annotation. This | |
can be particularly tricky, so read more about it. | |
<https://github.com/elm-lang/elm-compiler/blob/0.17.0/hints/type-annotations.md> | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment