[GHC] #15962: Type family & typeclass interaction suppresses errors

#15962: Type family & typeclass interaction suppresses errors -------------------------------------+------------------------------------- Reporter: madgen | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: ⊥ Component: Compiler | Version: 8.4.3 (Type checker) | Keywords: type family, | Operating System: Unknown/Multiple typeclass, error message | Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following program despite having a hole and an undefined variable `iDontExist` *quietly* fails to compile on 8.4.3 and 8.4.4. It produces errors as expected on 8.6.1 and 8.6.2. By quietly failing, I mean it fails on CLI but without producing any error messages and in GHCI. It just says "Failed, no modules loaded." {{{#!hs {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} module Bug where import Data.Kind (Type) type Exp a = a -> Type type family Eval (e :: Exp a) :: a data OpKind = Conjunction data Dual (k :: OpKind) :: Exp OpKind data Map :: (a -> Exp b) -> [ a ] -> Exp [ b ] type instance Eval (Map f (a ': as)) = Eval (f a) ': Eval (Map f as) data Big :: [ OpKind ] -> Type where Big :: [ Big ks ] -> Big ('Conjunction ': ks) dualBig :: Big ks -> Big (Eval (Map Dual ks)) dualBig = _ instance Semigroup (Big a) where Big xs <> Big ys = Big (xs <> ys) instance Monoid (Big ('Conjunction ': ks)) where mempty = iDontExist flatten :: Monoid (Big ks) => Big (k ': k ': ks) -> Big ks flatten = undefined }}} Sorry, the example is a bit big but almost any change causes the errors to appear again including the `Monoid` constraint on `flatten`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15962 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15962: Type family & typeclass interaction suppresses errors -------------------------------------+------------------------------------- Reporter: madgen | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: ⊥ Component: Compiler (Type | Version: 8.4.3 checker) | Keywords: TypedHoles, Resolution: | newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: type family, typeclass, error message => TypedHoles, newcomer Comment: Interesting program. It's conceivable that this was fixed by Tritlo's recent work on typed holes (possibly commit 39de4e3d33dd9879398062620ad00b1e3b8481ce, although I haven't confirmed this). It //is// fixed now though, thankfully. In any case, I can't recall having a test case quite like this one (the test case from #15321, which the aforementioned commit fixed, requires Template Haskell), so it might be nice to add this as a test case as well. Any volunteers? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15962#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15962: Type family & typeclass interaction suppresses errors
-------------------------------------+-------------------------------------
Reporter: madgen | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: ⊥
Component: Compiler (Type | Version: 8.4.3
checker) | Keywords: TypedHoles,
Resolution: | newcomer
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
error/warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#15962: Type family & typeclass interaction suppresses errors -------------------------------------+------------------------------------- Reporter: madgen | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler (Type | Version: 8.4.3 checker) | Keywords: TypedHoles, Resolution: fixed | newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: error/warning at compile-time | typecheck/should_fail/T15962 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => typecheck/should_fail/T15962 * status: new => closed * resolution: => fixed * milestone: ⊥ => 8.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15962#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC