@@ -1,10 +1,7 @@
1{-# OPTIONS_GHC -Wall #-}
1{-# OPTIONS_GHC -Wall #-}
2−{-# LANGUAGE FlexibleContexts #-}
3−{-# LANGUAGE OverloadedStrings #-}
4module Elm.Utils
2module Elm.Utils
5 ( (|>), (<|)
3 ( (|>), (<|)
6− , run, unwrappedRun
4+ , nearbyNames
8 , isDeclaration
5 , isDeclaration
@@ -18,6 +15,11 @@ import qualified AST.Pattern as Pattern
18import qualified Parse.Helpers as Parse
15import qualified Parse.Helpers as Parse
19import qualified Parse.Expression as Parse
16import qualified Parse.Expression as Parse
20import qualified Reporting.Annotation as A
17import qualified Reporting.Annotation as A
18+import Reporting.Helpers (nearbyNames)
23{-| Forward function application `x |> f == f x`. This function is useful
25{-| Forward function application `x |> f == f x`. This function is useful
@@ -38,64 +40,6 @@ infixr 0 <|
38infixl 0 |>
40infixl 0 |>
45− | CommandFailed String String
48−{-| Run a command, throw an error if the command is not found or if something
51−run :: (MonadError String m, MonadIO m) => String -> [String] -> m String
53− do result <- liftIO (unwrappedRun command args)
59− throwError (context (message err))
62− "failure when running:" ++ concatMap (' ':) (command:args) ++ "\n" ++ msg
66− CommandFailed stdout stderr ->
73−unwrappedRun :: String -> [String] -> IO (Either CommandError String)
74−unwrappedRun command args =
75− do (exitCode, stdout, stderr) <- readProcessWithExitCode command args ""
83− Left (missingExe command) -- UNIX
85− else if code == 9009 then
86− Left (missingExe command) -- Windows
89− Left (CommandFailed stdout stderr)
92−missingExe :: String -> CommandError
95− "Could not find command `" ++ command ++ "`. Do you have it installed?\n\
96− \ Can it be run from anywhere? Is it on your PATH?"
100-- DECL CHECKER
44-- DECL CHECKER