importify-1.0: Tool for haskell imports refactoring

Safe HaskellNone
LanguageHaskell2010

Importify.Path

Contents

Description

This module contains common utilities for working with importify cache.

Synopsis

Predefined directories

extensionsPath :: Path Rel File Source #

Path to JSON-encoded Map from target to its list of default extensions.

modulesPath :: Path Rel File Source #

Path to file that stores mapping from module names to their packages.

testDataPath :: Path Rel Dir Source #

Path to golden tests.

Utility functions to work with files and directories

decodeFileOrMempty Source #

Arguments

:: (FromJSON t, Monoid m, MonadIO f) 
=> Path b File

Path to json data

-> (t -> f m)

Action from decoded value

-> f m 

Tries to read file and then decode it. If either of two phases fails then mempty returned and warning is printed to console.

doInsideDir :: (MonadIO m, MonadMask m) => Path Abs Dir -> m a -> m a Source #

Create given directory and perform given action inside it.

findCabalFile :: MonadIO m => Path Abs Dir -> m $ (Maybe $ Path Abs File) Source #

Returns relative path to cabal file under given directory.

lookupToRoot :: (Path Abs Dir -> IO Bool) -> Path Rel File -> IO (Maybe (Path Abs Dir, Path Rel File)) Source #

Walk up till root while unpure predicate is False. Returns absolute path to directory where predicate is True and suffix of current directory prepended to given file.