Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
nominolo committed Oct 9, 2008
0 parents commit ab2d7e2
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Makefile
@@ -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)
4 changes: 4 additions & 0 deletions Setup.hs
@@ -0,0 +1,4 @@
#!/usr/bin/env runhaskell
import Distribution.Simple
main :: IO ()
main = defaultMain
29 changes: 29 additions & 0 deletions scion.cabal
@@ -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
35 changes: 35 additions & 0 deletions src/Main.hs
@@ -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

0 comments on commit ab2d7e2

Please sign in to comment.