packages feed

relude-1.2.1.0 / src / Relude / Lifted.hs

{-# LANGUAGE Safe #-}{- |Module                  : Relude.LiftedCopyright               : (c) 2016 Stephen Diehl                          (c) 2016-2018 Serokell                          (c) 2018-2023 KowainikSPDX-License-Identifier : MITMaintainer              : Kowainik <xrom.xkov@gmail.com>Stability               : StablePortability             : PortableLifted versions of base functions.These functions are lifted in a sense that you can use them inside variousmonad transformers without adding 'Relude.liftIO' calls explicitly. However, you stillcan use all these functions inside plain 'Relude.IO' monad as usual.=== Example==== @base@With the @base@ function, you can easily work with these functions in the'Relude.IO' monad:@__main__ :: 'Relude.IO' ()__main__ = __do__    x <- 'Data.Text.getLine'    'Prelude.print' x@However, to work in 'Relude.MonadIO' you already need to "lift" them:@__main__ :: 'Relude.MonadIO' m => m ()__main__ = __do__    x <- 'Relude.liftIO' 'Data.Text.getLine'    'Relude.liftIO' ('Prelude.print' x)@==== @relude@In the meantime, @relude@ provides these function that can work in 'Relude.IO'the same way:@__main__ :: 'Relude.IO' ()__main__ = __do__    x <- 'getLine'    'print' x@But also allows you to work in the 'Relude.MonadIO' monads more easily:@__main__ :: 'Relude.MonadIO' m => m ()__main__ = __do__    x <- 'getLine'    'print' x@-}module Relude.Lifted    ( module Relude.Lifted.Concurrent      -- $concurrent    , module Relude.Lifted.IORef      -- $ioref    , module Relude.Lifted.Exit      -- $exit    , module Relude.Lifted.File      -- $file    , module Relude.Lifted.Terminal      -- $terminal    , module Relude.Lifted.Handle      -- $handle    , module Relude.Lifted.Env      -- $env    ) whereimport Relude.Lifted.Concurrentimport Relude.Lifted.Exitimport Relude.Lifted.Fileimport Relude.Lifted.IORefimport Relude.Lifted.Terminalimport Relude.Lifted.Handleimport Relude.Lifted.Env{- $concurrentLifted 'MVar' and 'STM' functions.-}{- $exitLifted versions of functions that work with exit processes.-}{- $fileLifted versions of functions working with files and common 'Relude.IO'.-}{- $iorefLifted reexports from "Data.IORef" module.-}{- $terminalLifted functions to work with stdin and stdout.-}{- $handleLifted functions to work with 'Relude.Base.IO' 'Handle's.-}{- $envLifted functions to work with system environment.-}