Re: [GHC] #3953: Misleading error message when quasiquoter not in scope

2010-05-18 Thread GHC
#3953: Misleading error message when quasiquoter not in scope
---+
  Reporter:  guest |  Owner:  
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  6.14.1  
 Component:  Compiler  |Version:  6.12.1  
Resolution:  fixed |   Keywords:  
Difficulty:| Os:  Unknown/Multiple
  Testcase:  quasiquotation/T3953  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  |  
---+
Changes (by igloo):

  * status:  merge => closed
  * resolution:  => fixed


Comment:

 Merged.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3953#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3953: Misleading error message when quasiquoter not in scope

2010-05-07 Thread GHC
#3953: Misleading error message when quasiquoter not in scope
-+--
Reporter:  guest |Owner:  
Type:  bug   |   Status:  merge   
Priority:  normal|Milestone:  6.14.1  
   Component:  Compiler  |  Version:  6.12.1  
Keywords:|   Difficulty:  
  Os:  Unknown/Multiple  | Testcase:  quasiquotation/T3953
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--
Changes (by simonpj):

  * status:  new => merge
  * testcase:  => quasiquotation/T3953


Comment:

 Good point, thanks. Fixed by
 {{{
 Fri Apr  9 21:17:48 BST 2010  simo...@microsoft.com
   * Fix Trac #3953: fail earlier when using a bogus quasiquoter

 M ./compiler/typecheck/TcSplice.lhs -5 +7
 }}}
 Merge to 6.12.3.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3953#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3953: Misleading error message when quasiquoter not in scope (was: Misleading error message when quasiquoter not in scopennnnnnnnnn)

2010-04-29 Thread GHC
#3953: Misleading error message when quasiquoter not in scope
-+--
Reporter:  guest |Owner:  
Type:  bug   |   Status:  new 
Priority:  normal|Milestone:  6.14.1  
   Component:  Compiler  |  Version:  6.12.1  
Keywords:|   Difficulty:  
  Os:  Unknown/Multiple  | Testcase:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--
Changes (by igloo):

  * milestone:  => 6.14.1


Comment:

 Thanks for the report

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3953#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #3953: Misleading error message when quasiquoter not in scopennnnnnnnnn

