git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Bumped utf8-string version and updated code accordingly.
871d30baspidites
hierarchy/Main.hs+5−6
@@ -25,13 +25,12 @@ import Options.Applicative
25import System.Directory (createDirectoryIfMissing)
25import System.Directory (createDirectoryIfMissing)
26import System.FilePath ((</>))
26import System.FilePath ((</>))
27import System.Exit (exitFailure, exitSuccess)
27import System.Exit (exitFailure, exitSuccess)
28−import System.IO (stderr)
28+import System.IO (hPutStr, stderr)
29
29
30import Text.Parsec as Par (ParseError)
30import Text.Parsec as Par (ParseError)
31
31
32import qualified Language.PureScript as P
32import qualified Language.PureScript as P
33import qualified Paths_purescript as Paths
33import qualified Paths_purescript as Paths
34−import qualified System.IO.UTF8 as U
35
34
36
35
37data HierarchyOptions = HierarchyOptions
36data HierarchyOptions = HierarchyOptions
@@ -56,14 +55,14 @@ runModuleName (P.ModuleName pns) = intercalate "_" (P.runProperName `map` pns)
56
55
57readInput :: FilePath -> IO (Either Par.ParseError [P.Module])
56readInput :: FilePath -> IO (Either Par.ParseError [P.Module])
58readInput filename = do
57readInput filename = do
59− content <- U.readFile filename
58+ content <- readFile filename
60 return $ fmap (map snd) $ P.parseModulesFromFiles id [(filename, content)]
59 return $ fmap (map snd) $ P.parseModulesFromFiles id [(filename, content)]
61
60
62compile :: HierarchyOptions -> IO ()
61compile :: HierarchyOptions -> IO ()
63compile (HierarchyOptions input mOutput) = do
62compile (HierarchyOptions input mOutput) = do
64 modules <- readInput input
63 modules <- readInput input
65 case modules of
64 case modules of
66− Left err -> U.hPutStr stderr (show err) >> exitFailure
65+ Left err -> hPutStr stderr (show err) >> exitFailure
67 Right ms -> do
66 Right ms -> do
68 for_ ms $ \(P.Module moduleName decls _) ->
67 for_ ms $ \(P.Module moduleName decls _) ->
69 let name = runModuleName moduleName
68 let name = runModuleName moduleName
@@ -76,8 +75,8 @@ compile (HierarchyOptions input mOutput) = do
76 in unless (null supers) $ case mOutput of
75 in unless (null supers) $ case mOutput of
77 Just output -> do
76 Just output -> do
78 createDirectoryIfMissing True output
77 createDirectoryIfMissing True output
79− U.writeFile (output </> name) hier
78+ writeFile (output </> name) hier
80− Nothing -> U.putStrLn hier
79+ Nothing -> putStrLn hier
81 exitSuccess
80 exitSuccess
82
81
83superClasses :: P.Declaration -> [SuperMap]
82superClasses :: P.Declaration -> [SuperMap]
psc-docs/Main.hs+4−5
@@ -27,9 +27,8 @@ import Options.Applicative
27
27
28import qualified Language.PureScript as P
28import qualified Language.PureScript as P
29import qualified Paths_purescript as Paths
29import qualified Paths_purescript as Paths
30−import qualified System.IO.UTF8 as U
31import System.Exit (exitSuccess, exitFailure)
30import System.Exit (exitSuccess, exitFailure)
32−import System.IO (stderr)
31+import System.IO (hPutStr, stderr)
33
32
34
33
35data PSCDocsOptions = PSCDocsOptions
34data PSCDocsOptions = PSCDocsOptions
@@ -43,14 +42,14 @@ docgen (PSCDocsOptions showHierarchy input) = do
43 e <- P.parseModulesFromFiles (fromMaybe "") <$> mapM (fmap (first Just) . parseFile) (nub input)
42 e <- P.parseModulesFromFiles (fromMaybe "") <$> mapM (fmap (first Just) . parseFile) (nub input)
44 case e of
43 case e of
45 Left err -> do
44 Left err -> do
46− U.hPutStr stderr $ show err
45+ hPutStr stderr $ show err
47 exitFailure
46 exitFailure
48 Right ms -> do
47 Right ms -> do
49− U.putStrLn . runDocs $ (renderModules showHierarchy) (map snd ms)
48+ putStrLn . runDocs $ (renderModules showHierarchy) (map snd ms)
50 exitSuccess
49 exitSuccess
51
50
52parseFile :: FilePath -> IO (FilePath, String)
51parseFile :: FilePath -> IO (FilePath, String)
53−parseFile input = (,) input <$> U.readFile input
52+parseFile input = (,) input <$> readFile input
54
53
55type Docs = Writer [String] ()
54type Docs = Writer [String] ()
56
55
psc-make/Main.hs+8−9
@@ -31,7 +31,6 @@ import System.IO.Error (tryIOError)
31
31
32import qualified Language.PureScript as P
32import qualified Language.PureScript as P
33import qualified Paths_purescript as Paths
33import qualified Paths_purescript as Paths
34−import qualified System.IO.UTF8 as U
35
34
36
35
37data PSCMakeOptions = PSCMakeOptions
36data PSCMakeOptions = PSCMakeOptions
@@ -48,7 +47,7 @@ data InputOptions = InputOptions
48
47
49readInput :: InputOptions -> IO [(Either P.RebuildPolicy FilePath, String)]
48readInput :: InputOptions -> IO [(Either P.RebuildPolicy FilePath, String)]
50readInput InputOptions{..} = do
49readInput InputOptions{..} = do
51− content <- forM ioInputFiles $ \inFile -> (Right inFile, ) <$> U.readFile inFile
50+ content <- forM ioInputFiles $ \inFile -> (Right inFile, ) <$> readFile inFile
52 return (if ioNoPrelude then content else (Left P.RebuildNever, P.prelude) : content)
51 return (if ioNoPrelude then content else (Left P.RebuildNever, P.prelude) : content)
53
52
54newtype Make a = Make { unMake :: ErrorT String IO a } deriving (Functor, Applicative, Monad, MonadIO, MonadError String)
53newtype Make a = Make { unMake :: ErrorT String IO a } deriving (Functor, Applicative, Monad, MonadIO, MonadError String)
@@ -66,27 +65,27 @@ instance P.MonadMake Make where
66 True -> Just <$> getModificationTime path
65 True -> Just <$> getModificationTime path
67 False -> return Nothing
66 False -> return Nothing
68 readTextFile path = makeIO $ do
67 readTextFile path = makeIO $ do
69− U.putStrLn $ "Reading " ++ path
68+ putStrLn $ "Reading " ++ path
70− U.readFile path
69+ readFile path
71 writeTextFile path text = makeIO $ do
70 writeTextFile path text = makeIO $ do
72 mkdirp path
71 mkdirp path
73− U.putStrLn $ "Writing " ++ path
72+ putStrLn $ "Writing " ++ path
74− U.writeFile path text
73+ writeFile path text
75 liftError = either throwError return
74 liftError = either throwError return
76− progress = makeIO . U.putStrLn
75+ progress = makeIO . putStrLn
77
76
78compile :: PSCMakeOptions -> IO ()
77compile :: PSCMakeOptions -> IO ()
79compile (PSCMakeOptions input outputDir opts usePrefix) = do
78compile (PSCMakeOptions input outputDir opts usePrefix) = do
80 modules <- P.parseModulesFromFiles (either (const "") id) <$> readInput (InputOptions (P.optionsNoPrelude opts) input)
79 modules <- P.parseModulesFromFiles (either (const "") id) <$> readInput (InputOptions (P.optionsNoPrelude opts) input)
81 case modules of
80 case modules of
82 Left err -> do
81 Left err -> do
83− U.print err
82+ print err
84 exitFailure
83 exitFailure
85 Right ms -> do
84 Right ms -> do
86 e <- runMake $ P.make outputDir opts ms prefix
85 e <- runMake $ P.make outputDir opts ms prefix
87 case e of
86 case e of
88 Left err -> do
87 Left err -> do
89− U.putStrLn err
88+ putStrLn err
90 exitFailure
89 exitFailure
91 Right _ -> do
90 Right _ -> do
92 exitSuccess
91 exitSuccess
psc/Main.hs+7−8
@@ -26,11 +26,10 @@ import Options.Applicative as Opts
26import System.Directory (createDirectoryIfMissing)
26import System.Directory (createDirectoryIfMissing)
27import System.FilePath (takeDirectory)
27import System.FilePath (takeDirectory)
28import System.Exit (exitSuccess, exitFailure)
28import System.Exit (exitSuccess, exitFailure)
29−import System.IO (stderr)
29+import System.IO (hPutStr, hPutStrLn, stderr)
30
30
31import qualified Language.PureScript as P
31import qualified Language.PureScript as P
32import qualified Paths_purescript as Paths
32import qualified Paths_purescript as Paths
33−import qualified System.IO.UTF8 as U
34
33
35
34
36data PSCOptions = PSCOptions
35data PSCOptions = PSCOptions
@@ -51,7 +50,7 @@ data InputOptions = InputOptions
51readInput :: InputOptions -> IO [(Maybe FilePath, String)]
50readInput :: InputOptions -> IO [(Maybe FilePath, String)]
52readInput InputOptions{..}
51readInput InputOptions{..}
53 | ioUseStdIn = return . (Nothing ,) <$> getContents
52 | ioUseStdIn = return . (Nothing ,) <$> getContents
54− | otherwise = do content <- forM ioInputFiles $ \inFile -> (Just inFile, ) <$> U.readFile inFile
53+ | otherwise = do content <- forM ioInputFiles $ \inFile -> (Just inFile, ) <$> readFile inFile
55 return (if ioNoPrelude then content else (Nothing, P.prelude) : content)
54 return (if ioNoPrelude then content else (Nothing, P.prelude) : content)
56
55
57compile :: PSCOptions -> IO ()
56compile :: PSCOptions -> IO ()
@@ -59,19 +58,19 @@ compile (PSCOptions input opts stdin output externs usePrefix) = do
59 modules <- P.parseModulesFromFiles (fromMaybe "") <$> readInput (InputOptions (P.optionsNoPrelude opts) stdin input)
58 modules <- P.parseModulesFromFiles (fromMaybe "") <$> readInput (InputOptions (P.optionsNoPrelude opts) stdin input)
60 case modules of
59 case modules of
61 Left err -> do
60 Left err -> do
62− U.hPutStr stderr $ show err
61+ hPutStr stderr $ show err
63 exitFailure
62 exitFailure
64 Right ms -> do
63 Right ms -> do
65 case P.compile opts (map snd ms) prefix of
64 case P.compile opts (map snd ms) prefix of
66 Left err -> do
65 Left err -> do
67− U.hPutStrLn stderr err
66+ hPutStrLn stderr err
68 exitFailure
67 exitFailure
69 Right (js, exts, _) -> do
68 Right (js, exts, _) -> do
70 case output of
69 case output of
71− Just path -> mkdirp path >> U.writeFile path js
70+ Just path -> mkdirp path >> writeFile path js
72− Nothing -> U.putStrLn js
71+ Nothing -> putStrLn js
73 case externs of
72 case externs of
74− Just path -> mkdirp path >> U.writeFile path exts
73+ Just path -> mkdirp path >> writeFile path exts
75 Nothing -> return ()
74 Nothing -> return ()
76 exitSuccess
75 exitSuccess
77 where
76 where
psci/Main.hs+7−8
@@ -42,7 +42,6 @@ import System.Exit
42import System.FilePath (pathSeparator, takeDirectory, (</>), isPathSeparator)
42import System.FilePath (pathSeparator, takeDirectory, (</>), isPathSeparator)
43import System.IO.Error (tryIOError)
43import System.IO.Error (tryIOError)
44import System.Process (readProcessWithExitCode)
44import System.Process (readProcessWithExitCode)
45−import qualified System.IO.UTF8 as U (writeFile, putStrLn, print, readFile)
46
45
47import qualified Text.Parsec as Par (ParseError)
46import qualified Text.Parsec as Par (ParseError)
48
47
@@ -129,7 +128,7 @@ getHistoryFilename = do
129--
128--
130loadModule :: FilePath -> IO (Either String [P.Module])
129loadModule :: FilePath -> IO (Either String [P.Module])
131loadModule filename = do
130loadModule filename = do
132− content <- U.readFile filename
131+ content <- readFile filename
133 return $ either (Left . show) (Right . map snd) $ P.parseModulesFromFiles id [(filename, content)]
132 return $ either (Left . show) (Right . map snd) $ P.parseModulesFromFiles id [(filename, content)]
134
133
135-- |
134-- |
@@ -138,7 +137,7 @@ loadModule filename = do
138loadAllModules :: [FilePath] -> IO (Either Par.ParseError [(Either P.RebuildPolicy FilePath, P.Module)])
137loadAllModules :: [FilePath] -> IO (Either Par.ParseError [(Either P.RebuildPolicy FilePath, P.Module)])
139loadAllModules files = do
138loadAllModules files = do
140 filesAndContent <- forM files $ \filename -> do
139 filesAndContent <- forM files $ \filename -> do
141− content <- U.readFile filename
140+ content <- readFile filename
142 return (Right filename, content)
141 return (Right filename, content)
143 return $ P.parseModulesFromFiles (either (const "") id) $ (Left P.RebuildNever, P.prelude) : filesAndContent
142 return $ P.parseModulesFromFiles (either (const "") id) $ (Left P.RebuildNever, P.prelude) : filesAndContent
144
143
@@ -329,12 +328,12 @@ instance P.MonadMake Make where
329 if exists
328 if exists
330 then Just <$> getModificationTime path
329 then Just <$> getModificationTime path
331 else return Nothing
330 else return Nothing
332− readTextFile path = makeIO $ U.readFile path
331+ readTextFile path = makeIO $ readFile path
333 writeTextFile path text = makeIO $ do
332 writeTextFile path text = makeIO $ do
334 mkdirp path
333 mkdirp path
335− U.writeFile path text
334+ writeFile path text
336 liftError = either throwError return
335 liftError = either throwError return
337− progress s = unless (s == "Compiling $PSCI") $ makeIO . U.putStrLn $ s
336+ progress s = unless (s == "Compiling $PSCI") $ makeIO . putStrLn $ s
338
337
339mkdirp :: FilePath -> IO ()
338mkdirp :: FilePath -> IO ()
340mkdirp = createDirectoryIfMissing True . takeDirectory
339mkdirp = createDirectoryIfMissing True . takeDirectory
@@ -579,9 +578,9 @@ loadUserConfig = do
579 exists <- doesFileExist configFile
578 exists <- doesFileExist configFile
580 if exists
579 if exists
581 then do
580 then do
582− ls <- lines <$> U.readFile configFile
581+ ls <- lines <$> readFile configFile
583 case mapM parseCommand ls of
582 case mapM parseCommand ls of
584− Left err -> U.print err >> exitFailure
583+ Left err -> print err >> exitFailure
585 Right cs -> return $ Just cs
584 Right cs -> return $ Just cs
586 else
585 else
587 return Nothing
586 return Nothing
purescript.cabal+8−8
@@ -1,5 +1,5 @@
1name: purescript
1name: purescript
2−version: 0.6.3
2+version: 0.6.4
3cabal-version: >=1.8
3cabal-version: >=1.8
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -32,7 +32,7 @@ library
32 mtl >= 2.1.0 && < 2.3.0,
32 mtl >= 2.1.0 && < 2.3.0,
33 parsec -any,
33 parsec -any,
34 transformers >= 0.3 && < 0.5,
34 transformers >= 0.3 && < 0.5,
35− utf8-string -any,
35+ utf8-string >= 1,
36 pattern-arrows >= 0.0.2 && < 0.1,
36 pattern-arrows >= 0.0.2 && < 0.1,
37 monad-unify >= 0.2.2 && < 0.3,
37 monad-unify >= 0.2.2 && < 0.3,
38 file-embed >= 0.0.7 && < 0.0.8,
38 file-embed >= 0.0.7 && < 0.0.8,
@@ -119,7 +119,7 @@ library
119executable psc
119executable psc
120 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
120 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
121 mtl -any, optparse-applicative >= 0.10.0, parsec -any, purescript -any,
121 mtl -any, optparse-applicative >= 0.10.0, parsec -any, purescript -any,
122− transformers -any, utf8-string -any
122+ transformers -any, utf8-string >= 1
123 main-is: Main.hs
123 main-is: Main.hs
124 buildable: True
124 buildable: True
125 hs-source-dirs: psc
125 hs-source-dirs: psc
@@ -129,7 +129,7 @@ executable psc
129executable psc-make
129executable psc-make
130 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
130 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
131 mtl -any, optparse-applicative >= 0.10.0, parsec -any, purescript -any,
131 mtl -any, optparse-applicative >= 0.10.0, parsec -any, purescript -any,
132− transformers -any, utf8-string -any
132+ transformers -any, utf8-string >= 1
133 main-is: Main.hs
133 main-is: Main.hs
134 buildable: True
134 buildable: True
135 hs-source-dirs: psc-make
135 hs-source-dirs: psc-make
@@ -140,7 +140,7 @@ executable psci
140 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
140 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
141 mtl -any, optparse-applicative >= 0.10.0, parsec -any,
141 mtl -any, optparse-applicative >= 0.10.0, parsec -any,
142 haskeline >= 0.7.0.0, purescript -any, transformers -any,
142 haskeline >= 0.7.0.0, purescript -any, transformers -any,
143− utf8-string -any, process -any
143+ utf8-string >= 1, process -any
144
144
145 main-is: Main.hs
145 main-is: Main.hs
146 buildable: True
146 buildable: True
@@ -150,7 +150,7 @@ executable psci
150 ghc-options: -Wall -fno-warn-warnings-deprecations -O2
150 ghc-options: -Wall -fno-warn-warnings-deprecations -O2
151
151
152executable psc-docs
152executable psc-docs
153− build-depends: base >=4 && <5, purescript -any, utf8-string -any,
153+ build-depends: base >=4 && <5, purescript -any, utf8-string >= 1,
154 optparse-applicative >= 0.10.0, process -any, mtl -any
154 optparse-applicative >= 0.10.0, process -any, mtl -any
155 main-is: Main.hs
155 main-is: Main.hs
156 buildable: True
156 buildable: True
@@ -159,7 +159,7 @@ executable psc-docs
159 ghc-options: -Wall -fno-warn-warnings-deprecations -O2
159 ghc-options: -Wall -fno-warn-warnings-deprecations -O2
160
160
161executable hierarchy
161executable hierarchy
162− build-depends: base >=4 && <5, purescript -any, utf8-string -any, optparse-applicative >= 0.10.0,
162+ build-depends: base >=4 && <5, purescript -any, utf8-string >= 1, optparse-applicative >= 0.10.0,
163 process -any, mtl -any, parsec -any, filepath -any, directory -any
163 process -any, mtl -any, parsec -any, filepath -any, directory -any
164 main-is: Main.hs
164 main-is: Main.hs
165 buildable: True
165 buildable: True
@@ -170,7 +170,7 @@ executable hierarchy
170test-suite tests
170test-suite tests
171 build-depends: base >=4 && <5, containers -any, directory -any,
171 build-depends: base >=4 && <5, containers -any, directory -any,
172 filepath -any, mtl -any, parsec -any, purescript -any,
172 filepath -any, mtl -any, parsec -any, purescript -any,
173− transformers -any, utf8-string -any, process -any
173+ transformers -any, utf8-string >= 1, process -any
174 type: exitcode-stdio-1.0
174 type: exitcode-stdio-1.0
175 main-is: Main.hs
175 main-is: Main.hs
176 buildable: True
176 buildable: True
tests/Main.hs+1−2
@@ -28,11 +28,10 @@ import System.Process
28import System.FilePath (pathSeparator)
28import System.FilePath (pathSeparator)
29import System.Directory (getCurrentDirectory, getTemporaryDirectory, getDirectoryContents, findExecutable)
29import System.Directory (getCurrentDirectory, getTemporaryDirectory, getDirectoryContents, findExecutable)
30import Text.Parsec (ParseError)
30import Text.Parsec (ParseError)
31−import qualified System.IO.UTF8 as U
32
31
33readInput :: [FilePath] -> IO [(FilePath, String)]
32readInput :: [FilePath] -> IO [(FilePath, String)]
34readInput inputFiles = forM inputFiles $ \inputFile -> do
33readInput inputFiles = forM inputFiles $ \inputFile -> do
35− text <- U.readFile inputFile
34+ text <- readFile inputFile
36 return (inputFile, text)
35 return (inputFile, text)
37
36
38loadPrelude :: Either String (String, String, P.Environment)
37loadPrelude :: Either String (String, String, P.Environment)