-
Notifications
You must be signed in to change notification settings - Fork 7
Conversation
src/Quasar/Advanced/Paths.purs
Outdated
@@ -2,7 +2,7 @@ | |||
Copyright 2017 SlamData, Inc. | |||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); | |||
you may not use this file_ except in compliance with the License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops_ 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find and replace :d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️, plus it looks like there is a compilation failure in the build now.
src/Quasar/Advanced/Types.purs
Outdated
|
||
parseGroup ∷ String → Either String GroupPath | ||
parseGroup string = | ||
Str.stripPrefix (Str.Pattern "group:") string | ||
# maybe (Left "Incorrect group") pure | ||
# note "Incorrect group" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change these "Incorrect " messages to "Could not parse " instead, while we're in here. We don't want a user to end up seeing these messages as they are, as it sounds like they're doing something wrong, when it's not at all something they have control over.
src/Quasar/Data/URI.purs
Outdated
type QURIRefOptions = URI.URIRefOptions URI.UserPassInfo QURIHost AbsPath AbsPath AnyPath QQuery URI.Fragment | ||
|
||
type QURI = URI.URI URI.UserPassInfo QURIHost AbsPath AbsPath QQuery URI.Fragment | ||
type QURIOptions = URI.URIOptions URI.UserPassInfo QURIHost AbsPath AbsPath QQuery URI.Fragment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't align things with whitespace 😄
src/Quasar/Mount/MongoDB.purs
Outdated
@@ -54,59 +49,52 @@ instance showAuth ∷ Show Auth where | |||
"(Auth { path: " <> show path <> ", credentials: " <> show credentials <> " })" | |||
|
|||
type Config = | |||
{ hosts ∷ NonEmpty Array Host | |||
{ hosts ∷ URI.QURIHost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect now; mongo URIs will need a separate options setup / type configuration, since they're allowed to have multiple hosts. The Data.URI.Extra.MultiHostPortPair
is for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's. QURIHost
type QURIHost = URI.MultiHostPortPair URI.Host URI.Port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, it's the opposite problem then - every other URI should not support multiple hosts 😄 (it only did that before because we couldn't express otherwise with the types).
URI.HierarchicalPartAuth | ||
authority' | ||
(Just (bimap (path </> _) (path </> _) relPath)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit hard to read, maybe we could extract it out into another where function and use it like toHierPart authority (Just (bimap (path </> _) (path </> _) relPath))
src/Quasar/Types.purs
Outdated
|
||
type AnyPath = AbsPath | ||
type DirPath = Path Abs Dir | ||
type FilePath = Path Abs File |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we add these to pathy in the end?
src/Quasar/Data/URI.purs
Outdated
printScheme = Scheme.print | ||
|
||
unsafeSchemaFromString :: String -> URI.Scheme | ||
unsafeSchemaFromString = Scheme.unsafeFromString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be "Scheme" not "Schema" 😄
src/Quasar/Data/URI.purs
Outdated
qRelativeRef ∷ PrintParse QRelativeRef | ||
qRelativeRef = { print: RelativeRef.print opts.relativeRef, parser: RelativeRef.parser opts.relativeRef } | ||
qURIRef ∷ PrintParse QURIRef | ||
qURIRef = { print: URIRef.print opts.uriRef, parser: URIRef.parser opts.uriRef } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe could define these as purescript-codec
definitions instead?
also reuse AbsPath generator from pathy
fromJSON parent json | ||
= Mount <$> Mount.fromJSON parent json | ||
<|> do | ||
obj ← decodeJson json | ||
name ← obj .? "name" | ||
name' ← note "empty name" <<< fromString =<< (obj .? "name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this, since there can be a mount at /
(which will have no name, understandably). I'll try and concoct a test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine actually, it's just for file listings, so everything must indeed have a name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks 👍, just a few comments/ideas. I can help do those if you'd like to continue on updating SD.
src/Quasar/Mount/Common/Gen.purs
Outdated
Just a, Just b -> Just $ Both a b | ||
Just a, Nothing -> Just $ This a | ||
Nothing, Just b -> Just $ That b | ||
Nothing, Nothing -> Nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple'a unicode bits here and in the type, and in some other places in the PR.
src/Quasar/Mount/Couchbase.purs
Outdated
] <> maybe [] (pure <<< Tuple "queryTimeoutSeconds" <<< Just <<< show <<< un Seconds) queryTimeout | ||
|
||
fromURI ∷ URI.QAbsoluteURI → Either String Config | ||
fromURI (URI.AbsoluteURI scheme (URI.HierarchicalPartNoAuth path) query) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could switch this (and any other like it) to a case _ of
while we're here perhaps?
= maybe (Left "Couldn't sandbox") Right | ||
<<< parseDirPath | ||
= note "Couldn't parse absolute dir path" | ||
<<< parseQDirPath | ||
<=< (_ .? "connectionUri") | ||
<=< (_ .? "mimir") | ||
<=< decodeJson |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these could be changed to just purescript-codec-argonaut
JsonCodec
s now we have the dependency too, actually.
There are quite a good amount of things which need to be update in SD, so let's do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build is failing at the moment, but looks like it's probably just a test that needs updating.
src/Quasar/Mount/Common/Gen.purs
Outdated
genAlphaNumericNEString = cons <$> genAlphaNumericChar <*> SG.genString genAlphaNumericChar | ||
|
||
genAlphaNumericChar ∷ ∀ m. MonadGen m ⇒ MonadRec m ⇒ m Char | ||
genAlphaNumericChar = Gen.oneOf $ CG.genDigitChar :| [CG.genAlpha] | ||
|
||
genHostURI ∷ ∀ m. MonadGen m ⇒ MonadRec m ⇒ m URI.Host | ||
genHostURI = Gen.oneOf $ genIPv4 :| [genName] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a URI.Host.Gen.genHost
we can use for this now.
src/Quasar/Mount/Couchbase.purs
Outdated
(case NES.fromString bucketName of | ||
Nothing → Just $ Left P.rootDir | ||
Just n → Just $ Right $ P.rootDir </> P.file' (Name n) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need parens around the case here I think.
src/Quasar/Mount/Common/Gen.purs
Outdated
Just a, Just b → Just $ Both a b | ||
Just a, Nothing → Just $ This a | ||
Nothing, Just b → Just $ That b | ||
Nothing, Nothing → Nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the one of these I just added to purescript-these
now 😄 (sorry)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But please hold off on merging until #103 is sorted out
Oh, I guess we need to merge/release the dependencies too. |
We should wait until pr in SD passes |
It compiles but tests are failing, I guess I missed something in *Path print parse functions.