Skip to content

"ASSERT failed" with quantified constraints

{-# 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
>
Trac metadata
Trac field Value
Version 8.6.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information