Skip to content

Instantly share code, notes, and snippets.

@jtomchak
Created August 31, 2017 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtomchak/f17ca7589b877a483be60df4398b478d to your computer and use it in GitHub Desktop.
Save jtomchak/f17ca7589b877a483be60df4398b478d to your computer and use it in GitHub Desktop.
Elm Compiler when trying to append to a new list
The 1st argument to function `append` is causing a mismatch.
5| List.append "black" fishes
^^^^^^^
Function `append` is expecting the 1st argument to be:
List a
But it is:
String
> moreFish = List.append fishes "black"
-- TYPE MISMATCH --------------------------------------------- repl-temp-000.elm
The 2nd argument to function `append` is causing a mismatch.
5| List.append fishes "black"
^^^^^^^
Function `append` is expecting the 2nd argument to be:
List String
But it is:
String
Hint: I always figure out the type of arguments from left to right. If an
argument is acceptable when I check it, I assume it is "correct" in subsequent
checks. So the problem may actually be in how previous arguments interact with
the 2nd.
> moreFish = List.append fishes ["black"]
["red","blue","green","black"] : List String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment