diff --git a/message-index/messages/GHC-12219/index.md b/message-index/messages/GHC-12219/index.md new file mode 100644 index 00000000..f827db65 --- /dev/null +++ b/message-index/messages/GHC-12219/index.md @@ -0,0 +1,15 @@ +--- +title: static forms cannot be used in splices +summary: Static forms are disallowed in splices +severity: error +introduced: 9.6.1 +--- + +``` +static.hs:7:45: error: [GHC-12219] + • static forms cannot be used in splices: static 'a' + • In the untyped splice: $(lift (show $ staticKey $ static 'a')) +``` + +GHC does not support using a static form in a splice, i.e. obtaining a reference +to a `StaticPtr` at compile time diff --git a/message-index/messages/GHC-12219/staticsplice/after/StaticSplice.hs b/message-index/messages/GHC-12219/staticsplice/after/StaticSplice.hs new file mode 100644 index 00000000..cc53685b --- /dev/null +++ b/message-index/messages/GHC-12219/staticsplice/after/StaticSplice.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE StaticPointers #-} +{-# LANGUAGE TemplateHaskell #-} +module StaticSplice where + +import GHC.StaticPtr +import Language.Haskell.TH.Syntax + +main = print $([| show $ staticKey $ static 'a' |]) + + diff --git a/message-index/messages/GHC-12219/staticsplice/before/StaticSplice.hs b/message-index/messages/GHC-12219/staticsplice/before/StaticSplice.hs new file mode 100644 index 00000000..e30f607b --- /dev/null +++ b/message-index/messages/GHC-12219/staticsplice/before/StaticSplice.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StaticPointers #-} +{-# LANGUAGE TemplateHaskell #-} + +module StaticSplice where + +import GHC.StaticPtr +import Language.Haskell.TH.Syntax + +main = print =<< $(lift (show $ staticKey $ static 'a') ) diff --git a/message-index/messages/GHC-12219/staticsplice/index.md b/message-index/messages/GHC-12219/staticsplice/index.md new file mode 100644 index 00000000..81ba242f --- /dev/null +++ b/message-index/messages/GHC-12219/staticsplice/index.md @@ -0,0 +1,9 @@ +--- +title: GHC does not support defining static pointers in splices +--- + +You can't use a static forms in a splice - i.e. you can't obtain a `StaticPtr` +in code that runs at compile time. + +Evaluating a quote that has a static form is not a problem, since this is code +that will be evaluated at run time.