Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 08ed0e9

Browse files
committed
use AnyDir and AnyFile from pathy
1 parent 6ac85cb commit 08ed0e9

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

src/SqlSquared/Path.purs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
module 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

1211
import Prelude
@@ -15,46 +14,45 @@ import Control.Monad.Gen as Gen
1514
import Control.Monad.Rec.Class (class MonadRec)
1615
import Data.Either as E
1716
import Data.NonEmpty ((:|))
18-
import Pathy (posixParser, posixPrinter)
1917
import Pathy as Pt
18+
import Pathy (AnyDir, AnyFile) as PathyTypeReexprts
19+
import Pathy (AnyDir, AnyFile)
2020
import Pathy.Gen as PtGen
2121
import 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
2725
printAnyDirPath = 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
4038
printAnyFilePath = 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
5351
genAnyFilePath = 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
5856
genAnyDirPath = Gen.oneOf
5957
$ (E.Left <$> PtGen.genAbsDirPath)
6058
:| [E.Right <$> PtGen.genRelDirPath]

src/SqlSquared/Signature.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ data SqlF literal a
140140
| Parens a
141141

142142
data SqlDeclF a
143-
= Import Pt.AnyDirPath
143+
= Import Pt.AnyDir
144144
| FunctionDecl (FunctionDeclR a)
145145

146146
newtype SqlModuleF a =

src/SqlSquared/Signature/Relation.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type VariRelR =
3636
}
3737

3838
type TableRelR =
39-
{ path Pt.AnyFilePath
39+
{ path Pt.AnyFile
4040
, alias Maybe String
4141
}
4242

0 commit comments

Comments
 (0)