GHC issueshttps://gitlab.haskell.org/ghc/ghc//issues20190707T19:18:02Zhttps://gitlab.haskell.org/ghc/ghc//issues/419TcSimplify.lhs:(2093,13)(2094,38): Nonexhaustive patterns20190707T19:18:02ZnobodyTcSimplify.lhs:(2093,13)(2094,38): Nonexhaustive patterns```
Dear ghc developers,
instead of giving some kind of 'unresolved overloading'
error message, the following code
% cat Bug.hs
{# OPTIONS_GHC fglasgowexts #}
module Bug where
class Foo a
instance Foo (a > b)
foo :: Foo a => a ...```
Dear ghc developers,
instead of giving some kind of 'unresolved overloading'
error message, the following code
% cat Bug.hs
{# OPTIONS_GHC fglasgowexts #}
module Bug where
class Foo a
instance Foo (a > b)
foo :: Foo a => a > ()
foo = undefined
class Bar a r
 The same happens if we use fundeps:
 class Bar a r  r > a
bar :: Bar a r => r > ()
bar = undefined
test = foo bar
causes ghc to panic:
% ghc Bug.hs
ghc6.5.20050709: panic! (the `impossible' happened,
GHC version 6.5.20050709):
typecheck/TcSimplify.lhs:(2093,13)(2094,38):
Nonexhaustive patterns in case
Best regards,
Thomas Jäger
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  None 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"TcSimplify.lhs:(2093,13)(2094,38): Nonexhaustive patterns","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nDear ghc developers,\n\ninstead of giving some kind of 'unresolved overloading'\nerror message, the following code\n\n% cat Bug.hs\n{# OPTIONS_GHC fglasgowexts #}\nmodule Bug where\n\nclass Foo a\ninstance Foo (a > b)\n\nfoo :: Foo a => a > ()\nfoo = undefined\n\nclass Bar a r\n The same happens if we use fundeps:\n class Bar a r  r > a\n\nbar :: Bar a r => r > ()\nbar = undefined\n\ntest = foo bar\n\ncauses ghc to panic:\n\n% ghc Bug.hs\nghc6.5.20050709: panic! (the `impossible' happened,\nGHC version 6.5.20050709):\n typecheck/TcSimplify.lhs:(2093,13)(2094,38):\nNonexhaustive patterns in case\n\n\nBest regards,\n\nThomas Jäger\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/416instance of synonym20190707T19:18:03Znobodyinstance of synonym```
The following nonHaskell 98 instance is accepted even
without fglasgowexts:
type Foo = Double
instance Bounded Foo
The error message quotes the relevant part of the
Report (The instance type must be of form (T a b c)
where T is ...```
The following nonHaskell 98 instance is accepted even
without fglasgowexts:
type Foo = Double
instance Bounded Foo
The error message quotes the relevant part of the
Report (The instance type must be of form (T a b c)
where T is not a synonym, and a,b,c are distinct type
variables) and the code expresses this, but it seems
that type synonyms have already been expanded, so only
nonsaturated ones are left at this stage.
ross@soi.city.ac.uk
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  None 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"instance of synonym","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe following nonHaskell 98 instance is accepted even\nwithout fglasgowexts:\n\ntype Foo = Double\ninstance Bounded Foo\n\nThe error message quotes the relevant part of the\nReport (The instance type must be of form (T a b c)\nwhere T is not a synonym, and a,b,c are distinct type\nvariables) and the code expresses this, but it seems\nthat type synonyms have already been expanded, so only\nnonsaturated ones are left at this stage.\n\nross@soi.city.ac.uk\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/415Bad location for violation of functional dependency20190707T19:18:03ZmagunterBad location for violation of functional dependency```
The code below produces an error message which gives no
clue
that the actual source of the error is on the line
marked L3
(pointing instead to L1 and L2):
.../BadWarningLoc.hs:1:0:
Couldn't match `S Z' against `Z'
Expect...```
The code below produces an error message which gives no
clue
that the actual source of the error is on the line
marked L3
(pointing instead to L1 and L2):
.../BadWarningLoc.hs:1:0:
Couldn't match `S Z' against `Z'
Expected type: S Z
Inferred type: Z
When using functional dependencies to combine
MinMax a Z Z a,
arising from the instance declaration at
.../BadWarningLoc.hs:10:0
MinMax (S Z) Z _c d,
arising from use of `t' at .../BadWarningLoc.hs:21:810
With the type signature, marked L4, uncommented the error
message does indeed point to the culprit, L3.
(With L3 commentedout, the code compiles.)
thanks,
mike
{# OPTIONS_GHC fglasgowexts
fallowundecidableinstances #}
data Z = Z
data S a = S a
n0 = Z
n1 = S n0
class MinMax a b c d  a b > c d, a c d > b, b c d > a
instance MinMax Z Z Z Z
instance MinMax a Z Z a  L1: wrongly flagged as
error src.
instance MinMax Z b Z b
instance MinMax a b c d => MinMax (S a) (S b) (S c) (S d)
class Extend a b where extend :: a > b > b
instance Extend Z b where Z `extend` b = b
instance MinMax a b _c b => Extend a b where _a
`extend` b = b
t :: MinMax a b _c d => a > b > d
t _ _ = (undefined :: d)
t1 = n1 `t` n0  L2
t2 = n1 `extend` n0  L3: uncommenting just this line
produces
 an error message pointing at L1 and L2
 with no mention of the real culprit, L3.
t1 :: S Z  L4: uncommenting this and L3 produces an
 error message rightly pointing at L2 and L3.
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.4 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"Bad location for violation of functional dependency","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe code below produces an error message which gives no\nclue\nthat the actual source of the error is on the line\nmarked L3\n(pointing instead to L1 and L2):\n\n .../BadWarningLoc.hs:1:0:\n Couldn't match `S Z' against `Z'\n Expected type: S Z\n Inferred type: Z\n When using functional dependencies to combine\n MinMax a Z Z a,\n\tarising from the instance declaration at\n.../BadWarningLoc.hs:10:0\n MinMax (S Z) Z _c d,\n\tarising from use of `t' at .../BadWarningLoc.hs:21:810\n\nWith the type signature, marked L4, uncommented the error\nmessage does indeed point to the culprit, L3.\n\n(With L3 commentedout, the code compiles.)\n\n\tthanks,\n\tmike\n\n{# OPTIONS_GHC fglasgowexts\nfallowundecidableinstances #}\ndata Z\t\t= Z\ndata S a\t= S a\n\nn0\t= Z\nn1\t= S n0\n\nclass MinMax a b c d  a b > c d, a c d > b, b c d > a\ninstance MinMax Z Z Z Z\t\t\t\t\ninstance MinMax a Z Z a\t  L1: wrongly flagged as\nerror src.\ninstance MinMax Z b Z b\t\t\t\t\ninstance MinMax a b c d => MinMax (S a) (S b) (S c) (S d)\n\nclass Extend a b where extend :: a > b > b\ninstance Extend Z b where Z `extend` b = b\ninstance MinMax a b _c b => Extend a b where _a\n`extend` b = b\n\nt\t:: MinMax a b _c d => a > b > d\nt _ _\t= (undefined :: d)\n\nt1 = n1 `t` n0\t  L2\nt2 = n1 `extend` n0  L3: uncommenting just this line\nproduces\n\t\t \t an error message pointing at L1 and L2\n\t\t \t with no mention of the real culprit, L3.\nt1\t:: S Z\t  L4: uncommenting this and L3 produces an\n\t\t \terror message rightly pointing at L2 and L3.\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/411panic: "Nonexhaustive patterns in function zip_ty_env"20190707T19:18:05Znobodypanic: "Nonexhaustive patterns in function zip_ty_env"```
ghc6.4: panic! (the `impossible' happened, GHC version
6.4):
types/Type.lhs:(1107,0)(1108,77):
Nonexhaustive patterns in function zip_ty_env
The same file compiles fine with GHC 6.2.2.
Unfortunately I don't have a small ...```
ghc6.4: panic! (the `impossible' happened, GHC version
6.4):
types/Type.lhs:(1107,0)(1108,77):
Nonexhaustive patterns in function zip_ty_env
The same file compiles fine with GHC 6.2.2.
Unfortunately I don't have a small example of this
behaviour. I can send you the whole library if you need
it, but it is not painless to get to this point.
It would be great if you could give me some pointers
about where the bug might lie  it uses MPTC instances,
recursive newtypes and the FFI.
thanks,
peter, peteg at unsw.edu.au
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  None 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"panic: \"Nonexhaustive patterns in function zip_ty_env\"","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"simonpj"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nghc6.4: panic! (the `impossible' happened, GHC version\n6.4):\n types/Type.lhs:(1107,0)(1108,77):\nNonexhaustive patterns in function zip_ty_env\n\nThe same file compiles fine with GHC 6.2.2.\n\nUnfortunately I don't have a small example of this\nbehaviour. I can send you the whole library if you need\nit, but it is not painless to get to this point.\n\nIt would be great if you could give me some pointers\nabout where the bug might lie  it uses MPTC instances,\nrecursive newtypes and the FFI.\n\nthanks,\npeter, peteg at unsw.edu.au\n}}}","type_of_failure":"OtherFailure","blocking":[]} >Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc//issues/409confusing error20190707T19:18:06Zpimlottconfusing error```
I got a perplexing error message. Here is a concise
example:
t = ((\Just x > x) :: Maybe a > a) (Just 1)
Try.hs:1:6:
Couldn't match the rigid variable `a' against
`t > t1'
`a' is bound by the polym...```
I got a perplexing error message. Here is a concise
example:
t = ((\Just x > x) :: Maybe a > a) (Just 1)
Try.hs:1:6:
Couldn't match the rigid variable `a' against
`t > t1'
`a' is bound by the polymorphic type `forall
a. Maybe a > a' at Try.hs:1:534
Expected type: a
Inferred type: t > t1
In the expression: (\ Just x > x) :: Maybe a > a
In the definition of `t': t = ((\ Just x > x)
:: Maybe a > a) (Just 1)
Failed, modules loaded: none.
It seems to be telling me that the whole expression "(\
Just x > x) ::
Maybe a > a" was expected to have type a, in
contradiction to the explicit
type annotation it prints out! In the context of a
larger program, this
threw me for a loop. I would have expected
Expected type: Maybe > a
Inferred type: Maybe > t > t1
Even better, if I change the code, I get a helpful
diagnostic:
t = (\Just x > x) (Just 1)
Try.hs:1:6:
Constructor `Just' should have 1 argument, but
has been given 0
When checking the pattern: Just
In a lambda abstraction: \ Just x > x
In the definition of `t': t = (\ Just x > x)
(Just 1)
Failed, modules loaded: none.
Could I get that error in the first example? You could
probably go even further: "(did you forget parentheses
around the pattern?)".
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  None 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"confusing error","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"simonpj"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nI got a perplexing error message. Here is a concise\nexample:\n\n t = ((\\Just x > x) :: Maybe a > a) (Just 1)\n \n Try.hs:1:6:\n Couldn't match the rigid variable `a' against\n`t > t1'\n `a' is bound by the polymorphic type `forall\na. Maybe a > a' at Try.hs:1:534\n Expected type: a\n Inferred type: t > t1\n In the expression: (\\ Just x > x) :: Maybe a > a\n In the definition of `t': t = ((\\ Just x > x)\n:: Maybe a > a) (Just 1)\n Failed, modules loaded: none.\n\nIt seems to be telling me that the whole expression \"(\\\nJust x > x) ::\nMaybe a > a\" was expected to have type a, in\ncontradiction to the explicit\ntype annotation it prints out! In the context of a\nlarger program, this\nthrew me for a loop. I would have expected\n\n Expected type: Maybe > a\n Inferred type: Maybe > t > t1\n\nEven better, if I change the code, I get a helpful\ndiagnostic:\n\n t = (\\Just x > x) (Just 1)\n\n Try.hs:1:6:\n Constructor `Just' should have 1 argument, but\nhas been given 0\n When checking the pattern: Just\n In a lambda abstraction: \\ Just x > x\n In the definition of `t': t = (\\ Just x > x)\n(Just 1)\n Failed, modules loaded: none.\n\nCould I get that error in the first example? You could\nprobably go even further: \"(did you forget parentheses\naround the pattern?)\".\n}}}","type_of_failure":"OtherFailure","blocking":[]} >Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc//issues/405Typechecker loop and stack overflow in 6.420190707T19:18:08ZekarttunTypechecker loop and stack overflow in 6.4```
The following seems to trigger an loop in the typechecker,
which does from stack overflow after a while.
The example is quite pointless but shows
the bug.
newtype PRef a = PRef a
type Drop1 a = a
class Ref a r  a > r where readRe...```
The following seems to trigger an loop in the typechecker,
which does from stack overflow after a while.
The example is quite pointless but shows
the bug.
newtype PRef a = PRef a
type Drop1 a = a
class Ref a r  a > r where readRef :: a > r
instance Ref (PRef a) (Drop1 a) where readRef (PRef v) = v
Here is a dump from the test (bug.hs contains the above code):
e@yui ~/work/pcl/hpclc $ ghci v fglasgowexts bug.hs
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / /   GHC Interactive, version 6.4, for Haskell 98.
/ /_\\/ __ / /___  http://www.haskell.org/ghc/
\____/\/ /_/\____/_ Type :? for help.
Using package config file: /usr/lib/ghc6.4/package.conf
Using package config file: /home/e/.ghc/i386linux6.4/package.conf
Hsc static flags: static
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package base1.0 ... linking ... done.
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
*** Chasing dependencies:
unload: retaining objs []
unload: retaining bcos []
Stable modules:
unload: retaining objs []
unload: retaining bcos []
*** Compiling Main ( bug.hs, interpreted ):
compile: input file bug.hs
*** Checking old interface for Main:
Compiling Main ( bug.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Exception: stack overflow
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  None 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"Typechecker loop and stack overflow in 6.4","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe following seems to trigger an loop in the typechecker,\nwhich does from stack overflow after a while.\nThe example is quite pointless but shows\nthe bug.\n\nnewtype PRef a = PRef a\ntype Drop1 a = a\nclass Ref a r  a > r where readRef :: a > r\ninstance Ref (PRef a) (Drop1 a) where readRef (PRef v) = v\n\nHere is a dump from the test (bug.hs contains the above code):\ne@yui ~/work/pcl/hpclc $ ghci v fglasgowexts bug.hs \n ___ ___ _\n / _ \\ /\\ /\\/ __(_)\n / /_\\// /_/ / /   GHC Interactive, version 6.4, for Haskell 98.\n/ /_\\\\/ __ / /___  http://www.haskell.org/ghc/\n\\____/\\/ /_/\\____/_ Type :? for help.\n\nUsing package config file: /usr/lib/ghc6.4/package.conf\nUsing package config file: /home/e/.ghc/i386linux6.4/package.conf\nHsc static flags: static\n*** Parser:\n*** Desugar:\n*** Simplify:\n*** CorePrep:\n*** ByteCodeGen:\nLoading package base1.0 ... linking ... done.\n*** Parser:\n*** Desugar:\n*** Simplify:\n*** CorePrep:\n*** ByteCodeGen:\n*** Chasing dependencies:\nunload: retaining objs []\nunload: retaining bcos []\nStable modules:\nunload: retaining objs []\nunload: retaining bcos []\n*** Compiling Main ( bug.hs, interpreted ):\ncompile: input file bug.hs\n*** Checking old interface for Main:\nCompiling Main ( bug.hs, interpreted )\n*** Parser:\n*** Renamer/typechecker:\n*** Exception: stack overflow\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/393functions without implementations20190707T19:18:11ZGhost Userfunctions without implementations```
Allow to declare a function by only supplying its type
signature.
This feature shall enhance rapid prototyping by fixing
an interface but leaving some functions unimplemented.
Currently this can be (only) simulated by supplying
dumm...```
Allow to declare a function by only supplying its type
signature.
This feature shall enhance rapid prototyping by fixing
an interface but leaving some functions unimplemented.
Currently this can be (only) simulated by supplying
dummy implementations, like
f :: ...
f = undefined
Since it is possible to supply dummy data types by
"data T" (not followed by "="), allowing functions
without implementations seems almost to be a logical
consequence. Surely, the compiler should emit warnings
for missing implementations.
It would be nice if such function declarations via type
signatures could be repeated at any position within a
module.
```IcelandjackIcelandjackhttps://gitlab.haskell.org/ghc/ghc//issues/392forall in pattern type sig has changed from 6.2.220190707T19:18:11Zmtullsenforall in pattern type sig has changed from 6.2.2```
 The program (straight from documentation :) 
