Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An Elm Error: declaring a type equal to another doesn't make sense
## 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
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 }
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