purescript / documentation

Documentation for the PureScript language, compiler, and tools.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More details for records in

BebeSparkelSparkel opened this issue · comments

I was looking in errors/TypesDoNotUnify.md but there wasn't anything about records in it. I think addressing this could be helpful.

  Could not match type

    ( ... )

  with type

    ( items :: List (Tuple Int String)
    ...
    )


while trying to match type
                             ( ... )

  with type
              ( items :: List (Tuple Int String)
              ...
              )

See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,
or to contribute content related to this error.

At the moment, if you see ... in a row in a TypesDoNotUnify message, it represents an omitted part of a row which is the same across both types. So in this case I think you have two rows which are the same except for an items label in one row but not the other.

I think these error messages are just not very good, and we should consider improving them, especially if that's going to end up being easier than documenting exactly what the current error messages really mean (which I think is plausible).

That seems even better. Should this be moved to purescript repo?

I think we already have an issue there for improving this error message, but if I’m wrong, sure.