Skip to content

Commit

Permalink
series: export core functions for App usage (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
smunix authored Feb 19, 2021
1 parent f0dff6e commit 90c9865
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 11 additions & 0 deletions include/hobbes/db/series.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ namespace hobbes {

typedef uint64_t ufileref;

// A -> (A)
MonoTypePtr entuple(const MonoTypePtr&);
// A N -> carray A N
MonoTypePtr carrayty(const MonoTypePtr&, const MonoTypePtr&);
// A -> ^x.(()+(A*x@?))
MonoTypePtr storedListOf(const MonoTypePtr&);
// A N -> fseq A N
MonoTypePtr storedStreamOf(const MonoTypePtr&, size_t);
// A -- StoredAs A B --> B
MonoTypePtr storeAs(cc* c, const MonoTypePtr&);

class RawStoredSeries {
public:
RawStoredSeries(cc*, writer*, const std::string&, const MonoTypePtr&, size_t);
Expand Down
10 changes: 5 additions & 5 deletions lib/hobbes/db/series.C
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,22 @@ void StoredSeries::clear(bool signal) {
*******/

// A -> (A)
static MonoTypePtr entuple(const MonoTypePtr& ty) {
MonoTypePtr entuple(const MonoTypePtr& ty) {
Record::Members ms;
ms.push_back(Record::Member(".f0", ty));
return MonoTypePtr(Record::make(ms));
}

// A N -> carray A N
static MonoTypePtr carrayty(const MonoTypePtr& ty, const MonoTypePtr& n) {
MonoTypePtr carrayty(const MonoTypePtr& ty, const MonoTypePtr& n) {
Record::Members ms;
ms.push_back(Record::Member("avail", primty("long")));
ms.push_back(Record::Member("buffer", FixedArray::make(tvar("t"), tvar("c"))));
return tapp(primty("carray", tabs(str::strings("t","c"), Record::make(ms))), list(ty, n));
}

// A -> ^x.(()+(A*x@?))
static MonoTypePtr storedListOf(const MonoTypePtr& ty) {
MonoTypePtr storedListOf(const MonoTypePtr& ty) {
Record::Members pms;
pms.push_back(Record::Member(".f0", ty));
pms.push_back(Record::Member(".f1", fileRefTy(tvar("x"))));
Expand All @@ -182,12 +182,12 @@ static MonoTypePtr storedListOf(const MonoTypePtr& ty) {
}

// A N -> fseq A N
static MonoTypePtr storedStreamOf(const MonoTypePtr& ty, size_t n) {
MonoTypePtr storedStreamOf(const MonoTypePtr& ty, size_t n) {
return tapp(primty("fseq", tabs(str::strings("t", "c"), fileRefTy(storedListOf(fileRefTy(carrayty(tvar("t"), tvar("c"))))))), list(ty, tlong(n)));
}

// A -- StoredAs A B --> B
static MonoTypePtr storeAs(cc* c, const MonoTypePtr& ty) {
MonoTypePtr storeAs(cc* c, const MonoTypePtr& ty) {
// construct the constraint that the input type stores to some output type
MonoTypeUnifier u(c->typeEnv());
MonoTypePtr sty = freshTypeVar();
Expand Down

0 comments on commit 90c9865

Please sign in to comment.