$ cat Test.hs
test = \(f :: forall a. a > a) > (f True,f 'a')
 Works fine under 6.2.2 
tests $ ghci6.2.2 fglasgowexts Test.hs
...
Compiling Test ...```
 The program (straight from documentation :) 
$ cat Test.hs
test = \(f :: forall a. a > a) > (f True,f 'a')
 Works fine under 6.2.2 
tests $ ghci6.2.2 fglasgowexts Test.hs
...
Compiling Test ( Test.hs, interpreted )
Ok, modules loaded: Test.
 Doesn't typecheck under 6.4 
$ ghci6.4 fglasgowexts Test.hs
...
Compiling Test ( Test.hs, interpreted )
Test.hs:3:9:
Inferred type is less polymorphic than expected
Quantified type variable `a' is mentioned in the environment:
test :: (a > a) > t (bound at Test.hs:3:0)
Expected type: forall a1. a1 > a1
Inferred type: a > a
In a lambda abstraction: \ (f :: forall a. a > a) > (f True, f 'a')
In the definition of `test': test = \ (f :: forall a. a > a) > (f True, f
'a')
...
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.4 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"forall in pattern type sig has changed from 6.2.2","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\n The program (straight from documentation :) \n$ cat Test.hs\n\ntest = \\(f :: forall a. a > a) > (f True,f 'a')\n\n Works fine under 6.2.2 \ntests $ ghci6.2.2 fglasgowexts Test.hs\n...\nCompiling Test ( Test.hs, interpreted )\nOk, modules loaded: Test.\n\n Doesn't typecheck under 6.4 \n$ ghci6.4 fglasgowexts Test.hs\n...\nCompiling Test ( Test.hs, interpreted )\n\nTest.hs:3:9:\n Inferred type is less polymorphic than expected\n Quantified type variable `a' is mentioned in the environment:\n test :: (a > a) > t (bound at Test.hs:3:0)\n Expected type: forall a1. a1 > a1\n Inferred type: a > a\n In a lambda abstraction: \\ (f :: forall a. a > a) > (f True, f 'a')\n In the definition of `test': test = \\ (f :: forall a. a > a) > (f True, f \n'a')\n...\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/391unjustified deduction error20190707T19:18:11Znobodyunjustified deduction error```
(also sent to glasgowhaskellusers) maeder@tzi.de
the following (reduced) example used to go through with
ghc6.2.2 but fails with ghc6.4.
This seems to be a  low priority  bug. (hugs accepts
this module.)
I compile with:
ghc...```
(also sent to glasgowhaskellusers) maeder@tzi.de
the following (reduced) example used to go through with
ghc6.2.2 but fails with ghc6.4.
This seems to be a  low priority  bug. (hugs accepts
this module.)
I compile with:
ghc fglasgowexts Context.hs
module Context where
class Language a
class Language a => Logic a b  a > b
class (Language a, Logic b c, Logic d e)
=> Comorph a b c d e  a > b, a > d
instance (Comorph a1 b1 c1 d1 e1, Comorph a2 b2 c2 d2 e2)
=> Language (a1, a2)
instance (Comorph a1 b1 c1 d1 e1, Comorph a2 b2 c2 d2 e2)
=> Comorph (a1, a2) b1 c1 d2 e2
 end of module
