Skip to content

Better type error needed for when generic variables are not declared #43

@arendsee

Description

@arendsee

This generic Morloc expression:

id a :: a -> a 

Can easily be written incorrectly as:

id :: a -> a

Where the generic declaration is missing. This is particularly easy for Haskell programmers, where such declarations are not necessary. Currently when these declarations are missing, the variables are considered non-generic and this leads to the ugly error messages like:

At index xxx: General type error: Type evaluation failed: (VarU (TV {unTVar = "Int"}),VarU (TV {unTVar = "a"}))

It would be getter to check in these cases if the VarU is lowercase. If so, warn that a generic declaration may have been forgotten. Even better, the compiler could suggest the fix (though this won't be possible until I fix the "span" problem).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions