can't do a reify in the IO monad

In Haskell, the reify function is used to introspect and examine the structure of a type at compile-time. However, since reify operates on type-level information, it cannot be directly used in the IO monad.

The IO monad in Haskell is used for performing actions with side effects, such as reading from or writing to files, interacting with the user, or performing network operations. These actions are inherently impure and cannot be evaluated at compile-time.

If you need to use reify in the IO monad, you can do so indirectly by using the unsafePerformIO function. This function allows you to perform an IO action within a pure context, but it should be used with caution as it can lead to unexpected behavior if misused.

Here's an example of how you can use unsafePerformIO to perform reify in the IO monad:

import System.IO.Unsafe
import Language.Haskell.TH

reifyIO :: Name -> IO Info
reifyIO name = unsafePerformIO $ reify name

main :: IO ()
main = do
  let info = reifyIO 'someFunction
  -- Use the `info` value here
  putStrLn $ show info

In this example, we define a function reifyIO that takes a Name and returns an IO Info. Inside this function, we use unsafePerformIO to perform the reify action. The result is then returned as a pure value.

Please note that using unsafePerformIO should be done with caution, as it bypasses the type system and can lead to unexpected behavior if used incorrectly. It's generally recommended to avoid using unsafePerformIO whenever possible and instead design your code in a way that separates pure and impure operations.