git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge branch 'master' into pure11
e28f17bAndy Arvanitis
psc-package/Main.hs+23
@@ -181,6 +181,14 @@ install pkgName = do
181 writePackageFile pkg'
181 writePackageFile pkg'
182 echo "psc-package.json file was updated"
182 echo "psc-package.json file was updated"
183
183
184+uninstall :: String -> IO ()
185+uninstall pkgName = do
186+ pkg <- readPackageFile
187+ let pkg' = pkg { depends = filter (/= pack pkgName) $ depends pkg }
188+ updateImpl pkg'
189+ writePackageFile pkg'
190+ echo "psc-package.json file was updated"
191+
184listDependencies :: IO ()
192listDependencies :: IO ()
185listDependencies = do
193listDependencies = do
186 pkg@PackageConfig{ depends } <- readPackageFile
194 pkg@PackageConfig{ depends } <- readPackageFile
@@ -188,6 +196,15 @@ listDependencies = do
188 trans <- getTransitiveDeps db depends
196 trans <- getTransitiveDeps db depends
189 traverse_ (echo . fst) trans
197 traverse_ (echo . fst) trans
190
198
199+listPackages :: IO ()
200+listPackages = do
201+ pkg <- readPackageFile
202+ db <- readPackageSet pkg
203+ traverse_ echo (fmt <$> Map.assocs db)
204+ where
205+ fmt :: (Text, PackageInfo) -> Text
206+ fmt (name, PackageInfo{ version }) = name <> " (" <> version <> ")"
207+
191getSourcePaths :: PackageConfig -> PackageSet -> [Text] -> IO [Turtle.FilePath]
208getSourcePaths :: PackageConfig -> PackageSet -> [Text] -> IO [Turtle.FilePath]
192getSourcePaths PackageConfig{..} db pkgNames = do
209getSourcePaths PackageConfig{..} db pkgNames = do
193 trans <- getTransitiveDeps db pkgNames
210 trans <- getTransitiveDeps db pkgNames
@@ -240,6 +257,9 @@ main = do
240 , Opts.command "update"
257 , Opts.command "update"
241 (Opts.info (pure update)
258 (Opts.info (pure update)
242 (Opts.progDesc "Update dependencies"))
259 (Opts.progDesc "Update dependencies"))
260+ , Opts.command "uninstall"
261+ (Opts.info (uninstall <$> pkg)
262+ (Opts.progDesc "Uninstall the named package"))
243 , Opts.command "install"
263 , Opts.command "install"
244 (Opts.info (install <$> pkg)
264 (Opts.info (install <$> pkg)
245 (Opts.progDesc "Install the named package"))
265 (Opts.progDesc "Install the named package"))
@@ -252,6 +272,9 @@ main = do
252 , Opts.command "sources"
272 , Opts.command "sources"
253 (Opts.info (pure listSourcePaths)
273 (Opts.info (pure listSourcePaths)
254 (Opts.progDesc "List all (active) source paths for dependencies"))
274 (Opts.progDesc "List all (active) source paths for dependencies"))
275+ , Opts.command "available"
276+ (Opts.info (pure listPackages)
277+ (Opts.progDesc "List all packages available in the package set"))
255 ]
278 ]
256 where
279 where
257 pkg = Opts.strArgument $
280 pkg = Opts.strArgument $
src/Language/PureScript/Errors.hs+1−1
@@ -640,7 +640,7 @@ prettyPrintSingleError (PPEOptions codeColor full level showWiki) e = flip evalS
640 go _ = False
640 go _ = False
641 renderSimpleErrorMessage (AmbiguousTypeVariables t _) =
641 renderSimpleErrorMessage (AmbiguousTypeVariables t _) =
642 paras [ line "The inferred type"
642 paras [ line "The inferred type"
643− , indent $ line $ markCode $ prettyPrintType t
643+ , markCodeBox $ indent $ typeAsBox t
644 , line "has type variables which are not mentioned in the body of the type. Consider adding a type annotation."
644 , line "has type variables which are not mentioned in the body of the type. Consider adding a type annotation."
645 ]
645 ]
646 renderSimpleErrorMessage (PossiblyInfiniteInstance nm ts) =
646 renderSimpleErrorMessage (PossiblyInfiniteInstance nm ts) =
src/Language/PureScript/Parser/Declarations.hs+2−2
@@ -392,7 +392,7 @@ parseLet = do
392 return $ Let ds result
392 return $ Let ds result
393
393
394parseValueAtom :: TokenParser Expr
394parseValueAtom :: TokenParser Expr
395−parseValueAtom = P.choice
395+parseValueAtom = withSourceSpan PositionedValue $ P.choice
396 [ parseAnonymousArgument
396 [ parseAnonymousArgument
397 , Literal <$> parseNumericLiteral
397 , Literal <$> parseNumericLiteral
398 , Literal <$> parseCharLiteral
398 , Literal <$> parseCharLiteral
@@ -418,7 +418,7 @@ parseValueAtom = P.choice
418parseInfixExpr :: TokenParser Expr
418parseInfixExpr :: TokenParser Expr
419parseInfixExpr
419parseInfixExpr
420 = P.between tick tick parseValue
420 = P.between tick tick parseValue
421− <|> Op <$> parseQualified parseOperator
421+ <|> withSourceSpan PositionedValue (Op <$> parseQualified parseOperator)
422
422
423parseHole :: TokenParser Expr
423parseHole :: TokenParser Expr
424parseHole = Hole <$> holeLit
424parseHole = Hole <$> holeLit
src/Language/PureScript/Sugar/Operators/Expr.hs+3−1
@@ -20,7 +20,9 @@ matchExprOperators = matchOperators isBinOp extractOp fromOp reapply modOpTable
20 isBinOp _ = False
20 isBinOp _ = False
21
21
22 extractOp :: Expr -> Maybe (Expr, Expr, Expr)
22 extractOp :: Expr -> Maybe (Expr, Expr, Expr)
23− extractOp (BinaryNoParens op l r) = Just (op, l, r)
23+ extractOp (BinaryNoParens op l r)
24+ | PositionedValue _ _ op' <- op = Just (op', l, r)
25+ | otherwise = Just (op, l, r)
24 extractOp _ = Nothing
26 extractOp _ = Nothing
25
27
26 fromOp :: Expr -> Maybe (Qualified (OpName 'ValueOpName))
28 fromOp :: Expr -> Maybe (Qualified (OpName 'ValueOpName))