ghc6.4 (or ghc6.4.1) complains with:
Context.hs:11:0:
Could not deduce (Comorph a2 b2 c21 d2 e21, Comorph
a1 b1 c11 d1 e11)
from the context (Comorph a1 b1 c1 d1 e1, Comorph
a2 b2 c2 d2 e2)
arising from the superclasses of an instance
declaration at
Context.hs:11:0
Probable fix:
add (Comorph a2 b2 c21 d2 e21, Comorph a1 b1 c11
d1 e11)
to the instance declaration superclass context
In the instance declaration for `Comorph (a1, a2)
b1 c1 d2 e2'
If I replace the first instance with
"instance (Language a1, Language a2) => Language (a1, a2)"
then ghc6.4 is happy.
Cheers Christian
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.4 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedInvalid 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"unjustified deduction error","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedInvalid","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\n(also sent to glasgowhaskellusers) maeder@tzi.de\n\nthe following (reduced) example used to go through with\nghc6.2.2 but fails with ghc6.4. \n\nThis seems to be a  low priority  bug. (hugs accepts\nthis module.)\nI compile with:\n\nghc fglasgowexts Context.hs\n\n\nmodule Context where\n\nclass Language a\nclass Language a => Logic a b  a > b\nclass (Language a, Logic b c, Logic d e)\n => Comorph a b c d e  a > b, a > d\n\ninstance (Comorph a1 b1 c1 d1 e1, Comorph a2 b2 c2 d2 e2)\n => Language (a1, a2)\n\ninstance (Comorph a1 b1 c1 d1 e1, Comorph a2 b2 c2 d2 e2)\n => Comorph (a1, a2) b1 c1 d2 e2\n\n end of module\n\nghc6.4 (or ghc6.4.1) complains with:\n\nContext.hs:11:0:\n Could not deduce (Comorph a2 b2 c21 d2 e21, Comorph\na1 b1 c11 d1 e11)\n from the context (Comorph a1 b1 c1 d1 e1, Comorph\na2 b2 c2 d2 e2)\n arising from the superclasses of an instance\ndeclaration at\nContext.hs:11:0\n Probable fix:\n add (Comorph a2 b2 c21 d2 e21, Comorph a1 b1 c11\nd1 e11)\n to the instance declaration superclass context\n In the instance declaration for `Comorph (a1, a2)\nb1 c1 d2 e2'\n\n\nIf I replace the first instance with\n\"instance (Language a1, Language a2) => Language (a1, a2)\"\nthen ghc6.4 is happy.\n\nCheers Christian\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/385Kind error has wrong line20190707T19:18:13ZnobodyKind error has wrong line```
With the attached test file (t.hs) I get the following
result:

