#15943 closed bug (fixed)

"ASSERT failed" with quantified constraints

Reported by: Iceland_jack Owned by:
Priority: normal Milestone: 8.6.3
Component: Compiler Version: 8.6.2
Keywords: QuantifiedConstraints Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

{-# Language RankNTypes             #-}
{-# Language DataKinds              #-}
{-# Language KindSignatures         #-}
{-# Language PolyKinds              #-}
{-# Language TypeFamilyDependencies #-}
{-# Language GADTs                  #-}
{-# Language TypeSynonymInstances   #-}
{-# Language FlexibleInstances      #-}
{-# Language QuantifiedConstraints  #-}

import Data.Type.Equality
import Data.Coerce
import Data.Type.Coercion
import Data.Kind

newtype WrapFalse a b = WrapFalse (Hom False a b)
newtype WrapTrue  a b = WrapTrue  (Hom True  a b)

class
  (forall (x :: ob) (y :: ob). Coercible (WrapFalse x y) (WrapTrue y x))
  =>
  Ríki ob where

  type Hom (or::Bool) = (res :: ob -> ob -> Type) | res -> or

instance Ríki Type where
  type Hom False = (->)
  type Hom True  = Op

newtype Op :: Type -> Type -> Type where
  Op :: (b -> a) -> Op a b
$ ghc-stage2 --interactive -ignore-dot-ghci 740_bug.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( 740_bug.hs, interpreted )
*** Exception: ASSERT failed! file compiler/typecheck/TcFlatten.hs, line 1288
>

Change History (4)

comment:1 Changed 10 months ago by Iceland_jack

It works if we replace (->) with the representationally equal Fun

newtype Fun a b = Fun (a -> b)

instance Ríki Type where
  type Hom False = Fun
  type Hom True  = Op

comment:2 Changed 10 months ago by simonpj

Seems ok with HEAD, happily. Do you agree?

comment:3 Changed 10 months ago by Simon Peyton Jones <simonpj@…>

In 1235ca95/ghc:

Test Trac #15943

This test seems to work in HEAD

comment:4 Changed 10 months ago by simonpj

Resolution: fixed
Status: newclosed

I'm going to declare this fixed. In an ideal world I'd track down the original cause, but life is short.

Note: See TracTickets for help on using tickets.