diff options
Diffstat (limited to 'testsuite/tests/indexed-types/should_fail/T15870.hs')
-rw-r--r-- | testsuite/tests/indexed-types/should_fail/T15870.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T15870.hs b/testsuite/tests/indexed-types/should_fail/T15870.hs new file mode 100644 index 0000000000..0a07c3e5e5 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T15870.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + +module T15870 where + +data Optic a where + --Index :: Nat -> Optic a + --Name :: Symbol -> Optic a + (:.:) :: Optic a -> Optic b -> Optic a -- composition + +class Gettable a (optic :: Optic a) where + type Get a (optic :: Optic a) + +{- +some basic instances, e.g. +instance Gettable (a,b) (Index 0) where + type Get (a,b) (Index 0) = a +... +-} + +instance forall a b (g1 :: Optic a) (g2 :: Optic b). + ( Gettable a g1 + , b ~ Get a g1 + , Gettable b g2 + ) => Gettable a (g1 :.: g2) where + type Get a (g1 :.: g2) = Get a g2 |