diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/TcStaticPointers02.hs')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/TcStaticPointers02.hs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/TcStaticPointers02.hs b/testsuite/tests/typecheck/should_compile/TcStaticPointers02.hs new file mode 100644 index 0000000000..9b51aeedfe --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/TcStaticPointers02.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE StaticPointers #-} + +module StaticPointers02 where + +import GHC.StaticPtr +import Data.Typeable + +f2 :: Typeable a => StaticPtr (a -> a) +f2 = static id + +f3 :: StaticPtr (Char -> Int) +f3 = static method + +f4 :: Typeable a => StaticPtr (T a -> a) +f4 = static t_field + +g :: Int -> Int +g = id + +f5 :: Typeable a => StaticPtr (a -> a) +f5 = static (id . id) + +f6 :: Typeable a => StaticPtr (a -> IO a) +f6 = static return + +f7 :: Typeable a => StaticPtr (a -> IO a) +f7 = static (\x -> getLine >> return x) + +data T a = T { t_field :: a } + deriving Typeable + +class C a where + method :: a -> Int + +instance C Char where + method = const 0 |