summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/T11342/T11342f.hs
blob: ad59191fb18fd7a9acbcef7483cb8000aee2bdf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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"