summaryrefslogtreecommitdiff
path: root/testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun03.hs
blob: a854d7ae07b7677ebd608f3f4ace12709da1fb9c (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