@@ -10,43 +10,51 @@ module SqlSquared.Path
1010 ) where
1111
1212import Prelude
13- import Data.Either as E
14- import Data.NonEmpty ((:|))
15- import Data.Path.Pathy as Pt
16- import Data.Path.Pathy.Gen as PtGen
13+
1714import Control.Monad.Gen as Gen
1815import Control.Monad.Rec.Class (class MonadRec )
16+ import Data.Either as E
17+ import Data.NonEmpty ((:|))
18+ import Pathy (posixParser , posixPrinter )
19+ import Pathy as Pt
20+ import Pathy.Gen as PtGen
1921import SqlSquared.Utils ((∘))
2022
21- type AnyDirPath = E.Either ( Pt.AbsDir Pt.Unsandboxed ) ( Pt. RelDir Pt.Unsandboxed )
22- type AnyFilePath = E.Either ( Pt.AbsFile Pt.Unsandboxed ) ( Pt. RelFile Pt.Unsandboxed )
23+ type AnyDirPath = E.Either Pt.AbsDir Pt.RelDir
24+ type AnyFilePath = E.Either Pt.AbsFile Pt.RelFile
2325
2426printAnyDirPath :: AnyDirPath -> String
25- printAnyDirPath = E .either Pt .unsafePrintPath Pt .unsafePrintPath
27+ printAnyDirPath = E .either
28+ (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
29+ (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
2630
2731parseAnyDirPath :: forall m . Applicative m => (forall a . String -> m a ) -> String -> m AnyDirPath
28- parseAnyDirPath fail = Pt .parsePath
32+ parseAnyDirPath fail = Pt .parsePath posixParser
2933 (pure ∘ E.Right )
3034 (pure ∘ E.Left )
3135 (const $ fail " Expected a directory path" )
3236 (const $ fail " Expected a directory path" )
37+ (fail " Expected valid path" )
3338
3439printAnyFilePath :: AnyFilePath -> String
35- printAnyFilePath = E .either Pt .unsafePrintPath Pt .unsafePrintPath
40+ printAnyFilePath = E .either
41+ (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
42+ (Pt .sandboxAny >>> Pt .unsafePrintPath posixPrinter)
3643
3744parseAnyFilePath :: forall m . Applicative m => (forall a . String -> m a ) -> String -> m AnyFilePath
38- parseAnyFilePath fail = Pt .parsePath
45+ parseAnyFilePath fail = Pt .parsePath posixParser
3946 (const $ fail " Expected a file path" )
4047 (const $ fail " Expected a file path" )
4148 (pure ∘ E.Right )
4249 (pure ∘ E.Left )
50+ (fail " Expected valid path" )
4351
4452genAnyFilePath :: forall m . Gen.MonadGen m => MonadRec m => m AnyFilePath
4553genAnyFilePath = Gen .oneOf
46- $ (E.Left ∘ Pt .unsandbox <$> PtGen .genAbsFilePath)
47- :| [E.Right ∘ Pt .unsandbox <$> PtGen .genRelFilePath]
54+ $ (E.Left <$> PtGen .genAbsFilePath)
55+ :| [E.Right <$> PtGen .genRelFilePath]
4856
4957genAnyDirPath :: forall m . Gen.MonadGen m => MonadRec m => m AnyDirPath
5058genAnyDirPath = Gen .oneOf
51- $ (E.Left ∘ Pt .unsandbox <$> PtGen .genAbsDirPath)
52- :| [E.Right ∘ Pt .unsandbox <$> PtGen .genRelDirPath]
59+ $ (E.Left <$> PtGen .genAbsDirPath)
60+ :| [E.Right <$> PtGen .genRelDirPath]
0 commit comments