forked from nominolo/scion
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ab2d7e2
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
HC=../ghc/ghc/stage2-inplace/ghc.exe | ||
PKG=../ghc/utils/ghc-pkg/install-inplace/bin/ghc-pkg.exe | ||
SETUP=./Setup.exe | ||
|
||
main: build | ||
|
||
Setup.exe: Setup.hs | ||
$(HC) --make $< | ||
|
||
configure: | ||
$(SETUP) configure --with-compiler=$(HC) --with-hc-pkg=$(PKG) --user | ||
|
||
build: | ||
$(SETUP) build | ||
|
||
install: | ||
$(SETUP) install | ||
|
||
test: | ||
./dist/build/test/test.exe | ||
|
||
clean: | ||
$(SETUP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env runhaskell | ||
import Distribution.Simple | ||
main :: IO () | ||
main = defaultMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: scion | ||
version: 0.1 | ||
license: BSD3 | ||
license-file: LICENSE | ||
author: Thomas Schilling <nominolo@googlemail.com> | ||
maintainer: Thomas Schilling <nominolo@googlemail.com> | ||
homepage: http://github.com/nominolo/scion | ||
description: Haskell Source Code Inspection and Interaction blah | ||
synopsis: Haskell IDE library | ||
category: Development | ||
stability: provisional | ||
build-type: Simple | ||
cabal-version: >= 1.2 | ||
-- tested-with: GHC ==6.10.1 | ||
-- extra-source-files: README | ||
|
||
--flag bytestring-in-base | ||
--flag split-base | ||
--flag applicative-in-base | ||
--flag base-3 | ||
|
||
-- library | ||
-- build-depends: base >= 4 && < 5 | ||
|
||
executable test | ||
main-is: src/Main.hs | ||
build-depends: base >= 4 && < 5, | ||
ghc-paths >= 0.1 && < 0.2, | ||
ghc >= 6.10 && < 6.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import GHC | ||
import GHC.Paths ( libdir ) | ||
import MonadUtils ( liftIO, MonadIO ) | ||
import DynFlags | ||
import Packages | ||
import Module | ||
import Outputable | ||
import Exception | ||
|
||
main = | ||
defaultErrorHandler defaultDynFlags $ do | ||
pr "Starting" | ||
runGhc (Just libdir) $ do | ||
dflags <- getSessionDynFlags | ||
(dflags', pkgIds) <- liftIO $ initPackages dflags | ||
setSessionDynFlags dflags'{ hscTarget = HscInterpreted } | ||
pr "Session set up" | ||
let prelude_mod = mkModule (stringToPackageId "base") | ||
(mkModuleName "Prelude") | ||
setContext [] [prelude_mod] | ||
pr "Context set" | ||
|
||
let stmt = "let n = 2 + 'a'" | ||
handleSourceError (\err -> do | ||
pr "Failed to compile stmt" | ||
printExceptionAndWarnings err) $ do | ||
rslt <- runStmt stmt RunToCompletion | ||
pr $ "Result is: " ++ case rslt of | ||
RunOk names -> "OK: " ++ showSDoc (ppr names) | ||
_ -> "Failed" | ||
|
||
return () | ||
|
||
pr :: (MonadIO m) => String -> m () | ||
pr = liftIO . putStrLn |