Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
741da00c
by Ben Gamari at 2025-11-12T03:38:20-05:00
1 changed file:
Changes:
| ... | ... | @@ -904,8 +904,17 @@ addModFinalizer act = Q (qAddModFinalizer (unQ act)) |
| 904 | 904 | addCorePlugin :: String -> Q ()
|
| 905 | 905 | addCorePlugin plugin = Q (qAddCorePlugin plugin)
|
| 906 | 906 | |
| 907 | --- | Get state from the 'Q' monad. Note that the state is local to the
|
|
| 908 | --- Haskell module in which the Template Haskell expression is executed.
|
|
| 907 | +-- | Get state from the 'Q' monad. The state maintained by 'Q' is isomorphic to
|
|
| 908 | +-- a type-indexed finite map. That is,
|
|
| 909 | +--
|
|
| 910 | +-- @
|
|
| 911 | +-- do putQ @Int 42
|
|
| 912 | +-- putQ @Char 'a'
|
|
| 913 | +-- getQ @Int -- == (Just 42)
|
|
| 914 | +-- @
|
|
| 915 | +--
|
|
| 916 | +-- Note that the state is local to the Haskell module in which the Template
|
|
| 917 | +-- Haskell expression is executed.
|
|
| 909 | 918 | getQ :: Typeable a => Q (Maybe a)
|
| 910 | 919 | getQ = Q qGetQ
|
| 911 | 920 |