packages feed

purescript 0.4.13.1 → 0.4.14

raw patch · 3 files changed

+25/−3 lines, 3 files

Files

docgen/Main.hs view
@@ -93,6 +93,7 @@   matches (P.ExternDataDeclaration ident _) (P.TypeRef ident' _) = ident == ident'   matches (P.TypeSynonymDeclaration ident _ _) (P.TypeRef ident' _) = ident == ident'   matches (P.TypeClassDeclaration ident _ _) (P.TypeClassRef ident') = ident == ident'+  matches (P.PositionedDeclaration _ d) r = d `matches` r   matches _ _ = False  isDctorExported :: P.ProperName -> Maybe [P.DeclarationRef] -> P.ProperName -> Bool@@ -143,25 +144,30 @@ getName (P.TypeSynonymDeclaration name _ _) = P.runProperName name getName (P.TypeClassDeclaration name _ _) = P.runProperName name getName (P.TypeInstanceDeclaration name _ _ _ _) = show name+getName (P.PositionedDeclaration _ d) = getName d getName _ = error "Invalid argument to getName"  isValueDeclaration :: P.Declaration -> Bool isValueDeclaration P.TypeDeclaration{} = True isValueDeclaration P.ExternDeclaration{} = True+isValueDeclaration (P.PositionedDeclaration _ d) = isValueDeclaration d isValueDeclaration _ = False  isTypeDeclaration :: P.Declaration -> Bool isTypeDeclaration P.DataDeclaration{} = True isTypeDeclaration P.ExternDataDeclaration{} = True isTypeDeclaration P.TypeSynonymDeclaration{} = True+isTypeDeclaration (P.PositionedDeclaration _ d) = isTypeDeclaration d isTypeDeclaration _ = False  isTypeClassDeclaration :: P.Declaration -> Bool isTypeClassDeclaration P.TypeClassDeclaration{} = True+isTypeClassDeclaration (P.PositionedDeclaration _ d) = isTypeClassDeclaration d isTypeClassDeclaration _ = False  isTypeInstanceDeclaration :: P.Declaration -> Bool isTypeInstanceDeclaration P.TypeInstanceDeclaration{} = True+isTypeInstanceDeclaration (P.PositionedDeclaration _ d) = isTypeInstanceDeclaration d isTypeInstanceDeclaration _ = False  inputFile :: Term FilePath
psci/Main.hs view
@@ -27,13 +27,14 @@  import Data.List (intercalate, isPrefixOf, nub, sortBy) import Data.Maybe (mapMaybe)+import Data.Foldable (traverse_) import Data.Traversable (traverse) import Data.Version (showVersion)  import Parser  import System.Console.Haskeline-import System.Directory (doesFileExist, findExecutable, getHomeDirectory)+import System.Directory (doesFileExist, findExecutable, getHomeDirectory, getCurrentDirectory) import System.Exit import System.Environment.XDG.BaseDir import System.FilePath ((</>), isPathSeparator)@@ -45,7 +46,7 @@ import qualified Data.Map as M import qualified Language.PureScript as P import qualified Paths_purescript as Paths-import qualified System.IO.UTF8 as U (readFile)+import qualified System.IO.UTF8 as U (print, readFile)  -- | -- The PSCI state.@@ -289,11 +290,25 @@ inputFiles = Cmd.value $ Cmd.posAny [] $ Cmd.posInfo { Cmd.posName = "file(s)"                                                      , Cmd.posDoc = "Optional .purs files to load on start" } +loadUserConfig :: IO (Maybe [Command])+loadUserConfig = do+  configFile <- (</> ".psci") <$> getCurrentDirectory+  exists <- doesFileExist configFile+  if exists+  then do+    ls <- lines <$> U.readFile configFile+    case mapM parseCommand ls of+      Left err -> U.print err >> exitFailure+      Right cs -> return $ Just cs+  else+    return Nothing+ -- | -- The PSCI main loop. -- loop :: [FilePath] -> IO () loop files = do+  config <- loadUserConfig   preludeFilename <- getPreludeFilename   modulesOrFirstError <- fmap concat . sequence <$> mapM loadModule (preludeFilename : files)   case modulesOrFirstError of@@ -303,6 +318,7 @@       let settings = defaultSettings {historyFile = Just historyFilename}       flip evalStateT (PSCiState (preludeFilename : files) defaultImports modules []) . runInputT (setComplete completion settings) $ do         outputStrLn prologueMessage+        traverse_ (mapM_ handleCommand) config         go       where         go :: InputT (StateT PSCiState IO) ()
purescript.cabal view
@@ -1,5 +1,5 @@ name: purescript-version: 0.4.13.1+version: 0.4.14 cabal-version: >=1.8 build-type: Custom license: MIT