2010-03-31 Thread GHC
#3953: Misleading error message when quasiquoter not in scopenn
-+--
Reporter:  guest |   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Component:  Compiler
 Version:  6.12.1|Keywords:  
  Os:  Unknown/Multiple  |Testcase:  
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
-+--
 t.hs:
 {{{
 {-# LANGUAGE QuasiQuotes #-}
 main = [$notDefinedHere| |]
 }}}

 ghc's output:
 {{{
 t.hs:2:7: Not in scope: `notDefinedHere'

 t.hs:2:7:
 GHC stage restriction: notDefinedHere
   is used in a quasiquote, and must be imported, not defined locally
 Failed, modules loaded: none.
 }}}

 The second message is wrong, since notDefinedHere isn't defined anywhere.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3953>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1259: Accessing undefined value in DiffArray returns misleading error message

2009-08-02 Thread GHC
#1259: Accessing undefined value in DiffArray returns misleading error message
-+--
Reporter:  guest |Owner:  
Type:  bug   |   Status:  closed  
Priority:  normal|Milestone:  6.12 branch 
   Component:  libraries/base|  Version:  6.6 
Severity:  normal|   Resolution:  invalid 
Keywords:|   Difficulty:  Easy (1 hr) 
Testcase:|   Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
-+--
Changes (by igloo):

  * status:  new => closed
  * resolution:  => invalid

Comment:

 diffarray is now in its own package. Ticket moved to here:
 http://trac.haskell.org/diffarray/ticket/1

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1259#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1259: Accessing undefined value in DiffArray returns misleading error message

2009-04-13 Thread GHC
#1259: Accessing undefined value in DiffArray returns misleading error message
-+--
Reporter:  guest |Owner:  
Type:  bug   |   Status:  new 
Priority:  normal|Milestone:  6.12 branch 
   Component:  libraries/base|  Version:  6.6 
Severity:  normal|   Resolution:  
Keywords:|   Difficulty:  Easy (1 hr) 
Testcase:|   Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
-+--
Changes (by igloo):

  * priority:  low => normal
  * milestone:  6.10 branch => 6.12 branch

Comment:

 Raising priority now that we have extensible exceptions.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1259#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2294: Misleading error message suggestion

2008-05-20 Thread GHC
#2294: Misleading error message suggestion
--+-
 Reporter:  NeilMitchell  |  Owner: 
 Type:  bug   | Status:  closed 
 Priority:  normal|  Milestone: 
Component:  Compiler  |Version:  6.8.2  
 Severity:  normal| Resolution:  fixed  
 Keywords:| Difficulty:  Unknown
 Testcase:|   Architecture:  Unknown
   Os:  Unknown   |  
--+-
Changes (by simonpj):

  * status:  new => closed
  * difficulty:  => Unknown
  * resolution:  => fixed

Comment:

 I improved this a little while ago (HEAD only)
 {{{
 Foo1.hs:5:15:
 Illegal operator `.' in type `forall a . (a -> a)'
   Perhaps you intended to use -XRankNTypes or similar flag
 }}}
 I think this is what you were suggesting.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2294#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #2294: Misleading error message suggestion

2008-05-18 Thread GHC
#2294: Misleading error message suggestion
-+--
Reporter:  NeilMitchell  |   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Component:  Compiler
 Version:  6.8.2 |Severity:  normal  
Keywords:|Testcase:  
Architecture:  Unknown   |  Os:  Unknown 
-+--
 Given a rank-2 type, such as:

 {{{
 id :: forall a . a -> a
 id x = x
 }}}

 The compiler complains:

 {{{
 Uniplate.hs:3:15:
 Illegal operator `.' in type `forall a . (a -> a)'
   (Use -XTypeOperators to allow operators in types)
 }}}

 Of course, people using {{{`.'}}} in a type signature are much more likely
 to be aiming for {{{Rank2Types}}} - so perhaps in this one type operator
 the suggestion should be towards rank-2 types.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2294>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2126: Misleading error message for newtype with no constructors

2008-03-02 Thread GHC
#2126: Misleading error message for newtype with no constructors
-+--
 Reporter:  tim  |  Owner:  igloo  
 Type:  merge| Status:  closed 
 Priority:  normal   |  Milestone: 
Component:  Compiler (Type checker)  |Version:  6.8.1  
 Severity:  trivial  | Resolution:  fixed  
 Keywords:   | Difficulty:  Unknown
 Testcase:  T2126|   Architecture:  Unknown
   Os:  Unknown  |  
-+--
Changes (by igloo):

  * status:  new => closed
  * resolution:  => fixed

Comment:

 Merged

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2126#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2126: Misleading error message for newtype with no constructors

2008-02-27 Thread GHC
#2126: Misleading error message for newtype with no constructors
-+--
 Reporter:  tim  |  Owner:  igloo  
 Type:  merge| Status:  new
 Priority:  normal   |  Milestone: 
Component:  Compiler (Type checker)  |Version:  6.8.1  
 Severity:  trivial  | Resolution: 
 Keywords:   | Difficulty:  Unknown
 Testcase:  T2126|   Architecture:  Unknown
   Os:  Unknown  |  
-+--
Changes (by simonpj):

  * testcase:  => T2126
  * difficulty:  => Unknown
  * type:  bug => merge
  * owner:  => igloo

Comment:

 Good point.  Fixed by
 {{{
 Wed Feb 27 08:32:02 PST 2008  [EMAIL PROTECTED]
   * Fix Trac #2126: re-order tests (easy)
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2126#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #2126: Misleading error message for newtype with no constructors

2008-02-26 Thread GHC
#2126: Misleading error message for newtype with no constructors
+---
Reporter:  tim  |   Owner: 
Type:  bug  |  Status:  new
Priority:  normal   |   Component:  Compiler (Type checker)
 Version:  6.8.1|Severity:  trivial
Keywords:   |Testcase: 
Architecture:  Unknown  |  Os:  Unknown
+---
 Further adventures in error message pedantry! If I compile this module:
 {{{
 module Foo where

 newtype X
 }}}
 I get:
 {{{
 $ ghc -c Foo.hs

 Foo.hs:3:0:
 `X' has no constructors (-XEmptyDataDecls permits this)
 In the newtype declaration for `X'
 }}}
 Naively, I do what it suggests:
 {{{
 $ ghc -c Foo.hs -XEmptyDataDecls

 Foo.hs:3:0:
 A newtype must have exactly one constructor, but `X' has none
 In the newtype declaration for `X'
 }}}

 It would be better to just print the second error message even when the
 user doesn't pass {{{-XEmptyDataDecls}}}, and not lead them down a maze of
 twisty little passages...

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2126>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1259: Accessing undefined value in DiffArray returns misleading error message

2007-05-27 Thread GHC
#1259: Accessing undefined value in DiffArray returns misleading error message
---+
Reporter:  guest   |Owner: 
Type:  bug |   Status:  new
Priority:  low |Milestone:  6.10   
   Component:  libraries/base  |  Version:  6.6
Severity:  normal  |   Resolution: 
Keywords:  |   Difficulty:  Easy (1 hr)
  Os:  Unknown | Testcase: 
Architecture:  Multiple|  
---+
Changes (by igloo):

  * milestone:  => 6.10

Old description:

> Prelude> :m + Data.Array.Diff
> Prelude Data.Array.Diff> :t array
> array :: (Ix i, IArray a e) => (i, i) -> [(i, e)] -> a i e
> Prelude Data.Array.Diff> array (1,1) [] :: DiffArray Int Int
> array (1,1) [(1,*** Exception: MArray: undefined array element
>
> Since DiffArray isn't a MArray(it implements IArray), this is misleading.
> It should either say IArray or better DiffArray: undefined array element.

New description:

 {{{
 Prelude> :m + Data.Array.Diff
 Prelude Data.Array.Diff> :t array
 array :: (Ix i, IArray a e) => (i, i) -> [(i, e)] -> a i e
 Prelude Data.Array.Diff> array (1,1) [] :: DiffArray Int Int
 array (1,1) [(1,*** Exception: MArray: undefined array element
 }}}
 Since DiffArray isn't a MArray(it implements IArray), this is misleading.
 It should either say IArray or better DiffArray: undefined array element.

Comment:

 I think the right way to fix this is to wait until we have extensible
 exceptions, so MArray throws a structured exception. DiffArray can then
 s/MArray/DiffArray/ without having to duplicate all the checks.

 As such, it's probably something for 6.10.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1259>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #1259: Accessing undefined value in DiffArray returns misleading error message

2007-04-02 Thread GHC
#1259: Accessing undefined value in DiffArray returns misleading error message
---+
Reporter:  guest   |   Owner: 
Type:  bug |  Status:  new
Priority:  low |   Milestone: 
   Component:  libraries/base  | Version:  6.6
Severity:  normal  |Keywords: 
  Difficulty:  Easy (1 hr) |Testcase: 
Architecture:  Multiple|  Os:  Unknown
---+
Prelude> :m + Data.Array.Diff
 Prelude Data.Array.Diff> :t array
 array :: (Ix i, IArray a e) => (i, i) -> [(i, e)] -> a i e
 Prelude Data.Array.Diff> array (1,1) [] :: DiffArray Int Int
 array (1,1) [(1,*** Exception: MArray: undefined array element

 Since DiffArray isn't a MArray(it implements IArray), this is misleading.
 It should either say IArray or better DiffArray: undefined array element.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1259>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1237: misleading error message from cabal when versions differ

2007-03-22 Thread GHC
#1237: misleading error message from cabal when versions differ
-+--
 Reporter:  guest|  Owner: 
 Type:  bug  | Status:  closed 
 Priority:  normal   |  Milestone: 
Component:  None |Version:  6.7
 Severity:  minor| Resolution:  invalid
 Keywords:   | Difficulty:  Unknown
 Testcase:   |   Architecture:  Unknown
   Os:  Unknown  |  
-+--
Changes (by igloo):

  * resolution:  => invalid
  * status:  new => closed

Comment:

 I've opened a bug for this on the Cabal trac:
 http://hackage.haskell.org/trac/hackage/ticket/120

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1237>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #1237: misleading error message from cabal when versions differ

2007-03-20 Thread GHC
#1237: misleading error message from cabal when versions differ
+---
Reporter:  guest|   Owner: 
Type:  bug  |  Status:  new
Priority:  normal   |   Milestone: 
   Component:  None | Version:  6.7
Severity:  minor|Keywords: 
  Difficulty:  Unknown  |Testcase: 
Architecture:  Unknown  |  Os:  Unknown
+---
Using cabal, I do './Setup.hs configure', './Setup.hs build', and 'sudo
 ./Setup.hs install'.  Unfortunately, root's $PATH pointed to a different
 GHC (6.7 at some point, and not 6.4.2 which I was using), which resulted
 in the error message:

Setup.hs: error reading ./.setup-config; run "setup configure" command?

 Of course, there was nothing wrong with .setup-config, so I spent some
 time investigating permissions, before int-e suggested that the search
 path was at fault.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1237>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: Misleading error message

2000-03-20 Thread Simon Peyton-Jones

Turns out I'd already fixed this in my copy (still, alas, uncommitted).
The error message is a bit better than before.

Foo.hs:4:
All of the type variable(s) in the constraint `C a' are already in scope
At least one must be universally quantified here
In the type signature for `op'


| -Original Message-
| From: Ralf Hinze [mailto:[EMAIL PROTECTED]]
| Sent: 24 February 2000 13:21
| To: [EMAIL PROTECTED]
| Subject: Misleading error message
| 
| 
| The following error message might be a bit misleading ;-)
| 
| None of the type variable(s) in the constraint `C a'
| appears in the type `a -> b'
| In the type signature for `op'
| 
| Here is the source
| 
| > class C a where
| >   op :: (C a) => a -> b
| 
| which is not legal Haskell 98 (cf page 45: "the cx_i may not 
| constrain u").
| 
| BTW Hugs 98 silently accepts the program.
| 
| Cheers, Ralf
| 



Misleading error message

2000-02-24 Thread Ralf Hinze

The following error message might be a bit misleading ;-)

None of the type variable(s) in the constraint `C a'
appears in the type `a -> b'
In the type signature for `op'

Here is the source

> class C a where
>   op :: (C a) => a -> b

which is not legal Haskell 98 (cf page 45: "the cx_i may not constrain u").

BTW Hugs 98 silently accepts the program.

Cheers, Ralf



Re: Misleading error message

1998-01-28 Thread Manuel Chakravarty

Simon,

> Thanks for the suggestion. Is this better?

Yes, definitely.  Thanks very much.  So, you also suppressed 
the modules names (`PrelBase' etc)?  That's also a good
idea, I think, especially to avoid confusing new users.

Manuel


> Foo.hs:8:
> Couldn't match the type `()' against `[aVG]'
>   Expected: ()
>   Inferred: [aVG]
>   In the second argument of `:', namely `()'
>   In a "case" branch: [] -> 1 : ()
>  
> Foo.hs:3:
> Couldn't match the type `(aVR, aVU)' against `[aVZ]'
>   Expected: [aVZ]
>   Inferred: (aVQ, aVT)
>   In the scrutinee of a case expression: []
>   In the case expression: case [] of (a, b) -> 1
>   In a pattern binding: test = case [] of (a, b) -> 1
> 
> 
> > I just encountered a misleading errors message produced
> > during type checking of `case' expressions.  Given the
> > malformed program
> > 
> >   test = case [] of
> >(a, b) -> 1
> > 
> > 
> >   test2 = case [] of
> >[] -> 1:()
> > 
> > I get the following error messages
> > 
> >   bug.hs:8: Couldn't match the type `PrelBase.()' against `[taQI]'
> >   Expected: `PrelBase.()'
> >   Inferred: `[taQI]'
> >   In a "case" branch: `PrelBase.[]' -> `1 PrelBase.: PrelBase.()'
> >   In the case expression
> >   `case PrelBase.[] of PrelBase.[] -> 1 PrelBase.: PrelBase.()'
> >   In a pattern binding:
> >   `test2
> >= case PrelBase.[] of PrelBase.[] -> 1 PrelBase.: PrelBase.()'
> > 
> >   bug.hs:4: Couldn't match the type
> > `PrelBase.[]' against `PrelTup.(,) oaQW'
> >   Expected: `(taQV, taQY)'
> >   Inferred: `[taQR]'
> >   In a "case" branch: (`a', `b') -> `1'
> >   In the case expression `case PrelBase.[] of (a, b) -> 1'
> >   In a pattern binding: `test = case PrelBase.[] of (a, b) -> 1'
> > 
> > The first one, referring to `test2', is nice, but the second
> > one, referring to `test' is misleading.  It suggest (at
> > least to me) that the mistake actually is in the case
> > branch, whereas it is *between* the case branch and the
> > scrutinized expression.  In the program where I originally
> > encountered the problem, the actual error was a missing
> > argument in the scrutinized expression (and the case branch
> > was correct).  This may put users (especially, unexperienced
> > ones) on the wrong track during debugging...
> > 
> > Manuel



Re: Misleading error message

1998-01-27 Thread Simon L Peyton Jones


Manuel:

Thanks for the suggestion. Is this better?

Simon


Foo.hs:8:
Couldn't match the type `()' against `[aVG]'
Expected: ()
Inferred: [aVG]
In the second argument of `:', namely `()'
In a "case" branch: [] -> 1 : ()
 
Foo.hs:3:
Couldn't match the type `(aVR, aVU)' against `[aVZ]'
Expected: [aVZ]
Inferred: (aVQ, aVT)
In the scrutinee of a case expression: []
In the case expression: case [] of (a, b) -> 1
In a pattern binding: test = case [] of (a, b) -> 1


> I just encountered a misleading errors message produced
> during type checking of `case' expressions.  Given the
> malformed program
> 
>   test = case [] of
>  (a, b) -> 1
> 
> 
>   test2 = case [] of
>  [] -> 1:()
> 
> I get the following error messages
> 
>   bug.hs:8: Couldn't match the type `PrelBase.()' against `[taQI]'
>   Expected: `PrelBase.()'
>   Inferred: `[taQI]'
>   In a "case" branch: `PrelBase.[]' -> `1 PrelBase.: PrelBase.()'
>   In the case expression
> `case PrelBase.[] of PrelBase.[] -> 1 PrelBase.: PrelBase.()'
>   In a pattern binding:
> `test2
>  = case PrelBase.[] of PrelBase.[] -> 1 PrelBase.: PrelBase.()'
> 
>   bug.hs:4: Couldn't match the type
>   `PrelBase.[]' against `PrelTup.(,) oaQW'
>   Expected: `(taQV, taQY)'
>   Inferred: `[taQR]'
>   In a "case" branch: (`a', `b') -> `1'
>   In the case expression `case PrelBase.[] of (a, b) -> 1'
>   In a pattern binding: `test = case PrelBase.[] of (a, b) -> 1'
> 
> The first one, referring to `test2', is nice, but the second
> one, referring to `test' is misleading.  It suggest (at
> least to me) that the mistake actually is in the case
> branch, whereas it is *between* the case branch and the
> scrutinized expression.  In the program where I originally
> encountered the problem, the actual error was a missing
> argument in the scrutinized expression (and the case branch
> was correct).  This may put users (especially, unexperienced
> ones) on the wrong track during debugging...
> 
> Manuel





Misleading error message

1998-01-13 Thread Manuel Chakravarty

I just encountered a misleading errors message produced
during type checking of `case' expressions.  Given the
malformed program

  test = case [] of
   (a, b) -> 1


  test2 = case [] of
   [] -> 1:()

I get the following error messages

  bug.hs:8: Couldn't match the type `PrelBase.()' against `[taQI]'
  Expected: `PrelBase.()'
  Inferred: `[taQI]'
  In a "case" branch: `PrelBase.[]' -> `1 PrelBase.: PrelBase.()'
  In the case expression
  `case PrelBase.[] of PrelBase.[] -> 1 PrelBase.: PrelBase.()'
  In a pattern binding:
  `test2
   = case PrelBase.[] of PrelBase.[] -> 1 PrelBase.: PrelBase.()'

  bug.hs:4: Couldn't match the type
`PrelBase.[]' against `PrelTup.(,) oaQW'
  Expected: `(taQV, taQY)'
  Inferred: `[taQR]'
  In a "case" branch: (`a', `b') -> `1'
  In the case expression `case PrelBase.[] of (a, b) -> 1'
  In a pattern binding: `test = case PrelBase.[] of (a, b) -> 1'

The first one, referring to `test2', is nice, but the second
one, referring to `test' is misleading.  It suggest (at
least to me) that the mistake actually is in the case
branch, whereas it is *between* the case branch and the
scrutinized expression.  In the program where I originally
encountered the problem, the actual error was a missing
argument in the scrutinized expression (and the case branch
was correct).  This may put users (especially, unexperienced
ones) on the wrong track during debugging...

Manuel