ide-backend: An IDE backend library

[ development, library, mit, program ] [ Propose Tags ]

See README.md for more details


[Skip to Readme]

Modules

[Last Documentation]

  • IdeSession
    • IdeSession.Cabal
    • IdeSession.Config
    • IdeSession.ExeCabalClient
    • GHC
      • IdeSession.GHC.Client
    • IdeSession.Licenses
    • IdeSession.Query
    • RPC
      • IdeSession.RPC.Client
    • IdeSession.State
    • IdeSession.Update
      • IdeSession.Update.ExecuteSessionUpdate
      • IdeSession.Update.IdeSessionUpdate

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.9.0, 0.9.0.1, 0.9.0.2, 0.9.0.3, 0.9.0.4, 0.9.0.5, 0.9.0.6, 0.9.0.7, 0.9.0.8, 0.9.0.9, 0.9.0.10, 0.9.0.11, 0.10.0, 0.10.0.1
Dependencies aeson (>=0.6.2 && <0.12), async (>=2.0 && <2.2), attoparsec (>=0.10 && <0.14), base (>=4 && <5), binary (>=0.7.1.0 && <0.8), bytestring (>=0.9.2 && <1), bytestring-trie (>=0.2 && <0.3), Cabal-ide-backend (>=1.23), containers (>=0.4.1 && <1), crypto-api (>=0.12 && <0.14), data-accessor (>=0.2 && <0.3), data-accessor-mtl (>=0.2 && <0.3), directory (>=1.1 && <1.3), executable-path (>=0.0 && <0.1), filemanip (>=0.3.6.2 && <0.4), filepath (>=1.3 && <1.5), fingertree (>=0.0.1 && <0.2), ghc-prim, ide-backend, ide-backend-common (>=0.10 && <0.11), mtl (>=2.1 && <2.3), network, pretty-show, process (>=1.1 && <1.3), pureMD5 (>=2.1 && <2.2), random (>=1.0.1 && <2), tagged (>=0.4 && <0.9), template-haskell, temporary (>=1.1.2.4 && <1.3), text (>=0.11 && <1.3), time (>=1.4 && <1.6), transformers (>=0.3 && <0.5), unix (>=2.5 && <2.8), unix-compat (>=0.4.1.1 && <0.4.2), unordered-containers (>=0.2.3 && <0.3), utf8-string (>=0.3 && <1.1) [details]
License MIT
Copyright (c) 2015 FP Complete
Author Duncan Coutts, Mikolaj Konarski, Edsko de Vries
Maintainer Duncan Coutts <duncan@well-typed.com>
Revised Revision 1 made by MichaelSnoyman at 2016-02-09T10:12:47Z
Category Development
Uploaded by MichaelSnoyman at 2016-01-06T04:44:20Z
Distributions
Reverse Dependencies 2 direct, 0 indirect [details]
Executables ide-backend-exe-cabal
Downloads 10775 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-28 [all 2 reports]

Readme for ide-backend-0.10.0.1

[back to package description]

ide-backend

Build Status

In order to use this package, you must have the ide-backend, ide-backend-server, and ide-backend-rts packages installed.

Hello World

The following simple example demonstrates basic usage of ide-backend.

{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Char8 as S8
import           Data.Monoid           ((<>))
import           IdeSession

main :: IO ()
main = do
    -- Initialization and providing some code
    sess <- initSession defaultSessionInitParams defaultSessionConfig
    let upd = updateSourceFile "Main.hs" "main = putStrLn \"Hello World\""
           <> updateCodeGeneration True
           <> updateGhcOpts ["-Wall"]
    updateSession sess upd print -- print is used for progress updates

    -- Print errors and warnings
    errs <- getSourceErrors sess
    mapM_ print errs

    -- Run the code
    ra <- runStmt sess "Main" "main"
    let loop = do
            res <- runWait ra
            case res of
                Left bs -> S8.putStr bs >> loop
                Right rr -> putStrLn $ "Run result: " ++ show rr
    loop

    -- Get some type information
    expTypes <- getExpTypes sess
    print $ expTypes "Main" SourceSpan
        { spanFilePath = "Main.hs"
        , spanFromLine = 1
        , spanFromColumn = 8
        , spanToLine = 1
        , spanToColumn = 9
        }

    -- Autocompletion
    autoCompletion <- getAutocompletion sess
    print $ autoCompletion "Main" "putS"

Sample output for this run:

[1 of 1] Compiling Main
SourceError {errorKind = KindWarning, errorSpan = Main.hs@1:1-1:30, errorMsg = "Top-level binding with no type signature: main :: IO ()"}
Hello World
Run result: RunOk
[(Main.hs@1:8-1:16,"String -> IO ()"),(Main.hs@1:8-1:30,"IO ()")]
[putStr (VarName) defined in base-4.8.0.0:System.IO at <no location info> (home base-4.8.0.0:System.IO) (imported from base-4.8.0.0:Prelude at Main.hs@1:1-1:1),putStrLn (VarName) :: String -> IO () defined in base-4.8.0.0:System.IO at <no location info> (home base-4.8.0.0:System.IO) (imported from base-4.8.0.0:Prelude at Main.hs@1:1-1:1)]

Versions and releases

The ide-backend component now uses versioned releases (following the normal package version policy). While we do not make tarballs, we will always tag versions.

Please only use tagged versions and not intermediate git hashes. Instead, please request new tagged releases (either from head or based on old versions).

Please consult the changelog below when integrating a new version of ide-backend. The changelog is the place where we will point out:

  • new features;
  • interface changes;
  • and other relevant information such as which areas may need particular attention and testing during integration.