cptchaos@motion2 ~ $ ghci6.4 fglasgowexts t.hs
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / /   GHC Interactive, versi...```
With the attached test file (t.hs) I get the following
result:

cptchaos@motion2 ~ $ ghci6.4 fglasgowexts t.hs
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / /   GHC Interactive, version
6.4, for Haskell 98.
/ /_\\/ __ / /___  http://www.haskell.org/ghc/
\____/\/ /_/\____/_ Type :? for help.
Loading package base1.0 ... linking ... done.
Compiling Main ( t.hs, interpreted )
t.hs:4:0:
Couldn't match kind `* > *' against `*'
In the class declaration for `IOMatrixIf'
Failed, modules loaded: none.
Prelude>

but line 4 is correct (it is in fact an example from
the userguide)
 example file: t.hs
module Main where
class IOMatrixIf (iomat :: * > *) b where
iomatrix_new :: Int > Int > IO (iomat b)
 ^ creates a matrix with random values ( just mem.
allocation)
iomatrix_rows :: (iomat b) > Int
iomatrix_cols :: (iomat b) > Int
iomatrix_read_elem :: (iomat b) > Int > Int > IO b
iomatrix_write_elem :: (iomat b) > Int > Int > b
> IO ()
hello = "foo"  junk code may be some lines
 here is the kind error
type IOMatrix matRep = IOMatrixIf matRep b => (IO matRep)
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.4 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"Kind error has wrong line","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\n\nWith the attached test file (t.hs) I get the following\nresult:\n\n\ncptchaos@motion2 ~ $ ghci6.4 fglasgowexts t.hs\n ___ ___ _\n / _ \\ /\\ /\\/ __(_)\n / /_\\// /_/ / /   GHC Interactive, version\n6.4, for Haskell 98.\n/ /_\\\\/ __ / /___  http://www.haskell.org/ghc/\n\\____/\\/ /_/\\____/_ Type :? for help.\n\nLoading package base1.0 ... linking ... done.\nCompiling Main ( t.hs, interpreted )\n\nt.hs:4:0:\n Couldn't match kind `* > *' against `*'\n In the class declaration for `IOMatrixIf'\nFailed, modules loaded: none.\nPrelude>\n\n\n\nbut line 4 is correct (it is in fact an example from\nthe userguide)\n\n example file: t.hs\nmodule Main where\n\nclass IOMatrixIf (iomat :: * > *) b where\n iomatrix_new :: Int > Int > IO (iomat b)\n  ^ creates a matrix with random values ( just mem.\nallocation)\n iomatrix_rows :: (iomat b) > Int\n iomatrix_cols :: (iomat b) > Int\n iomatrix_read_elem :: (iomat b) > Int > Int > IO b\n iomatrix_write_elem :: (iomat b) > Int > Int > b\n> IO ()\n\n\nhello = \"foo\"  junk code may be some lines\n\n\n here is the kind error \ntype IOMatrix matRep = IOMatrixIf matRep b => (IO matRep)\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/384internal compiler error: the `impossible' happened20190707T19:18:13Zasamoilovinternal compiler error: the `impossible' happened```
Dear Haskellers,
I've got the following error message during
compilation of the attached Signal.hs file with ghc 6.4
and 6.5.
ghc c Signal.hs
ghc6.4: panic! (the `impossible' happened, GHC version
6.4):
types/Type.lhs:(11...```
Dear Haskellers,
I've got the following error message during
compilation of the attached Signal.hs file with ghc 6.4
and 6.5.
ghc c Signal.hs
ghc6.4: panic! (the `impossible' happened, GHC version
6.4):
types/Type.lhs:(1107,0)(1108,77):
Nonexhaustive patterns in function zip_ty_env
Please report it as a compiler bug to
glasgowhaskellbugs@haskell.org,
or http://sourceforge.net/projects/ghc/.
I spent some time stripping the file to only several
lines :)
Best regards
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.4 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"internal compiler error: the `impossible' happened","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nDear Haskellers,\n\nI've got the following error message during\ncompilation of the attached Signal.hs file with ghc 6.4\nand 6.5.\n\nghc c Signal.hs\nghc6.4: panic! (the `impossible' happened, GHC version\n6.4):\n types/Type.lhs:(1107,0)(1108,77):\nNonexhaustive patterns in function zip_ty_env\n \n \nPlease report it as a compiler bug to\nglasgowhaskellbugs@haskell.org,\nor http://sourceforge.net/projects/ghc/.\n\nI spent some time stripping the file to only several\nlines :)\n\nBest regards\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/345GADT  fundep interaction20190707T19:18:23ZbringGADT  fundep interaction```
GADTs and fundeps don't seem to interact in the way
that I (perhaps naively) expect. I expected that for
each case, the type variables would be instantiated
according to the type of the constructors, and then the
fundep would be used...```
GADTs and fundeps don't seem to interact in the way
that I (perhaps naively) expect. I expected that for
each case, the type variables would be instantiated
according to the type of the constructors, and then the
fundep would be used to figure out the result type.
{# OPTIONS_GHC fglasgowexts #}
data Succ n
data Zero
class Plus x y z  x y > z
instance Plus Zero x x
instance Plus x y z => Plus (Succ x) y (Succ z)
infixr 5 :::
data List :: * > * > * where
Nil :: List a Zero
(:::) :: a > List a n > List a (Succ n)
append :: Plus x y z => List a x > List a y > List a z
append Nil ys = ys
append (x ::: xs) ys = x ::: append xs ys
{
GHC 6.4 says:
Couldn't match the rigid variable `y' against `Succ z'
`y' is bound by the type signature for `append'
Expected type: List a y
Inferred type: List a (Succ z)
In the expression: x ::: (append xs ys)
In the definition of `append': append (x ::: xs) ys
= x ::: (append xs ys)
}
```Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc//issues/323Exponential behaviour with type synonyms20190707T19:18:28ZSimon Peyton JonesExponential behaviour with type synonyms```
You're quite right. GHC has a simple but non
performant representation of type synonyms in types, so
as to be able to generate good error messages, In
particular, the type
S t
where S is a type synonym defined by 'type S a = ...```
You're quite right. GHC has a simple but non
performant representation of type synonyms in types, so
as to be able to generate good error messages, In
particular, the type
S t
where S is a type synonym defined by 'type S a = s', is
represented as
SynNote (S t) (s [t/a])
That is, (S t) is represented by *both* its unexpanded
and expanded form.
The SynNote is ignored by unification, but the un
expanded form is useful for error messages.
Unfortunately, t is duplicated, as you can see, and that
leads to the behaviour you describe.
I don't see myself fixing this soon, at least partly
because I can't see an obvious way to fix it that doesn't
lose error message behaviour.
I'm going to open a SourceForge bug for it. If anyone
has good ideas, let me know.
Simon
 Original Message
 From: glasgowhaskellbugsbounces@haskell.org
