[Git][ghc/ghc][master] Add a test for #18585

Marge Bot gitlab at gitlab.haskell.org
Tue Aug 25 11:38:59 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
8426a136 by Krzysztof Gogolewski at 2020-08-25T07:38:54-04:00
Add a test for #18585

- - - - -


2 changed files:

- + testsuite/tests/typecheck/should_compile/T18585.hs
- testsuite/tests/typecheck/should_compile/all.T


Changes:

=====================================
testsuite/tests/typecheck/should_compile/T18585.hs
=====================================
@@ -0,0 +1,48 @@
+{-# Language DataKinds #-}
+{-# Language FlexibleContexts #-}
+{-# Language PolyKinds #-}
+{-# Language StandaloneKindSignatures #-}
+{-# Language TypeFamilyDependencies #-}
+{-# Language UndecidableInstances #-}
+{-# Language UndecidableSuperClasses #-}
+module T18585 (Functor(..)) where
+
+import Data.Kind (Type)
+import Prelude hiding (Functor(..))
+
+type Cat i = i -> i -> Type
+
+class
+  ( Op (Op k) ~ k
+  , Category (Op k)
+  ) => Category (k :: Cat i) where
+  type Op k :: i -> i -> Type
+  type Op k = Y k
+
+newtype Y k a b = Y (k b a)
+
+instance (Category k, Op k ~ Y k) => Category (Y k) where
+  type Op (Y k) = k
+
+instance Category (->)
+
+type SelfDom :: (i -> j) -> Cat i -> Cat i
+type family SelfDom (f :: i -> j) (k :: Cat i) :: Cat i where
+  SelfDom p p = Op p
+  SelfDom f p = p
+
+type family DefaultCat (i :: Type) = (res :: Cat i) | res -> i
+type instance DefaultCat Type = (->)
+
+class
+  ( Category (Dom f)
+  , Category (Cod f)
+  ) => Functor (f :: i -> j) where
+
+  type Dom f :: Cat i
+  type Dom (f :: i -> j) = SelfDom f (DefaultCat i)
+
+  type Cod f :: Cat j
+  type Cod (f :: i -> j) = DefaultCat j
+
+instance Functor IO


=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -721,4 +721,5 @@ test('T18118', normal, multimod_compile, ['T18118', '-v0'])
 test('T18412', normal, compile, [''])
 test('T18470', normal, compile, [''])
 test('T18323', normal, compile, [''])
+test('T18585', normal, compile, [''])
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8426a1364ba450fe48fc41a95b2ba76c8d1bb7c8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8426a1364ba450fe48fc41a95b2ba76c8d1bb7c8
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200825/de0955a8/attachment-0001.html>


More information about the ghc-commits mailing list