argotorg / argotorg/act

Container abstractions: arrays, mappings, ....

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
279
Forks
51
Avg merge
17h 42m
Merged PRs (30d)
1

Description

In many cases, we want specifications to be expressed in terms of the various containers present in the source language. Such containers include at least the following:
- Arrays
- Mappings
(n.b. that an Array can be represented as a mapping whose keys are integers and with an additional entry keeping it's length)
but future version may also include abstractions for structs / tuples (products) and enums / abstract data types (coproducts) of appropriate types.

Of course, there are lots of possibilities here as far as syntax is concerned, but generally, we want to support at least:
- map (a.k.a. fmap), applying a function to all the containers values.
- reduce (a.k.a. fold, accumulate...), applying a function to a container recursively, aggregating the result.

Some conveniences like `sum`, `length` and `slice` would also be nice.

To keep things practical, I suggest we only consider containers that are supported in the ABIEncoder for now.
For specificity, I'll keep a list below of supported HLL functions. In the following, `container(A)` denotes a container (array or mapping), whose type of values is A.

- map : container(A) -> (A -> B) -> container(B)
- reduce: container(A) -> (A -> A -> A) -> A
- Lambda abstractions
- Conveniences:
length, sum, product, slice, reduce (overloaded to also take index)

Contributor guide

No contributing guide indexed for this repository

Research direction

No files or tests are named. Start by locating the ABIEncoder support and the existing HLL function definitions, then determine how arrays and mappings are represented before assessing map, reduce, lambda, and convenience operations. Done means agreeing on the supported container model and implementing the listed operations with coverage for the ABIEncoder-supported types.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.