HORIZON HASKELLDocsmaster5ff592b2026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · master · 5ff592b · 2026-10-19

Modulehackage-security-0.6.4.0

Hackage.Security.Client.Verify

  • 1 type
  • 4 values
methodliftIO :: IO a -> m a
#

Lift a computation from the IO monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. IO is the base monad for the stack).

Example
import Control.Monad.Trans.State -- from the "transformers" library

printState :: Show s => StateT s IO ()
printState = do
  state <- get
  liftIO $ print state

Had we omitted liftIO, we would have ended up with this error:

• Couldn't match type ‘IO’ with ‘StateT s IO’
 Expected type: StateT s IO ()
   Actual type: IO ()

The important part here is the mismatch between StateT s IO () and IO ().

Luckily, we know of a function that takes an IO a and returns an (m a): liftIO, enabling us to run the program and see the expected results:

> evalStateT printState "hello"
"hello"

> evalStateT printState 3
3
newtypenewtype Verify a
#
Instances4Monad, Functor, Applicative, MonadIO
  • Monad VerifyDefined in hackage-security-0.6.4.0 · Hackage.Security.Client.Verify
  • Functor VerifyDefined in hackage-security-0.6.4.0 · Hackage.Security.Client.Verify
  • Applicative VerifyDefined in hackage-security-0.6.4.0 · Hackage.Security.Client.Verify
  • MonadIO VerifyDefined in hackage-security-0.6.4.0 · Hackage.Security.Client.Verify