11module SqlSquared.Path
2- ( AnyFilePath
3- , AnyDirPath
4- , parseAnyFilePath
2+ ( parseAnyFilePath
53 , printAnyFilePath
64 , parseAnyDirPath
75 , printAnyDirPath
86 , genAnyFilePath
97 , genAnyDirPath
8+ , module PathyTypeReexprts
109 ) where
1110
1211import Prelude
@@ -15,46 +14,45 @@ import Control.Monad.Gen as Gen
1514import Control.Monad.Rec.Class (class MonadRec )
1615import Data.Either as E
1716import Data.NonEmpty ((:|))
18- import Pathy (posixParser , posixPrinter )
1917import Pathy as Pt
18+ import Pathy (AnyDir , AnyFile ) as PathyTypeReexprts
19+ import Pathy (AnyDir , AnyFile )
2020import Pathy.Gen as PtGen
2121import SqlSquared.Utils ((∘))
2222
23- type AnyDirPath = E.Either Pt.AbsDir Pt.RelDir
24- type AnyFilePath = E.Either Pt.AbsFile Pt.RelFile
2523
26- printAnyDirPath :: AnyDirPath -> String
24+ printAnyDirPath :: AnyDir -> String
2725printAnyDirPath = E .either
28- (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
29- (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
26+ (Pt .sandboxAny >>> Pt .unsafePrintPath Pt . posixPrinter)
27+ (Pt .sandboxAny >>> Pt .unsafePrintPath Pt . posixPrinter)
3028
31- parseAnyDirPath :: forall m . Applicative m => (forall a . String -> m a ) -> String -> m AnyDirPath
32- parseAnyDirPath fail = Pt .parsePath posixParser
29+ parseAnyDirPath :: forall m . Applicative m => (forall a . String -> m a ) -> String -> m AnyDir
30+ parseAnyDirPath fail = Pt .parsePath Pt . posixParser
3331 (pure ∘ E.Right )
3432 (pure ∘ E.Left )
3533 (const $ fail " Expected a directory path" )
3634 (const $ fail " Expected a directory path" )
3735 (fail " Expected valid path" )
3836
39- printAnyFilePath :: AnyFilePath -> String
37+ printAnyFilePath :: AnyFile -> String
4038printAnyFilePath = E .either
41- (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
42- (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
39+ (Pt .sandboxAny >>> Pt .unsafePrintPath Pt . posixPrinter)
40+ (Pt .sandboxAny >>> Pt .unsafePrintPath Pt . posixPrinter)
4341
44- parseAnyFilePath :: forall m . Applicative m => (forall a . String -> m a ) -> String -> m AnyFilePath
45- parseAnyFilePath fail = Pt .parsePath posixParser
42+ parseAnyFilePath :: forall m . Applicative m => (forall a . String -> m a ) -> String -> m AnyFile
43+ parseAnyFilePath fail = Pt .parsePath Pt . posixParser
4644 (const $ fail " Expected a file path" )
4745 (const $ fail " Expected a file path" )
4846 (pure ∘ E.Right )
4947 (pure ∘ E.Left )
5048 (fail " Expected valid path" )
5149
52- genAnyFilePath :: forall m . Gen.MonadGen m => MonadRec m => m AnyFilePath
50+ genAnyFilePath :: forall m . Gen.MonadGen m => MonadRec m => m AnyFile
5351genAnyFilePath = Gen .oneOf
5452 $ (E.Left <$> PtGen .genAbsFilePath)
5553 :| [E.Right <$> PtGen .genRelFilePath]
5654
57- genAnyDirPath :: forall m . Gen.MonadGen m => MonadRec m => m AnyDirPath
55+ genAnyDirPath :: forall m . Gen.MonadGen m => MonadRec m => m AnyDir
5856genAnyDirPath = Gen .oneOf
5957 $ (E.Left <$> PtGen .genAbsDirPath)
6058 :| [E.Right <$> PtGen .genRelDirPath]
0 commit comments