blob: f84a3802f54aa97717c5e819cc68cdcbd9bf1ad4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-- Using overloaded labels as strings, slightly pointlessly
{-# LANGUAGE OverloadedLabels
, DataKinds
, FlexibleContexts
, FlexibleInstances
, MultiParamTypeClasses
, ScopedTypeVariables
, TypeFamilies
, TypeSynonymInstances
#-}
import GHC.OverloadedLabels
import Data.Proxy ( Proxy(..) )
import GHC.TypeLits ( KnownSymbol, symbolVal )
instance (KnownSymbol x, c ~ Char) => IsLabel x [c] where
fromLabel = symbolVal (Proxy :: Proxy x)
main = do putStrLn #x
print $ #x ++ #y
|