andreypopp / andreypopp/rrun

stdlib

Aberta
#2 8 comentários 0 reações 0 responsáveis Ver no GitHub
design
Linguagem predominante
OCaml
Estrelas
19
Forks
1
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.