git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add explicit import of Monoid <> (#2278)
bdbf4e2Charles O'Farrell
CONTRIBUTORS.md+1
@@ -16,6 +16,7 @@ This file lists the contributors to the PureScript compiler project, and the ter
16- [@Bogdanp](https://github.com/Bogdanp) (Bogdan Paul Popa) My existing contributions and all future contributions until further notice are Copyright Bogdan Paul Popa, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
16- [@Bogdanp](https://github.com/Bogdanp) (Bogdan Paul Popa) My existing contributions and all future contributions until further notice are Copyright Bogdan Paul Popa, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
17- [@bsermons](https://github.com/bsermons) (Brian Sermons) My existing contributions and all future contributions until further notice are Copyright Brian Sermons, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
17- [@bsermons](https://github.com/bsermons) (Brian Sermons) My existing contributions and all future contributions until further notice are Copyright Brian Sermons, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
18- [@cdepillabout](https://github.com/cdepillabout) (Dennis Gosnell) My existing contributions and all future contributions until further notice are Copyright Dennis Gosnell, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
18- [@cdepillabout](https://github.com/cdepillabout) (Dennis Gosnell) My existing contributions and all future contributions until further notice are Copyright Dennis Gosnell, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
19+- [@charleso](https://github.com/charleso) (Charles O'Farrell) My existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Charles O'Farrell, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
19- [@chrissmoak](https://github.com/chrissmoak) (Chris Smoak) My existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Chris Smoak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
20- [@chrissmoak](https://github.com/chrissmoak) (Chris Smoak) My existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Chris Smoak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
20- [@codedmart](https://github.com/codedmart) (Brandon Martin) My existing contributions and all future contributions until further notice are Copyright Brandon Martin, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
21- [@codedmart](https://github.com/codedmart) (Brandon Martin) My existing contributions and all future contributions until further notice are Copyright Brandon Martin, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
21- [@davidchambers](https://github.com/davidchambers) (David Chambers) My existing contributions and all future contributions until further notice are Copyright David Chambers, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
22- [@davidchambers](https://github.com/davidchambers) (David Chambers) My existing contributions and all future contributions until further notice are Copyright David Chambers, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
hierarchy/Main.hs+18−15
@@ -18,13 +18,16 @@
18
18
19module Main where
19module Main where
20
20
21+import Control.Applicative (optional)
21import Control.Monad (unless)
22import Control.Monad (unless)
22
23
23import Data.List (intercalate,nub,sort)
24import Data.List (intercalate,nub,sort)
24import Data.Foldable (for_)
25import Data.Foldable (for_)
25import Data.Version (showVersion)
26import Data.Version (showVersion)
27+import Data.Monoid ((<>))
26
28
27−import Options.Applicative
29+import Options.Applicative (Parser)
30+import qualified Options.Applicative as Opts
28import System.Directory (createDirectoryIfMissing)
31import System.Directory (createDirectoryIfMissing)
29import System.FilePath ((</>))
32import System.FilePath ((</>))
30import System.FilePath.Glob (glob)
33import System.FilePath.Glob (glob)
@@ -90,26 +93,26 @@ superClasses (P.PositionedDeclaration _ _ decl) = superClasses decl
90superClasses _ = []
93superClasses _ = []
91
94
92inputFile :: Parser FilePath
95inputFile :: Parser FilePath
93−inputFile = strArgument $
96+inputFile = Opts.strArgument $
94− metavar "FILE"
97+ Opts.metavar "FILE"
95− <> value "main.purs"
98+ <> Opts.value "main.purs"
96− <> showDefault
99+ <> Opts.showDefault
97− <> help "The input file to generate a hierarchy from"
100+ <> Opts.help "The input file to generate a hierarchy from"
98
101
99outputFile :: Parser (Maybe FilePath)
102outputFile :: Parser (Maybe FilePath)
100−outputFile = optional . strOption $
103+outputFile = optional . Opts.strOption $
101− short 'o'
104+ Opts.short 'o'
102− <> long "output"
105+ <> Opts.long "output"
103− <> help "The output directory"
106+ <> Opts.help "The output directory"
104
107
105pscOptions :: Parser HierarchyOptions
108pscOptions :: Parser HierarchyOptions
106pscOptions = HierarchyOptions <$> inputFile
109pscOptions = HierarchyOptions <$> inputFile
107 <*> outputFile
110 <*> outputFile
108
111
109main :: IO ()
112main :: IO ()
110−main = execParser opts >>= compile
113+main = Opts.execParser opts >>= compile
111 where
114 where
112− opts = info (helper <*> pscOptions) infoModList
115+ opts = Opts.info (Opts.helper <*> pscOptions) infoModList
113− infoModList = fullDesc <> headerInfo <> footerInfo
116+ infoModList = Opts.fullDesc <> headerInfo <> footerInfo
114− headerInfo = header "hierarchy - Creates a GraphViz directed graph of PureScript TypeClasses"
117+ headerInfo = Opts.header "hierarchy - Creates a GraphViz directed graph of PureScript TypeClasses"
115− footerInfo = footer $ "hierarchy " ++ showVersion Paths.version
118+ footerInfo = Opts.footer $ "hierarchy " ++ showVersion Paths.version
psc-bundle/Main.hs+28−25
@@ -8,6 +8,7 @@ module Main (main) where
8
8
9import Data.Traversable (for)
9import Data.Traversable (for)
10import Data.Version (showVersion)
10import Data.Version (showVersion)
11+import Data.Monoid ((<>))
11
12
12import Control.Applicative
13import Control.Applicative
13import Control.Monad
14import Control.Monad
@@ -24,7 +25,8 @@ import System.Directory (createDirectoryIfMissing)
24
25
25import Language.PureScript.Bundle
26import Language.PureScript.Bundle
26
27
27−import Options.Applicative as Opts
28+import Options.Applicative (Parser, ParseError (..))
29+import qualified Options.Applicative as Opts
28
30
29import qualified Paths_purescript as Paths
31import qualified Paths_purescript as Paths
30
32
@@ -64,41 +66,41 @@ options = Options <$> some inputFile
64 <*> namespace
66 <*> namespace
65 where
67 where
66 inputFile :: Parser FilePath
68 inputFile :: Parser FilePath
67− inputFile = strArgument $
69+ inputFile = Opts.strArgument $
68− metavar "FILE"
70+ Opts.metavar "FILE"
69− <> help "The input .js file(s)"
71+ <> Opts.help "The input .js file(s)"
70
72
71 outputFile :: Parser FilePath
73 outputFile :: Parser FilePath
72− outputFile = strOption $
74+ outputFile = Opts.strOption $
73− short 'o'
75+ Opts.short 'o'
74− <> long "output"
76+ <> Opts.long "output"
75− <> help "The output .js file"
77+ <> Opts.help "The output .js file"
76
78
77 entryPoint :: Parser String
79 entryPoint :: Parser String
78− entryPoint = strOption $
80+ entryPoint = Opts.strOption $
79− short 'm'
81+ Opts.short 'm'
80− <> long "module"
82+ <> Opts.long "module"
81− <> help "Entry point module name(s). All code which is not a transitive dependency of an entry point module will be removed."
83+ <> Opts.help "Entry point module name(s). All code which is not a transitive dependency of an entry point module will be removed."
82
84
83 mainModule :: Parser String
85 mainModule :: Parser String
84− mainModule = strOption $
86+ mainModule = Opts.strOption $
85− long "main"
87+ Opts.long "main"
86− <> help "Generate code to run the main method in the specified module."
88+ <> Opts.help "Generate code to run the main method in the specified module."
87
89
88 namespace :: Parser String
90 namespace :: Parser String
89− namespace = strOption $
91+ namespace = Opts.strOption $
90− short 'n'
92+ Opts.short 'n'
91− <> long "namespace"
93+ <> Opts.long "namespace"
92 <> Opts.value "PS"
94 <> Opts.value "PS"
93− <> showDefault
95+ <> Opts.showDefault
94− <> help "Specify the namespace that PureScript modules will be exported to when running in the browser."
96+ <> Opts.help "Specify the namespace that PureScript modules will be exported to when running in the browser."
95
97
96-- | Make it go.
98-- | Make it go.
97main :: IO ()
99main :: IO ()
98main = do
100main = do
99 hSetEncoding stdout utf8
101 hSetEncoding stdout utf8
100 hSetEncoding stderr utf8
102 hSetEncoding stderr utf8
101− opts <- execParser (info (version <*> helper <*> options) infoModList)
103+ opts <- Opts.execParser (Opts.info (version <*> Opts.helper <*> options) infoModList)
102 output <- runExceptT (app opts)
104 output <- runExceptT (app opts)
103 case output of
105 case output of
104 Left err -> do
106 Left err -> do
@@ -111,9 +113,10 @@ main = do
111 writeFile outputFile js
113 writeFile outputFile js
112 Nothing -> putStrLn js
114 Nothing -> putStrLn js
113 where
115 where
114− infoModList = fullDesc <> headerInfo <> footerInfo
116+ infoModList = Opts.fullDesc <> headerInfo <> footerInfo
115− headerInfo = header "psc-bundle - Bundles compiled PureScript modules for the browser"
117+ headerInfo = Opts.header "psc-bundle - Bundles compiled PureScript modules for the browser"
116− footerInfo = footer $ "psc-bundle " ++ showVersion Paths.version
118+ footerInfo = Opts.footer $ "psc-bundle " ++ showVersion Paths.version
117
119
118 version :: Parser (a -> a)
120 version :: Parser (a -> a)
119− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
121+ version = Opts.abortOption (InfoMsg (showVersion Paths.version)) $
122+ Opts.long "version" <> Opts.help "Show the version number" <> Opts.hidden
psc-ide-client/Main.hs+8−5
@@ -8,8 +8,10 @@ import Control.Exception
8import qualified Data.ByteString.Char8 as BS8
8import qualified Data.ByteString.Char8 as BS8
9import qualified Data.Text.IO as T
9import qualified Data.Text.IO as T
10import Data.Version (showVersion)
10import Data.Version (showVersion)
11+import Data.Monoid ((<>))
11import Network
12import Network
12−import Options.Applicative
13+import Options.Applicative (ParseError (..))
14+import qualified Options.Applicative as Opts
13import System.Exit
15import System.Exit
14import System.IO
16import System.IO
15
17
@@ -21,15 +23,16 @@ data Options = Options
21
23
22main :: IO ()
24main :: IO ()
23main = do
25main = do
24− Options port <- execParser opts
26+ Options port <- Opts.execParser opts
25 client port
27 client port
26 where
28 where
27 parser =
29 parser =
28 Options <$>
30 Options <$>
29 (PortNumber . fromIntegral <$>
31 (PortNumber . fromIntegral <$>
30− option auto (long "port" <> short 'p' <> value (4242 :: Integer)))
32+ Opts.option Opts.auto (Opts.long "port" <> Opts.short 'p' <> Opts.value (4242 :: Integer)))
31− opts = info (version <*> helper <*> parser) mempty
33+ opts = Opts.info (version <*> Opts.helper <*> parser) mempty
32− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
34+ version = Opts.abortOption (InfoMsg (showVersion Paths.version)) $
35+ Opts.long "version" <> Opts.help "Show the version number" <> Opts.hidden
33
36
34client :: PortID -> IO ()
37client :: PortID -> IO ()
35client port = do
38client port = do
psc-ide-server/Main.hs+13−12
@@ -38,7 +38,8 @@ import Network hiding (socketPort, accept)
38import Network.BSD (getProtocolNumber)
38import Network.BSD (getProtocolNumber)
39import Network.Socket hiding (PortNumber, Type,
39import Network.Socket hiding (PortNumber, Type,
40 sClose)
40 sClose)
41−import Options.Applicative hiding ((<>))
41+import Options.Applicative (ParseError (..))
42+import qualified Options.Applicative as Opts
42import System.Directory
43import System.Directory
43import System.FilePath
44import System.FilePath
44import System.IO hiding (putStrLn, print)
45import System.IO hiding (putStrLn, print)
@@ -55,7 +56,7 @@ listenOnLocalhost port = do
55 sClose
56 sClose
56 (\sock -> do
57 (\sock -> do
57 setSocketOption sock ReuseAddr 1
58 setSocketOption sock ReuseAddr 1
58− bindSocket sock (SockAddrInet port localhost)
59+ bind sock (SockAddrInet port localhost)
59 listen sock maxListenQueue
60 listen sock maxListenQueue
60 pure sock)
61 pure sock)
61
62
@@ -70,7 +71,7 @@ data Options = Options
70
71
71main :: IO ()
72main :: IO ()
72main = do
73main = do
73− Options dir globs outputPath port noWatch debug <- execParser opts
74+ Options dir globs outputPath port noWatch debug <- Opts.execParser opts
74 maybe (pure ()) setCurrentDirectory dir
75 maybe (pure ()) setCurrentDirectory dir
75 ideState <- newTVarIO emptyIdeState
76 ideState <- newTVarIO emptyIdeState
76 cwd <- getCurrentDirectory
77 cwd <- getCurrentDirectory
@@ -91,17 +92,17 @@ main = do
91 where
92 where
92 parser =
93 parser =
93 Options
94 Options
94− <$> optional (strOption (long "directory" `mappend` short 'd'))
95+ <$> optional (Opts.strOption (Opts.long "directory" `mappend` Opts.short 'd'))
95− <*> many (argument str (metavar "Source GLOBS..."))
96+ <*> many (Opts.argument Opts.str (Opts.metavar "Source GLOBS..."))
96− <*> strOption (long "output-directory" `mappend` value "output/")
97+ <*> Opts.strOption (Opts.long "output-directory" `mappend` Opts.value "output/")
97 <*> (fromIntegral <$>
98 <*> (fromIntegral <$>
98− option auto (long "port" `mappend` short 'p' `mappend` value (4242 :: Integer)))
99+ Opts.option Opts.auto (Opts.long "port" `mappend` Opts.short 'p' `mappend` Opts.value (4242 :: Integer)))
99− <*> switch (long "no-watch")
100+ <*> Opts.switch (Opts.long "no-watch")
100− <*> switch (long "debug")
101+ <*> Opts.switch (Opts.long "debug")
101− opts = info (version <*> helper <*> parser) mempty
102+ opts = Opts.info (version <*> Opts.helper <*> parser) mempty
102− version = abortOption
103+ version = Opts.abortOption
103 (InfoMsg (showVersion Paths.version))
104 (InfoMsg (showVersion Paths.version))
104− (long "version" `mappend` help "Show the version number")
105+ (Opts.long "version" `mappend` Opts.help "Show the version number")
105
106
106startServer :: PortNumber -> IdeEnvironment -> IO ()
107startServer :: PortNumber -> IdeEnvironment -> IO ()
107startServer port env = withSocketsDo $ do
108startServer port env = withSocketsDo $ do
psc-publish/Main.hs+13−10
@@ -4,8 +4,10 @@ module Main where
4import Data.Version (Version(..), showVersion)
4import Data.Version (Version(..), showVersion)
5import qualified Data.Aeson as A
5import qualified Data.Aeson as A
6import qualified Data.ByteString.Lazy.Char8 as BL
6import qualified Data.ByteString.Lazy.Char8 as BL
7+import Data.Monoid ((<>))
7
8
8−import Options.Applicative hiding (str)
9+import Options.Applicative (Parser, ParseError (..))
10+import qualified Options.Applicative as Opts
9
11
10import System.IO (hSetEncoding, stderr, stdout, utf8)
12import System.IO (hSetEncoding, stderr, stdout, utf8)
11
13
@@ -14,9 +16,9 @@ import Language.PureScript.Publish
14import Language.PureScript.Publish.ErrorsWarnings
16import Language.PureScript.Publish.ErrorsWarnings
15
17
16dryRun :: Parser Bool
18dryRun :: Parser Bool
17−dryRun = switch $
19+dryRun = Opts.switch $
18− long "dry-run"
20+ Opts.long "dry-run"
19− <> help "Produce no output, and don't require a tagged version to be checked out."
21+ <> Opts.help "Produce no output, and don't require a tagged version to be checked out."
20
22
21dryRunOptions :: PublishOptions
23dryRunOptions :: PublishOptions
22dryRunOptions = defaultPublishOptions
24dryRunOptions = defaultPublishOptions
@@ -29,15 +31,16 @@ main :: IO ()
29main = do
31main = do
30 hSetEncoding stdout utf8
32 hSetEncoding stdout utf8
31 hSetEncoding stderr utf8
33 hSetEncoding stderr utf8
32− execParser opts >>= publish
34+ Opts.execParser opts >>= publish
33 where
35 where
34− opts = info (version <*> helper <*> dryRun) infoModList
36+ opts = Opts.info (version <*> Opts.helper <*> dryRun) infoModList
35− infoModList = fullDesc <> headerInfo <> footerInfo
37+ infoModList = Opts.fullDesc <> headerInfo <> footerInfo
36− headerInfo = header "psc-publish - Generates documentation packages for upload to http://pursuit.purescript.org"
38+ headerInfo = Opts.header "psc-publish - Generates documentation packages for upload to http://pursuit.purescript.org"
37− footerInfo = footer $ "psc-publish " ++ showVersion Paths.version
39+ footerInfo = Opts.footer $ "psc-publish " ++ showVersion Paths.version
38
40
39 version :: Parser (a -> a)
41 version :: Parser (a -> a)
40− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
42+ version = Opts.abortOption (InfoMsg (showVersion Paths.version)) $
43+ Opts.long "version" <> Opts.help "Show the version number" <> Opts.hidden
41
44
42publish :: Bool -> IO ()
45publish :: Bool -> IO ()
43publish isDryRun =
46publish isDryRun =