You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quick Summary: The compiler brings up a type mismatch between function x -> type and type when trying to use the result of a partial function call. It does not give a hint that the user might want to apply the function to x by giving it as a parameter.
SSCCE
moduleMainexposing (..)
importBrowserimportHtmlexposing (Html, div, text)
-- MAINmain =Browser.sandbox { init = init, update = update, view = view }-- UPDATEupdate:()->Model->Modelupdate _ model =
model
-- MODELtype alias Model=Chaintype Chain=Empty|NodeChaininit:Modelinit =Node(NodeEmpty)-- VIEWview:Model->Html()view model =
div [](render
model
-- 2. 1)render:Chain->Int->List (Html())
render chain depth =case chain ofEmpty->[]Node subChain ->(render
subChain
-- 1. (depth + 1))++[div [][text (String.fromInt depth)]]
TYPE MISMATCH
Jump to problem
The (++) operator cannot append this type of value:
38|> (render
39|> subChain
40| -- 1. (depth + 1)
41| )
42| ++ [div [] [text (String.fromInt depth)]]
This `render` call produces:
Int -> List (Html ())
But the (++) operator is only for appending List and String values. Maybe put
this value in [] to make it a list?
Hint: I only know how to append strings and lists.
The text was updated successfully, but these errors were encountered:
Quick Summary: The compiler brings up a type mismatch between function x -> type and type when trying to use the result of a partial function call. It does not give a hint that the user might want to apply the function to x by giving it as a parameter.
SSCCE
Additional Details
Compiler output:
The text was updated successfully, but these errors were encountered: