Created
August 16, 2015 00:07
-
-
Save jessitron/4adfdd364238a83e31d4 to your computer and use it in GitHub Desktop.
An Elm Error: declaring a type equal to another doesn't make sense
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
## ERRORS in Failure.elm ####################################################### | |
-- TYPE MISMATCH --------------------------------------------------- Failure.elm | |
The type annotation for `update` does not match its definition. | |
17| update: Action -> Model -> Model | |
^^^^^^^^^^^^^^^^^^^^^^^^ | |
As I infer the type of values flowing through your program, I see a conflict | |
between these two types: | |
InnerModel | |
InnerComponent.Model | |
-- TYPE MISMATCH --------------------------------------------------- Failure.elm | |
The 1st argument to function `update` has an unexpected type. | |
20| InnerComponent.update ia m.inner | |
^^ | |
As I infer the type of values flowing through your program, I see a conflict | |
between these two types: | |
InnerComponent.Action | |
InnerAction |
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
module Failure where | |
import InnerComponent | |
--- ACTION | |
type InnerAction = InnerComponent.Action -- oops, meant type alias | |
type Action = Passthru InnerAction | |
-- MODEL | |
type InnerModel = InnerComponent.Model -- oops, meant type alias | |
type alias Model = { inner: InnerModel } | |
--- UPDATE | |
update: Action -> Model -> Model | |
update a m = | |
case a of | |
Passthru ia -> { m | inner <- InnerComponent.update ia m.inner } |
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
module InnerComponent(update, Action, Model) where | |
type Action = Something String | Else | |
type alias Model = { something: String } | |
update: Action -> Model -> Model | |
update a m = m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment