Hi Nicolas, thank you for your reply.
My code was originally missing all type annotations (and working as planned). When preparing the library for publishing, I had to add the missing documentation and type annotations; I started with simple types but the compiler was not happy (suggesting "Cmd (Msg x)" instead of my "Cmd y" and so on). So I incrementally improved those annotations till the compiler was happy. Now I would like to be happy as well :) Sincerely, Ondrej On Saturday, June 11, 2016 at 10:38:08 PM UTC+2, Nicolas Lawler wrote: > > I didn't spend much time looking at your code in depth, but my intuition > tells me that in saying this is the *correct* type, you mean "I had a > version of this program that I tried to compile, and the error from the > compiler told me to change "update" to this type to fix it". > > If thats the case, then I suggest you go back to the type annotation with > the semantics you wanted and see if there was another error somewhere in > the function body that might be throwing things off. Something that isn't > immediately intuitive is that the Elm compiler uses both the type > annotations you provide *and* the types of the expressions in your > function definition in typechecking; it can work from either direction to > verify that the two line up. Sometimes this makes the errors a little > misleading, since it'll tell you that you should change your annotation to > match the type it inferred from the function definition, when what you > really want is to fix your function so that it lines up with your type > annotation. Once you get used to it, though, its not hard to spot, and the > error itself can still give you hints about where your reasoning is going > astray. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