[mailto:glasgowhaskellbugs
 bounces@haskell.org] On Behalf Of Iavor Diatchki
 Sent: 17 February 2005 01:27
 To: glasgowhaskellbugs@haskell.org
 Subject: 'type' declarations

 hello,
 ghc seems to be having trouble with 'type' declarations.
 while compiling (i guess kind checking is the correct
word here)
 the following program for a very long time, ghc (6.2)
runs out of 300Mb of heap.

 module Test where

 type S = Maybe
 type S2 n = S (S n)
 type S4 n = S2 (S2 n)
 type S8 n = S4 (S4 n)
 type S16 n = S8 (S8 n)
 type S32 n = S16 (S16 n)

 type N64 n = S32 (S32 n)

 type N64' =
 S ( S ( S ( S ( S ( S ( S ( S (
 S ( S ( S ( S ( S ( S ( S ( S (
 S ( S ( S ( S ( S ( S ( S ( S (
 S ( S ( S ( S ( S ( S ( S ( S (
 S ( S ( S ( S ( S ( S ( S ( S (
 S ( S ( S ( S ( S ( S ( S ( S (
 S ( S ( S ( S ( S ( S ( S ( S (
 S ( S ( S ( S ( S ( S ( S ( S (
 Int
 ))))))))
 ))))))))
 ))))))))
 ))))))))
 ))))))))
 ))))))))
 ))))))))
 ))))))))

 if i remove the N64 definition things work. i guess
