packages feed

polysemy-path 0.0.1.0 → 0.1.0.0

raw patch · 3 files changed

+71/−32 lines, 3 filesdep +polysemy-extradep −polysemy-zoo

Dependencies added: polysemy-extra

Dependencies removed: polysemy-zoo

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for polysemy-path +## v0.1.0.0++* Make functions sign `PathException` rather than `SomeException`.+ ## v0.0.1.0  * Add polysemy versions of parsing functions and `stripProperPrefix`.
polysemy-path.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           polysemy-path-version:        0.0.1.0+version:        0.1.0.0 synopsis:       Polysemy versions of Path functions. category:       Polysemy author:         Daniel Firth@@ -29,10 +29,11 @@       Paths_polysemy_path   hs-source-dirs:       src+  ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints   build-depends:       base >=4.7 && <5     , path     , polysemy+    , polysemy-extra >=0.1.7.0 && <0.2.0.0     , polysemy-plugin-    , polysemy-zoo   default-language: Haskell2010
src/Polysemy/Path.hs view
@@ -1,40 +1,74 @@-{-# LANGUAGE BlockArguments #-}-{-# LANGUAGE DataKinds      #-}-{-# LANGUAGE GADTs          #-}-{-# LANGUAGE PolyKinds      #-}+{-|+Module      : Polysemy.Path+License     : MIT+Maintainer  : dan.firth@homotopic.tech+Stability   : experimental++Polysemy versions of functions in the path library.+-}+{-# LANGUAGE DataKinds           #-}+{-# LANGUAGE GADTs               #-}+{-# LANGUAGE PolyKinds           #-} {-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}-module Polysemy.Path where -import Control.Monad-import Path+module Polysemy.Path (+  Path+, Rel+, Abs+, File+, Dir+, PathException+, parseRelFile+, parseAbsFile+, parseRelDir+, parseAbsDir+, stripProperPrefix+) where++import qualified Path+import Path (Path, Rel, Abs, File, Dir, PathException) import Polysemy-import Polysemy.ConstraintAbsorber.MonadCatch import Polysemy.Error---parseRelFile' :: Members '[Error SomeException] r-              => FilePath-              -> Sem r (Path Rel File)-parseRelFile' x = absorbMonadThrow (try . parseRelFile $ x) >>= either throw return--parseAbsFile' :: Members '[Error SomeException] r-              => FilePath-              -> Sem r (Path Abs File)-parseAbsFile' x = absorbMonadThrow (try . parseAbsFile $ x) >>= either throw return+import Polysemy.Extra -parseRelDir' :: Members '[Error SomeException] r+-- | Polysemy version of `Path.parseRelFile`.+--+-- @since 0.1.0.0+parseRelFile :: Members '[Error PathException] r              => FilePath-             -> Sem r (Path Rel Dir)-parseRelDir' x = absorbMonadThrow (try . parseRelDir $ x) >>= either throw return+             -> Sem r (Path Rel File)+parseRelFile x = irrefutableAbsorbThrow (Path.parseRelFile x) -parseAbsDir' :: Members '[Error SomeException] r+-- | Polysemy version of `Path.parseAbsFile`.+--+-- @since 0.1.0.0+parseAbsFile :: Members '[Error PathException] r              => FilePath-             -> Sem r (Path Abs Dir)-parseAbsDir' x = absorbMonadThrow (try . parseAbsDir $ x) >>= either throw return+             -> Sem r (Path Abs File)+parseAbsFile x = irrefutableAbsorbThrow (Path.parseAbsFile x) -stripProperPrefix' :: Members '[Error SomeException] r-                   => Path b Dir-                   -> Path b t-                   -> Sem r (Path Rel t)-stripProperPrefix' x y = absorbMonadThrow (try $ stripProperPrefix x y) >>= either throw return+-- | Polysemy version of `Path.parseRelDir`.+--+-- @since 0.1.0.0+parseRelDir :: Members '[Error PathException] r+            => FilePath+            -> Sem r (Path Rel Dir)+parseRelDir x = irrefutableAbsorbThrow (Path.parseRelDir x)++-- | Polysemy version of `Path.parseAbsDir`.+--+-- @since 0.1.0.0+parseAbsDir :: Members '[Error PathException] r+            => FilePath+            -> Sem r (Path Abs Dir)+parseAbsDir x = irrefutableAbsorbThrow (Path.parseAbsDir x)++-- | Polysemy version of `Path.stripProperPrefix`.+--+-- @since 0.1.0.0+stripProperPrefix :: Members '[Error PathException] r+                  => Path b Dir+                  -> Path b t+                  -> Sem r (Path Rel t)+stripProperPrefix x y = irrefutableAbsorbThrow (Path.stripProperPrefix x y)