sinelaw/infernu

Installation instructions

Closed this issue · 5 comments

how do I use it?

Can we have instructions for installation. ( I know nothing of Haskell )

Can we have instructions for usage ? Does it just take js on stdin and outputs type inference data on stdout ?

What platform/OS are you running?

Generic instructions: first install cabal (Haskell's package manager), for example you can use the Haskell Platform.

Then, in the sjs directory, run:

cabal install

Check your ~/.cabal/bin directory, it should contain an sjs executable.

Remember this is still in early development and not yet ready for actual usage. :)

I am using linux.

What does sjs executable do ? Can you put the output of sjs --help in the README ?

sjs takes any number of .js files and type-checks them together, in order (symbols defined in one file can be used in any file after it, but not the other way around).

Keep in mind that the output is hardly readable right now. It will print for every line of JS a whole bunch of types, some of which belong to future lines. You need to sort of dig around to find the correct one. For example:

//(this: a -> TNumber)                   <-- the actual type of function 'f'
//TNumber                                <-- junk - actually refers to 'var x' below
//[TNumber]                              <-- junk - internal stuff
//                 TNumber               <-- the type of 'x' inside the function below
//                     TNumber           <-- the type of '1' 
//                        TNumber        <-- junk, internal
//                        [TNumber]      <-- junk, internal
//                               TNumber <-- type of 'x' below
function f() { var x = 1; return x; }
//(this: b -> TNumber)                   <-- the type of 'f'
//TNumber                                <-- junk - actually refers to 'var x' below
f;
//  TNumber                              <-- type of 'x'
//      TNumber                          <-- type of '2'
var x = 2;
//TNumber                                <-- type of 'x'
x;

When enough core features are completed, I'll fix the output as well.

Ha, it's too bad you use the "sjs" bin name, as it's also use by sweet.js (mozilla's js-with-macros)

@vendethiel - you're absolutely right, I've been looking for a new name. Please see #2