something
 exponential is happening
 (substitution?).

 iavor
```Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc//issues/312Poor error message for kind error20190707T19:18:31ZSimon Peyton JonesPoor error message for kind error```
A kind error can lead to the following poor error msg:
tcfail132.hs:30:51:
Kind error: Expecting kind `k_a18s > k_a18w >
k_a18A > *',
but `DUnit t' has kind `k_a18s >
k_a18w > *'
In the type synonym declaration for ...```
A kind error can lead to the following poor error msg:
tcfail132.hs:30:51:
Kind error: Expecting kind `k_a18s > k_a18w >
k_a18A > *',
but `DUnit t' has kind `k_a18s >
k_a18w > *'
In the type synonym declaration for `LiftObject'
The source program is
newtype Object f' f t o1 o2 = Object (f' t o1 > f t o2)
type DUnit t o1 o2 = ()
type T f g t o1 o2 = Either (f t o1 o2) (g t o1 o2)
type LiftObject t f' f = T (Object f' f t) (DUnit t)
```Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc//issues/310Data.Generics type error20190707T19:18:32ZnobodyData.Generics type error```
I get a strange type error when using
Data.Generics.Twins  but if I include the text of the
definition in my own file it works!
I attach two files, one type checks, one does not. The
only difference is that I move a definition betw...```
I get a strange type error when using
Data.Generics.Twins  but if I include the text of the
definition in my own file it works!
I attach two files, one type checks, one does not. The
only difference is that I move a definition between
modules.
/Patrik
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.4 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"Data.Generics type error","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nI get a strange type error when using\nData.Generics.Twins  but if I include the text of the\ndefinition in my own file it works!\n\nI attach two files, one type checks, one does not. The\nonly difference is that I move a definition between\nmodules.\n\n/Patrik\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/304ghc hangs during compilation20190707T19:18:33Znobodyghc hangs during compilation```
The following code causes both ghc6.4.20050209 and
ghc6.2.2 to hang during compilation.
newtype S = S { unS :: S > S }
y :: S > S
y (S f) = g (S g) where g h = f (unS h h)
Thomas Jäger <ThJaeger@gmail.com>
```
<details><summ...```
The following code causes both ghc6.4.20050209 and
ghc6.2.2 to hang during compilation.
newtype S = S { unS :: S > S }
y :: S > S
y (S f) = g (S g) where g h = f (unS h h)
Thomas Jäger <ThJaeger@gmail.com>
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  None 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedNoReason 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"ghc hangs during compilation","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedNoReason","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe following code causes both ghc6.4.20050209 and\nghc6.2.2 to hang during compilation.\n\nnewtype S = S { unS :: S > S }\n\ny :: S > S\ny (S f) = g (S g) where g h = f (unS h h)\n\n\nThomas Jäger <ThJaeger@gmail.com>\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/303Rebindable syntax doesn't work as advertised20190707T19:18:33ZnobodyRebindable syntax doesn't work as advertised```

 According to section 7.3.5. Rebindable syntax in the
