system-lifted

Lifted versions of System functions. https://github.com/jcristovao/system-lifted

Latest on Hackage:0.2.0.1

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by João Cristóvão

system-lifted

Lifted versions of Haskell System functions.

While haskell promotes the use of `Maybe and Either` as smart ways of dealing with errors, I found that the support for their Monad Transformers counter-parts is less than stellar.

While some packages like Errors simplify this, they still add a lot of boilerplate to the code.

The goal of this project started out as a way to write cleaner directory related code in either one of the error related monad transformers, namely `EitherT, ErrorT or MaybeT (non-determinism and ListT` are not yet supported).

This is achieved through typeclasses, and thus, by simply declaring some simple template haskell at the start of a file:

type EitherIOText       = EitherT Text

deriveSystemLiftedErrors "DisallowIOE [HardwareFault]" ''EitherIOText
deriveSystemDirectory   ''EitherIOText

One could then write code like this:

getXdgConfigFolder :: EitherT IOException IO FilePath
getXdgConfigFolder = isRW =<< getEnv "XDG_CONFIG_HOME"

Currently the `System.Directory and System.Environment are fully supported, and there is partial support for System.Unix.Users`.

More examples and wider `System.` support is planned. Contribuitions are welcomed.

comments powered byDisqus