diff options
Diffstat (limited to 'testsuite/tests/indexed-types/should_fail/T14369.hs')
-rw-r--r-- | testsuite/tests/indexed-types/should_fail/T14369.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T14369.hs b/testsuite/tests/indexed-types/should_fail/T14369.hs new file mode 100644 index 0000000000..ef5166c318 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T14369.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilyDependencies #-} +{-# LANGUAGE DataKinds, PolyKinds #-} +{-# LANGUAGE TypeOperators #-} +module T14369 where + +data family Sing (a :: k) + +data instance Sing (z :: Maybe a) where + SNothing :: Sing Nothing + SJust :: Sing x -> Sing (Just x) + +class SingKind k where + type Demote k = r | r -> k + fromSing :: Sing (a :: k) -> Demote k + +instance SingKind a => SingKind (Maybe a) where + type Demote (Maybe a) = Maybe (Demote a) + fromSing SNothing = Nothing + fromSing (SJust x) = Just (fromSing x) + +f :: forall (x :: forall a. Maybe a) a. SingKind a => Sing x -> Maybe (Demote a) +f = fromSing |