user's manual
 this should work (unless I totally misunderstood it).
 It doesn't.

 Compile with fnoimplicitprelude

 Lennart

import Prelude hiding(Mon...```

 According to section 7.3.5. Rebindable syntax in the
user's manual
 this should work (unless I totally misunderstood it).
 It doesn't.

 Compile with fnoimplicitprelude

 Lennart

import Prelude hiding(Monad(..))
class B a where
b :: a
instance B Bool where
b = False
class M m where
return :: a > m a
(>>=) :: (B a) => m a > (a > m b) > m b
(>>) :: (B a) => m a > m b > m b
fail :: String > m a
p >> q = p >>= \ _ > q
fail s = error s
instance M Maybe where
return x = Just x
(>>=) = error "bind"
test :: Maybe Bool
test = do
x < return True
return (x && x)
unJust (Just x) = x
main = print (unJust test)
```nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/214ghc "panic"  typecheck/TcRnTypes.lhs:23320190707T19:19:07Zfergusghc "panic"  typecheck/TcRnTypes.lhs:233```
I got a ghc "panic" when trying to compile some code
which made use of .hiboot files. The exact panic
message was
ghc6.0.1: panic! (the `impossible' happened, GHC
version 6.0.1):
typecheck/TcRnTypes.lhs:233: Missing field...```
I got a ghc "panic" when trying to compile some code
which made use of .hiboot files. The exact panic
message was
ghc6.0.1: panic! (the `impossible' happened, GHC
version 6.0.1):
typecheck/TcRnTypes.lhs:233: Missing field in
record construction TcRnTypes.top_errs
This was on a RedHat 8.0 Linux system,
with the following version of ghc:
Glasgow Haskell Compiler, Version 6.0.1, for Haskell
98, compiled by GHC version 6.0
I apologize for the incompleteness of this bug report,
but unfortunately the source code which triggered this
bug is proprietary, so I can't include it here. Sorry!
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.0.1 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"ghc \"panic\"  typecheck/TcRnTypes.lhs:233","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"simonpj"},"version":"6.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nI got a ghc \"panic\" when trying to compile some code\nwhich made use of .hiboot files. The exact panic\nmessage was\n\nghc6.0.1: panic! (the `impossible' happened, GHC\nversion 6.0.1):\n typecheck/TcRnTypes.lhs:233: Missing field in\nrecord construction TcRnTypes.top_errs\n\nThis was on a RedHat 8.0 Linux system,\nwith the following version of ghc:\nGlasgow Haskell Compiler, Version 6.0.1, for Haskell\n98, compiled by GHC version 6.0\n\nI apologize for the incompleteness of this bug report,\nbut unfortunately the source code which triggered this\nbug is proprietary, so I can't include it here. Sorry!\n}}}","type_of_failure":"OtherFailure","blocking":[]} >Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc//issues/189Malformed Predicate w/ Template Haskell20190707T19:19:13ZjcastMalformed Predicate w/ Template Haskell```
The following two modules:
 Cut 
