Skip to content

Commit

Permalink
Trying to find if ghc-pkg is installed before exploiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando 'Brujo' Benavides committed May 7, 2010
1 parent 89fc1ba commit b7a734d
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 302 deletions.
3 changes: 2 additions & 1 deletion hpage.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Executable hpage
hint-server >= 1.1.0, hint-server < 2,
time >= 1.1.4, time < 2,
cabal-macosx >= 0.1.0, cabal-macosx < 0.2,
FindBin >= 0.0.2, FindBin < 0.1
FindBin >= 0.0.2, FindBin < 0.1,
ghc-paths >= 0.1.0.6, ghc-paths < 0.2
main-is: Main.hs
buildable: True
hs-source-dirs: src
Expand Down
21 changes: 10 additions & 11 deletions src/HPage/Control.hs
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,9 @@ interpretNth i =
valueRes <- valueOfNth i
case valueRes of
Left verr ->
let verrStr = show verr
in if isNotShowable verr
then return $ Right $ Expr{intValue = "", intType = t}
else return $ Left verr
if isNotShowable verr
then return $ Right $ Expr{intValue = "", intType = t}
else return $ Left verr
Right v -> return $ Right $ Expr{intValue = v, intType = t}
where isNotShowable (Hint.WontCompile ghcerrs) = any complainsAboutShow ghcerrs
isNotShowable _ = False
Expand Down Expand Up @@ -505,8 +504,8 @@ importModules newms = do
res <- syncRun action
case res of
Right _ ->
modify (\ctx -> ctx{importedModules = union (fromList newms) (importedModules ctx),
recoveryLog = recoveryLog ctx >> action >> return ()})
modify (\c -> c{importedModules = union (fromList newms) (importedModules c),
recoveryLog = recoveryLog c >> action >> return ()})
Left e ->
liftErrorIO $ ("Error importing modules", ms, e)
return res
Expand Down Expand Up @@ -609,8 +608,8 @@ loadPackage file = do
forM_ opts $ \opt -> Hint.unsafeSetGhcOption opt `catchError` (\_ -> return ())
return pkgname
liftDebugIO mods
res <- syncRun action
case res of
res2 <- syncRun action
case res2 of
Right x ->
do
modify (\ctx -> ctx{activePackage = Just pkgname,
Expand Down Expand Up @@ -662,7 +661,7 @@ importModules' newms = do
liftTraceIO $ "importing': " ++ show newms
Hint.setImports $ ms ++ newms
res <- asyncRun action
modify (\ctx -> ctx{running = Just $ ImportModules (fromList newms) action})
modify (\c -> c{running = Just $ ImportModules (fromList newms) action})
return res

reloadModules' :: HPage (MVar (Either Hint.InterpreterError ()))
Expand Down Expand Up @@ -911,7 +910,7 @@ letsToString exs = "let\n " ++ joinWith ";\n " (map (joinWith "\n " . lines . e

moduleElemDesc :: Hint.ModuleElem -> Hint.InterpreterT IO ModuleElemDesc
moduleElemDesc (Hint.Fun fn) = do
t <- (Hint.typeOf fn) `catchError` (\e -> return [])
t <- (Hint.typeOf fn) `catchError` (\_ -> return [])
return MEFun{funName = fn, funType = t}
moduleElemDesc (Hint.Class cn cfs) = do
mcfs <- flip mapM cfs $ moduleElemDesc . Hint.Fun
Expand Down Expand Up @@ -947,7 +946,7 @@ tryGetConfigStateFile filename = do
then return (Left missing)
else withFileContents filename $ \str ->
case lines str of
[headder, rest] -> case reads rest of
[_header, rest] -> case reads rest of
[(bi,_)] -> return (Right bi)
_ -> return (Left cantParse)
_ -> return (Left cantParse)
Expand Down
1 change: 1 addition & 0 deletions src/HPage/GUI/Constants.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

module HPage.GUI.Constants where

bottomString, bottomChar :: String
bottomString = "\10200"
bottomChar = "\724"

Expand Down
6 changes: 3 additions & 3 deletions src/HPage/GUI/Dialogs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ hayooDialog win query =
htmlDialog win "Hayoo!" (sz 640 480) $ "http://holumbus.fh-wedel.de/hayoo/hayoo.html?query=" ++ query

htmlDialog :: Window a -> String -> Size -> String -> IO ()
htmlDialog win caption size url =
htmlDialog win caption winsize url =
do
dlg <- dialog win [text := caption]
htmlw <- htmlWindowCreate dlg idAny (rect (point 0 0) size) 0 ""
htmlw <- htmlWindowCreate dlg idAny (rect (point 0 0) winsize) 0 ""
debugIO ("url:", url)
htmlWindowLoadPage htmlw url
set dlg [layout := fill $ widget htmlw,
visible := True,
clientSize := size]
clientSize := winsize]
windowCenter dlg wxCENTRE_ON_SCREEN
return ()

Expand Down
Loading

0 comments on commit b7a734d

Please sign in to comment.