Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit.

  • Loading branch information...
commit ab2d7e27ba65eaac37028cb944f64ccd008b54a1 0 parents
@nominolo authored
Showing with 91 additions and 0 deletions.
  1. +23 −0 Makefile
  2. +4 −0 Setup.hs
  3. +29 −0 scion.cabal
  4. +35 −0 src/Main.hs
23 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 Setup.hs
@@ -0,0 +1,4 @@
+#!/usr/bin/env runhaskell
+import Distribution.Simple
+main :: IO ()
+main = defaultMain
29 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 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
Please sign in to comment.
Something went wrong with that request. Please try again.