module ScratchTemplates where
import Language.Haskell.THSyntax
newtype Interaction a = Interaction a deriving Show
ret = Interaction
instance Monad Interaction where
return = Interactio...```
The following two modules:
 Cut 
module ScratchTemplates where
import Language.Haskell.THSyntax
newtype Interaction a = Interaction a deriving Show
ret = Interaction
instance Monad Interaction where
return = Interaction
Interaction x >>= f = f x
instance Functor Interaction where
fmap f x = x >>= return . f
interactionT t = tcon (TconName "Interaction") `tapp` t
class Flatten a b  a > b where
flatten :: a > b
flattenT :: TypQ > TypQ > TypQ
flattenT t t' = tvar "Flatten" `tapp` t `tapp` t
baseType t = sequence [
inst (return []) (flattenT t t)
[val (pvar "flatten") (normal (var "id")) []],
inst (return []) (flattenT (interactionT t)
(interactionT t))
[val (pvar "flatten") (normal (var "id")) []]]
instance Flatten a b =>
Flatten (Interaction (Interaction a))
(Interaction b) where
flatten a = a >>= id >>= return . flatten
module Main where
import Monad
import ScratchTemplates
import Language.Haskell.THSyntax
$(baseType (tcon (Tuple 0)))
instance Flatten String String where
flatten a = a
instance Flatten (Interaction String) (Interaction
String) where
flatten a = a
instance Flatten b c => Combine String b (String, c) where
combine a b = liftM2 (,) a (fmap flatten b)
instance Flatten Int Int where
flatten a = a
class Combine a b c  a b > c where
combine :: Interaction a > Interaction b >
Interaction c
instance Combine () b b where
combine a b = b
instance Flatten b c => Combine Int b (Int, c) where
combine a b = do
x < a
y < fmap flatten b
return (x, y)
instance (Flatten b c, Combine a c d) =>
Flatten (Interaction a, Interaction b)
(Interaction d) where
flatten (a, b) = combine a (fmap flatten b)
main = main
 Cut here 
loaded into ghci fglasgowexts produce the following
error message:
Compiling ScratchTemplates ( ScratchTemplates.hs,
interpreted )
Compiling Main ( scratch.hs, interpreted )
ghc6.0.1: panic! (the `impossible' happened, GHC
version 6.0.1):
Malformed predicate
Please report it as a compiler bug to
glasgowhaskellbugs@haskell.org,
or http://sourceforge.net/projects/ghc/.
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.0.1 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"Malformed Predicate w/ Template Haskell","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe following two modules:\n\n  Cut \n\nmodule ScratchTemplates where\n\nimport Language.Haskell.THSyntax\n\nnewtype Interaction a = Interaction a deriving Show\n\nret = Interaction\n\ninstance Monad Interaction where\n return = Interaction\n Interaction x >>= f = f x\n\ninstance Functor Interaction where\n fmap f x = x >>= return . f\n\ninteractionT t = tcon (TconName \"Interaction\") `tapp` t\n\nclass Flatten a b  a > b where\n flatten :: a > b\n\nflattenT :: TypQ > TypQ > TypQ\nflattenT t t' = tvar \"Flatten\" `tapp` t `tapp` t\n\nbaseType t = sequence [\n inst (return []) (flattenT t t)\n [val (pvar \"flatten\") (normal (var \"id\")) []],\n inst (return []) (flattenT (interactionT t)\n(interactionT t))\n [val (pvar \"flatten\") (normal (var \"id\")) []]]\n\ninstance Flatten a b =>\n Flatten (Interaction (Interaction a))\n(Interaction b) where\n flatten a = a >>= id >>= return . flatten\n\nmodule Main where\n\nimport Monad\nimport ScratchTemplates\nimport Language.Haskell.THSyntax\n\n$(baseType (tcon (Tuple 0)))\n\ninstance Flatten String String where\n flatten a = a\n\ninstance Flatten (Interaction String) (Interaction\nString) where\n flatten a = a\n\ninstance Flatten b c => Combine String b (String, c) where\n combine a b = liftM2 (,) a (fmap flatten b)\n\ninstance Flatten Int Int where\n flatten a = a\n\nclass Combine a b c  a b > c where\n combine :: Interaction a > Interaction b >\nInteraction c\n\ninstance Combine () b b where\n combine a b = b\n\ninstance Flatten b c => Combine Int b (Int, c) where\n combine a b = do\n x < a\n y < fmap flatten b\n return (x, y)\n\ninstance (Flatten b c, Combine a c d) =>\n Flatten (Interaction a, Interaction b)\n(Interaction d) where\n flatten (a, b) = combine a (fmap flatten b)\n\nmain = main\n\n  Cut here \n\nloaded into ghci fglasgowexts produce the following\nerror message:\n\nCompiling ScratchTemplates ( ScratchTemplates.hs,\ninterpreted )\nCompiling Main ( scratch.hs, interpreted )\nghc6.0.1: panic! (the `impossible' happened, GHC\nversion 6.0.1):\n\tMalformed predicate\n\nPlease report it as a compiler bug to\nglasgowhaskellbugs@haskell.org,\nor http://sourceforge.net/projects/ghc/.\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobodyhttps://gitlab.haskell.org/ghc/ghc//issues/154mutiparameter classes problem20190707T19:19:22Znobodymutiparameter classes problem```
hello,
i have run into something that looks like a bug in ghc 6.0.
here is an example:
> module A where
> class C a b where f :: a > b
> g x = fst (f x)
for this program hugs reports that "g" has an ambiguous
type:
C a (b,c) => ...```
hello,
i have run into something that looks like a bug in ghc 6.0.
here is an example:
> module A where
> class C a b where f :: a > b
> g x = fst (f x)
for this program hugs reports that "g" has an ambiguous
type:
C a (b,c) => a > b
which seems reasonable.
however ghc does not report an error, and infers the
following type:
C a (b, ()) => a > b
(i have changed the formatting for easier comparing).
it seems that somehow the second component of the tuple
became (),
but i don't see why.
bye
iavor
```
<details><summary>Trac metadata</summary>
 Trac field  Value 
    
 Version  6.0 
 Type  Bug 
 TypeOfFailure  OtherFailure 
 Priority  normal 
 Resolution  ResolvedFixed 
 Component  Compiler (Type checker) 
 Test case  
 Differential revisions  
 BlockedBy  
 Related  
 Blocking  
 CC  
 Operating system  
 Architecture  
</details>
<! {"blocked_by":[],"summary":"mutiparameter classes problem","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.0","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nhello,\ni have run into something that looks like a bug in ghc 6.0.\nhere is an example:\n\n> module A where\n> class C a b where f :: a > b\n> g x = fst (f x)\n\nfor this program hugs reports that \"g\" has an ambiguous\ntype:\n C a (b,c) => a > b\nwhich seems reasonable.\nhowever ghc does not report an error, and infers the\nfollowing type:\n C a (b, ()) => a > b\n(i have changed the formatting for easier comparing).\nit seems that somehow the second component of the tuple\nbecame (),\nbut i don't see why.\n\nbye\niavor\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} >nobodynobody