Git Product home page Git Product logo

rrun's Introduction

rrun

WIP: DO NOT USE, this piece of software isn't ready for general consumption, some things are not implemented, some things are not working properly.

Build Status

rrun allows to seamlessly run Reason/OCaml code with native speed.

Motivation

rrun aims to implement the following workflow for engineering software with Reason/OCaml language:

  • Start writing code by opening a plain *.re or *.ml file
    • ... with autocomplete and real time error reporting available
    • ... having a good set of standard libraries for interacting with a system
    • ... reusing 3rd party code from a local file system or from the network
  • Code can be run with a single command invocation rrun ./myapp.re
    • ... which builds the code and caches the result
    • ... and sandboxes (configurable) execution by preventing it from reading/writing to disk or accessing network

Installation (not implemented yet)

Install rrun via npm:

% npm install -g rrun

Usage

Running Code

Run Reason/OCaml code with:

% rrun ./app.re
% rrun ./app.ml

rrun uses ocamlopt to compile sources and then caches compiled artifacts, on second invocation there will be no recompilation.

Dependencies

You can specify dependencies between modules with [%import "..."] syntax:

module Url = [%import "./Url.re"]
module Chalk = [%import "https://example.com/Chalk.re"]

let url = Url.make("http://example.com");
print_endline(Chalk.red(Url.show(url)));

IDE support

There's rrun edit command which will run your configured editor (via $EDITOR) in a properly configured environment:

% rrun edit ./app.re

Sandboxed Execution

TODO

Internals

TODO

Development

Workflow

% npm install -g esy
% git clone https://github.com/andreypopp/rrun.git
% cd rrun
% esy install
% esy build
% esy "$EDITOR"

Roadmap

  • Sandboxed execution

  • Support interfaces

  • Build Reason code

  • Build OCaml code

  • Support [%import "./relative/path.ml"] dependencies

  • Support [%import "https://secure/url.ml"] dependencies

rrun's People

Contributors

andreypopp avatar kennetpostigo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rrun's Issues

stdlib

We want to ship a set of libraries with rrun, I'm now thinking more about
libraries which implement portable APIs to operating system facilities rather
than data structures (though we should explore this topic too).

How to expose stdlib to user code

I think we should use [%import "..."] syntax which is used already for user
code. Currently such syntax only allows relative paths and https URLs, that
means we can use plain (non-path) strings for stdlib:

module Path = [%import "path"]
module Cmd = [%import "cmd"]

CamelCase or snake_case

Definitely CamelCase.

Concurrency primitive

All I/O should be concurrent, like in Node.

Decide what we should use:

  • lwt
  • async
  • repromise

I'd like to explore repromise but we might need to sync up with aantron on
that - is it ready for experimentation at least?

Proposed modules to include in stdlib

  • Promise - concurrency primitive exposed (repromise or whatever we've chosen).

    • Promise.return

    • Promise.join

    • Promise.sleep

    • Promise.List.map

    • Promise.List.iter

  • Path - working with filesystem paths, I like how fpath is designed, we
    might just take it and use.

  • Cmd - compose command invocations and execute them, I like how bos
    library has Bos.Cmd and Bos.OS.Cmd, few notes regarding them though:

    • While bos has two separate modules for constructing commands and running
      commands, I think we should go with a single Cmd module.

    • Bos.Cmd allows to construct and empty command invocation which is then
      fails if you try executing it. I think we should disallow that and I already
      have such Cmd implementation in esy-lib/Cmd, we could take it.

    • I like how bos allows you to compose command invocations with combinators
      (modified bos API in the example below):

      let catString = (s) =>
        Cmd.(inString(s) |> run v("cat") |> outString);
      
  • Fs - access to file system:

    • Fs.readFile
    • Fs.writeFile
    • Fs.listDir
    • Fs.createDir
    • ...
  • Json

  • Http - HTTP protocol

    • Http.Fetch - HTTP client

    • Http.Serve - HTTP server

  • CommandLine - parsing command line arguments/options. Take a look at
    cmdliner maybe? Though it's not as trivial to use, might take something more
    simple.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.