Skip to content

Potentially confusing error message suggests DataKinds

Motivation

Quite often we write types like [(Int, Bool)] (a list of tuples). If you leave out the parentheses, eg, [Int, Bool], you are given an error that suggests enabling DataKinds. While this would lead to a valid type, it's probably not what the user intended most of the time.

I imagine this would be quite confusing for a Haskell beginner, who might not know that tuples always have to be surrounded by parentheses, and who might then unthinkingly enable DataKinds and get further stuck.

Proposal

Current behaviour

Here's a ghci session of what currently happens:

GHCi, version 8.10.4: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/teo/.ghci
> x :: [Int, Bool]

<interactive>:1:6: error:
    Illegal type: ‘[Int, Bool]’ Perhaps you intended to use DataKinds
>

Suggested behaviour

Perhaps we could have an error that also hinted at adding parentheses.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information