summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/T16981A.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/codeGen/should_run/T16981A.hs')
-rw-r--r--testsuite/tests/codeGen/should_run/T16981A.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/T16981A.hs b/testsuite/tests/codeGen/should_run/T16981A.hs
new file mode 100644
index 0000000000..a61a42bd7d
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T16981A.hs
@@ -0,0 +1,30 @@
+-- Lib.hs
+{-# LANGUAGE StaticPointers #-}
+
+module T16981A where
+
+import GHC.StaticPtr
+
+class UniqueHash a where
+ hash :: a -> String
+
+{-# NOINLINE unCacheable #-}
+unCacheable :: Cacheable a -> a
+unCacheable (CExplicit _ a) = a
+
+data Cacheable a = CExplicit String a
+
+instance UniqueHash (StaticPtr a) where
+ hash ptr = show $ staticKey ptr
+
+instance IsStatic Cacheable where
+ fromStaticPtr ptr = CExplicit h a where
+ h = hash ptr
+ a = deRefStaticPtr ptr
+
+k = static 1
+
+{-# NOINLINE splitInjectedAsWindowed #-}
+splitInjectedAsWindowed :: Int
+-- WindowedDataset
+splitInjectedAsWindowed = unCacheable $ k