ide-backend-common-0.10.0: Shared library used be ide-backend and ide-backend-server

Safe HaskellNone
LanguageHaskell2010

IdeSession.Util

Contents

Synopsis

Misc util

showExWithClass :: SomeException -> String Source

Show an exception together with its most precise type tag.

accessorName :: String -> Maybe String Source

Translate record field _name to the accessor name

lookup' :: Eq a => a -> Accessor [(a, b)] (Maybe b) Source

Prelude.lookup as an accessor

writeFileAtomic :: FilePath -> ByteString -> IO MD5Digest Source

Writes a file atomically.

The file is either written successfully or an IO exception is raised and the original file is left unchanged.

On windows it is not possible to delete a file that is open by a process. This case will give an IO exception but the atomic property is not affected.

Returns the hash of the file; we are careful not to force the entire input bytestring into memory (we compute the hash as we write the file).

setupEnv :: [(String, String)] -> [(String, Maybe String)] -> IO () Source

First restore the environment to the specified initial environment, then apply the given overrides

ignoreDoesNotExist :: IO () -> IO () Source

Ignore "does not exist" exception

interruptible :: IO a -> IO a Source

Define interruptiple operations

(TODO: Stick in reference to blog post)

Simple diffs

data Diff a Source

Constructors

Keep 
Remove 
Insert a 

Instances

Functor Diff 
Show a => Show (Diff a) 
Generic (Diff a) 
Binary a => Binary (Diff a) 
PrettyVal a => PrettyVal (Diff a) 
type Rep (Diff a) 

applyMapDiff :: forall k v. Ord k => Strict (Map k) (Diff v) -> Strict (Map k) v -> Strict (Map k) v Source

Manipulating stdout and stderr

swizzleStdout :: Fd -> IO a -> IO a Source

swizzleStderr :: Fd -> IO a -> IO a Source