diff options
Diffstat (limited to 'testsuite/tests/typecheck/T11342/T11342f.hs')
-rw-r--r-- | testsuite/tests/typecheck/T11342/T11342f.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/T11342/T11342f.hs b/testsuite/tests/typecheck/T11342/T11342f.hs new file mode 100644 index 0000000000..ad59191fb1 --- /dev/null +++ b/testsuite/tests/typecheck/T11342/T11342f.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE RankNTypes #-} + +module T11342f where + +import Data.Proxy +import GHC.TypeLits + +f :: forall str a b. (KnownChar a, KnownSymbol b, ConsSymbol a b ~ str) => (Char, String) +f = (charVal @a Proxy, symbolVal @b Proxy) + +f' :: (Char, String) +f' = f @"hello" + +g :: forall str. (KnownSymbol str, UnconsSymbol str ~ 'Nothing) => String +g = symbolVal @str Proxy + +h :: forall a tail str. (KnownSymbol tail, KnownChar a, UnconsSymbol str ~ 'Just '(a, tail) ) => (Char, String) +h = (charVal @a Proxy, symbolVal @tail Proxy) + +h' :: (Char, String) +h' = h @'h' @"ello" |