Thursday, June 13, 2013

The Interactive Solver

So, I have coerced haskeline into giving me a IDE.

Here is a little demonstration of what it can do so far.

First you can search the tree yourself, using 'go n' and 'up'. (This becomes very tedious very quickly)

On the other end of the spectrum, you can type 'auto' and have the dependency solver solve it for you.

However, one of the more interesting commands lies in between.

Suppose you wanted to install 'async', but you would like to enable the test-stanza, and
have your favourite version of stm which you would really like to use.

Then the following session would seem realistic:

  [hsenv]martin@office:~$ cabal install async --interactive 
  Resolving dependencies...
  Welcome to cabali!
  go n                -- chooses n - alternatively "n" does the same
  up                  -- goes up one step
  top                 -- goes all the way to the top
  autoLog             -- prints the log of an automated run
  auto                -- starts the automatic solver
  goto aeson          -- runs the parser until it sets aeson's version
  got aeson:developer -- runs the parser until it sets the flag developer for aeson
  ;                   -- chains commands (e.g. 1;1;1;top does nothing)
  Node: GoalChoice
 (1)  OpenGoal: async 
  > goto async:test | stm
  Node: SChoice: QSN: async-
    QGoalReason: PDependency (depended by): async-
    Bool False
  (1)  False 
  (2)  True 

  > 2
  Node: GoalChoice
  (1)  OpenGoal: HUnit 
  (2)  OpenGoal: test-framework-hunit 
  (3)  OpenGoal: test-framework 
  (4)  OpenGoal: stm 

  > goto async:test | stm
  Node: PChoice: QPN: stm
    QGoalReason: PDependency (depended by): async-
  (1)  Version 2.4.2 (Installed) 
  (2)  Version 2.4.2 
  (3)  Version 2.4 
  (4)  Version 2.3 
  (5)  Version 
  (6)  Version 
  (7)  Version  (fails)
  (8)  Version  (fails)
  (9)  Version  (fails)
  (10)  Version  (fails)
  (11)  Version  (fails)
  (12)  Version 2.1  (fails)
  > 4
  Node: GoalChoice
  (1)  OpenGoal: stm-2.3:base4 
  (2)  OpenGoal: stm-2.3:base4 
  > auto
  Node: Done! 
  HUnit: ["test-framework-hunit","async"]
  ansi-terminal: ["ansi-wl-pprint","ansi-wl-pprint","test-framework"]
  ansi-wl-pprint: ["test-framework"]
  array: ["stm","regex-base","regex-posix","text","containers","deepseq"]
  async: []
  base: ["stm","stm","stm","unix","ansi-terminal","ansi-terminal","ansi-wl-pprint","ansi-wl-pprint","transformers","mtl","regex-base","regex-posix","old-locale","time","bytestring","text","xml","hostname","random","containers","test-framework","extensible-exceptions","test-framework-hunit","array","deepseq","HUnit","HUnit","HUnit","async","async"]
  bytestring: ["unix","regex-base","regex-posix","text","xml"]
  containers: ["regex-base","regex-posix","test-framework"]
  deepseq: ["time","bytestring","text","containers","HUnit"]
  extensible-exceptions: ["test-framework","test-framework-hunit"]
  ghc-prim: ["bytestring","text","containers","integer-gmp","base"]
  hostname: ["test-framework"]
  integer-gmp: ["text","base"]
  mtl: ["regex-base"]
  old-locale: ["time","test-framework"]
  random: ["test-framework"]
  regex-base: ["regex-posix"]
  regex-posix: ["test-framework"]
  rts: ["ghc-prim","base"]
  stm: ["async"]
  test-framework: ["test-framework-hunit","async"]
  test-framework-hunit: ["async"]
  text: ["xml"]
  time: ["unix","random","test-framework"]
  transformers: ["mtl"]
  unix: ["ansi-terminal","ansi-terminal"]
  xml: ["test-framework"]
  > install
  Ooops.. not implemented yet.

By the way, suggestions for features are always welcome!

The next big thing to work on is to make it friendlier, with less distracting output.

If you would like to try this out for yourself, here is how that would work:

  $ git clone
  $ cd cabal
  $ hsenv
  $ source .hsenv/bin/activate
  $ cd Cabal
  $ cabal install
  $ cd ../cabal-install
  $ cabal install
  $ cabal install async --interactive

Have fun!

No comments:

Post a Comment