Skip to content

Renamer hangs (because of -XInstanceSigs?)

{-# Language RankNTypes, TypeInType, EmptyCase, GADTs, FlexibleInstances, ConstraintKinds, UndecidableInstances, AllowAmbiguousTypes, InstanceSigs, ScopedTypeVariables #-}

import Data.Kind
import Data.Proxy

type Cat ob = ob -> ob -> Type

data Struct :: (k -> Constraint) -> Type where
  S :: Proxy (a::k) -> Struct (cls::k -> Constraint)

type Structured a cls = (S ('Proxy :: Proxy a)::Struct cls)

data AStruct :: Struct cls -> Type where
  AStruct :: cls a => AStruct (Structured a cls)

class StructI (structured::Struct (cls :: k -> Constraint)) where
  struct :: AStruct structured

instance (Structured xx cls ~ structured, cls xx) => StructI structured where
  struct :: AStruct (Structured xx cls)
  struct = AStruct

data Hom :: Cat k -> Cat (Struct cls) where

class Category (cat::Cat ob) where
  i :: StructI a => ríki a a

instance Category ríki => Category (Hom ríki :: Cat (Struct cls)) where
  -- Commenting out this instance signature makes the issue go away
  i :: forall a. StructI a => Hom ríki a a
  i = case struct :: AStruct (Structured a cls) of

Running on 8.2.1 and 8.5.20180105 both loop until interrupted

$ ghci -ignore-dot-ghci 199.hs
GHCi, version 8.5.20180105: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( 199.hs, interpreted )
^CInterrupted.
> 
>
Edited by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information