Skip to content

Error messages: put newline after the message

Here's a ghci session:

ghci> not 'a'

<interactive>:1:5: error:
    • Couldn't match expected type ‘Bool’ with actual type ‘Char’
    • In the first argument of ‘not’, namely ‘'a'’
      In the expression: not 'a'
      In an equation for ‘it’: it = not 'a'
ghci> 'a' + 'b'

<interactive>:2:5: error:
    • No instance for (Num Char) arising from a use of ‘+’
    • In the expression: 'a' + 'b'
      In an equation for ‘it’: it = 'a' + 'b'
ghci> [] []

<interactive>:3:1: error:
    • Couldn't match expected type: [a1] -> t
                  with actual type: [a0]
    • The function ‘[]’ is applied to one value argument,
        but its type ‘[a0]’ has none
      In the expression: [] []
      In an equation for ‘it’: it = [] []
    • Relevant bindings include it :: t (bound at <interactive>:3:1)
ghci>

I don't like the blank lines here: they group the error with the next command, rather than with the offending line. How about:

ghci> not 'a'
<interactive>:1:5: error:
    • Couldn't match expected type ‘Bool’ with actual type ‘Char’
    • In the first argument of ‘not’, namely ‘'a'’
      In the expression: not 'a'
      In an equation for ‘it’: it = not 'a'

ghci> 'a' + 'b'
<interactive>:2:5: error:
    • No instance for (Num Char) arising from a use of ‘+’
    • In the expression: 'a' + 'b'
      In an equation for ‘it’: it = 'a' + 'b'

ghci> [] []
<interactive>:3:1: error:
    • Couldn't match expected type: [a1] -> t
                  with actual type: [a0]
    • The function ‘[]’ is applied to one value argument,
        but its type ‘[a0]’ has none
      In the expression: [] []
      In an equation for ‘it’: it = [] []
    • Relevant bindings include it :: t (bound at <interactive>:3:1)

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