error-message-catalog icon indicating copy to clipboard operation
error-message-catalog copied to clipboard

Capitalization mistakes

Open rtfeldman opened this issue 8 years ago • 1 comments

I saw this in #beginners on Elm Slack:

what am i doing wrong here - says that I have a naming error Cannot find pattern OK

They used OK instead of Ok. At a glance, I can see how someone might look at their code and look at the suggestion of Did you mean "Ok"? and not spot the distinction.

Hints could detect when one of the suggestions matches what you typed exactly, except for capitalization (e.g. with if String.toLower actual == String.toLower suggestion) and call this out. Something like:

Did you mean:

Ok (Note the different capitalization from OK) Okra Octopus

rtfeldman avatar Aug 17 '17 15:08 rtfeldman

Related to this. Capitalization mistakes in records produce unhelpful error messages. Someone using elm-ui got stuck with this error and it took me several minutes before I noticed onchange should be onChange

This argument is a record of type:    
    { checked : Bool
    , icon : Bool -> Element msg1
    , label : Label msg
    , onchange : Bool -> Msg
    }
But `checkbox` needs the 2nd argument to be:    
    { checked : Bool
    , icon : Bool -> Element msg
    , label : Label msg
    , onChange : Bool -> msg
    }

MartinSStewart avatar Jan 04 '20 12:01 MartinSStewart