diff options
Diffstat (limited to 'testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun03.hs')
-rw-r--r-- | testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun03.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun03.hs b/testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun03.hs new file mode 100644 index 0000000000..a854d7ae07 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun03.hs @@ -0,0 +1,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 |