diff --git a/Makefile b/Makefile index e23360faa..5b6d5792c 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ docs: pre-build @mkdocs build -v --config-file ${MKDOCSCONFIG} .PHONY: serve -serve: docs +serve: @mkdocs serve --dev-addr localhost:${PORT} --config-file ${MKDOCSCONFIG} # In case you want to serve the docs using Python's built-in server. diff --git a/docs/blog/.authors.yml b/docs/blog/.authors.yml index d9645fed3..fbe640476 100644 --- a/docs/blog/.authors.yml +++ b/docs/blog/.authors.yml @@ -1,29 +1,30 @@ -chris: - name: Christopher Goes - description: Heliax - avatar: https://github.com/cwgoes.png +authors: + jonathan: + name: Jonathan Cubides + description: Heliax + avatar: https://github.com/jonaprieto.png -jonathan: - name: Jonathan Cubides - description: Heliax - avatar: https://github.com/jonaprieto.png + jan: + name: Jan Mas Rovira + description: Heliax + avatar: https://github.com/janmasrovira.png -jan: - name: Jan Mas Rovira - description: Heliax - avatar: https://github.com/janmasrovira.png + paul: + name: Paul Cadman + description: Heliax + avatar: https://github.com/paulcadman.png -paul: - name: Paul Cadman - description: Heliax - avatar: https://github.com/paulcadman.png + lukasz: + name: Łukasz Czajka + description: Heliax + avatar: https://github.com/lukaszcz.png -lukasz: - name: Łukasz Czajka - description: Heliax - avatar: https://github.com/lukaszcz.png + artem: + name: Artem Gureev + description: Heliax + avatar: https://github.com/vrom911.png -veronika: - name: Veronika Romashkina - description: Heliax - avatar: https://github.com/vrom911.png + veronika: + name: Veronika Romashkina + description: Heliax + avatar: https://github.com/vrom911.png diff --git a/docs/index.juvix b/docs/index.juvix new file mode 100644 index 000000000..2ef014814 --- /dev/null +++ b/docs/index.juvix @@ -0,0 +1,23 @@ +module index; + +import Stdlib.Prelude open; +import Stdlib.Data.Nat.Ord open; + +--8<-- [start:exponentiation] +module FastExponentiation; + + {-# unroll: 30 #-} + terminating + power' (acc a b : Nat) : Nat := + let + acc' : Nat := if (mod b 2 == 0) acc (acc * a); + in if (b == 0) acc (power' acc' (a * a) (div b 2)); + + power : Nat → Nat → Nat := power' 1; + +end; +--8<-- [end:exponentiation] + +--8<-- [start:intent] +-- ss +--8<-- [end:intent] diff --git a/docs/index.md b/docs/index.md index c7047ad1e..98809e193 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,18 +9,107 @@ hide: # Welcome to the Juvix documentation! -
- -
+
Juvix is an open-source, ever-evolving functional language for creating privacy-focused decentralized apps. It allows developers to write high-level programs that compile to WASM or, via [VampIR][vampir], to circuits for private execution using [Taiga][taiga] on [Anoma][anoma] or Ethereum. +
+ + +
+ +
+ +## :material-content-duplicate: Intents in Juvix for Anoma + +An intent is a high-level description of a transaction the user wants to +perform. It is a program that describes the conditions under which a transaction +is valid. For example, Alice wants to exchange 2 B or 1 A for 1 Dolphin. + +Read more on Anoma's intents [here](https://anoma.net/blog/intents-arent-real). + +
+ +
+ +
+ + +[Try Juvix now on Codespaces](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=102404734&machine=standardLinux32gb&location=WestEurope){ .md-button .md-button--primary } + +
+ + +
+ +
+ + +:octicons-mark-github-16: [`anoma/juvix-workshop`](https://github.com/anoma/taiga-simulator) + +```juvix +... +-- Alice is willing to exchange either 2 B or 1 A for 1 Dolphin. +module Apps.TwoPartyExchange; +--- Definitions related to Alice's intent +module AliceIntent; + logicFunction : LogicFunction + | kind tx := + let + {- check if the resource associated to + this logic function is among the created (output) resources. + Then check if alice's intent is satisfied. -} + createdRs : List Resource := createdResources tx; + createdHashes : List LogicHash := + map logicHash createdRs; + in isCreated kind + || quantityOfDenom Dolphin.denomination createdRs == 1 + && quantityOfDenom A.denomination createdRs == 1 + || quantityOfDenom Dolphin.denomination createdRs == 1 + && quantityOfDenom B.denomination createdRs == 2; + ... +``` + +
+ +
+ + +## :material-graph-outline: Juvix Compilation to Arithmetic Circuits + +
+ +
+ +A significant feature of Juvix includes compiling programs into arithmetic circuits for confidential execution, achieved via the in-house [VampIR][vampir] compiler. Arithmetic circuits model the computation of Juvix programs by representing polynomial computations. These circuits can be executed privately using [Taiga][taiga]. Essentially, arithmetic circuits are systematic polynomial equations expressed in a universal, canonical form. + +See more [Compiling Juvix programs to arithmetic circuits via Vamp-IR](./blog/posts/vampir-circuits.md). + +
+ +
+ +```juvix +module FastExponentiation; + +{-# unroll: 30 #-} +terminating +power' (acc a b : Nat) : Nat := + let acc' : Nat := if (mod b 2 == 0) acc (acc * a); + in if (b == 0) acc (power' acc' (a * a) (div b 2)); +power : Nat → Nat → Nat := power' 1; + +end; +``` + +
+ +
+ -This documentation covers various topics, including a concise introduction to -the Juvix ecosystem, which can be found in the [overview -section](./about/overview.md). +## :material-firework: Juvix is growing fast!
diff --git a/docs/juvix-packages.md b/docs/juvix-packages.md index f42062779..29dd0d49e 100644 --- a/docs/juvix-packages.md +++ b/docs/juvix-packages.md @@ -1,40 +1,61 @@ --- title: Juvix Packages and Projects +hide: + - navigation + - toc --- -## Juvix Packages +
-### [`anoma/juvix-containers`](https://github.com/anoma/juvix-containers) +- :octicons-mark-github-16: [`anoma/juvix-containers`](https://github.com/anoma/juvix-containers) -Immutable container types for Juvix. + *** -- [x] BinaryTree, Map, Queue, Set, Tree, UnbalancedSet, and much more to come. -- [x] Tests using [anoma/juvix-test](#anomajuvix-test). + Immutable container types for Juvix. -### [`anoma/juvix-quickcheck`](https://github.com/anoma/juvix-quickcheck) + - [x] BinaryTree, Map, Queue, Set, Tree, UnbalancedSet, and much more to come. + - [x] Tests using [anoma/juvix-test](#anomajuvix-test). -This package provides property-based testing for the Juvix programming language inspired by the popular Haskell library, QuickCheck. +- :octicons-mark-github-16: [`anoma/juvix-quickcheck`](https://github.com/anoma/juvix-quickcheck) -- [x] Automated testing: Generate random test cases to validate properties of Juvix code. + *** -### [`anoma/juvix-stdlib`](https://github.com/anoma/juvix-stdlib) + This package provides property-based testing for the Juvix programming language inspired by the popular Haskell library, QuickCheck. -Shipped with Juvix, the standard library provides a set of useful functions -and types for writing Juvix programs. + - [x] Automated testing: Generate random test cases to validate properties of Juvix code. -### [`anoma/juvix-test`](https://github.com/anoma/juvix-test) +- :octicons-mark-github-16: [`anoma/juvix-stdlib`](https://github.com/anoma/juvix-stdlib) -A unit testing framework for Juvix programs. + *** + + Shipped with Juvix, the standard library provides a set of useful functions + and types for writing Juvix programs. + +- :octicons-mark-github-16: [`anoma/juvix-test`](https://github.com/anoma/juvix-test) + + *** + + A unit testing framework for Juvix programs. + +
## Projects using Juvix -### [`anoma/taiga-simulator`](https://github.com/anoma/taiga-simulator) +
+ +- :octicons-mark-github-16: [`anoma/taiga-simulator`](https://github.com/anoma/taiga-simulator) + + *** + + The Taiga Simulator is a [Juvix](https://juvix.org) function that simulates the [Taiga](https://github.com/anoma/taiga) execution model. + +- :octicons-mark-github-16: [`anoma/juvix-e2e-demo`](https://github.com/anoma/juvix-e2e-demo) -A simulator for [Taiga execution model](https://github.com/anoma/taiga) written in Juvix. + *** -### [`anoma/juvix-e2e-demo`](https://github.com/anoma/juvix-e2e-demo) + A project for demostrating the process of generating arithmetic circuits from high-level specifications. This CodeSpace includes all the necessary compilers for circuit generation, such as Juvix, GEB, and VampIR. Furthermore, it features the Juvix VSCode extension to simplify writing Juvix programs and allows users to interact with and evaluate the resulting GEB/VampIR programs. -A project for demostrating the process of generating arithmetic circuits from high-level specifications. This CodeSpace includes all the necessary compilers for circuit generation, such as Juvix, GEB, and VampIR. Furthermore, it features the Juvix VSCode extension to simplify writing Juvix programs and allows users to interact with and evaluate the resulting GEB/VampIR programs. +
!!! info diff --git a/docs/juvix.yaml b/docs/juvix.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/docs/reference/language/aliases.md b/docs/reference/language/aliases.md index 7000279b6..c0aacfbe8 100644 --- a/docs/reference/language/aliases.md +++ b/docs/reference/language/aliases.md @@ -1,6 +1,6 @@ --- icon: material/rename-outline -comments: true +comments: false --- # Aliases diff --git a/docs/reference/language/axioms.md b/docs/reference/language/axioms.md index de04ecd15..c2b658b3c 100644 --- a/docs/reference/language/axioms.md +++ b/docs/reference/language/axioms.md @@ -1,6 +1,6 @@ --- icon: material/axe -comments: true +comments: false --- # Axiom diff --git a/mkdocs.insiders.yml b/mkdocs.insiders.yml index ffc67ed32..ab6437595 100644 --- a/mkdocs.insiders.yml +++ b/mkdocs.insiders.yml @@ -21,12 +21,14 @@ plugins: - trimmer - social - tags + - typeset - blog: enabled: true blog_dir: blog blog_toc: true draft: false authors: true + authors_file: blog/.authors.yml draft_on_serve: true post_date_format: short post_readtime: true @@ -86,8 +88,12 @@ extra: social: - icon: fontawesome/brands/github link: https://github.com/anoma/juvix + - icon: fontawesome/brands/discord + link: https://discord.gg/jwzaMZ2Sct + name: Juvix Discord - icon: fontawesome/brands/twitter link: https://twitter.com/juvixlang + name: Juvix Twitter extra: consent: title: Cookie consent diff --git a/mkdocs.yml b/mkdocs.yml index 6ec8faf6b..4a41e4585 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -63,7 +63,7 @@ theme: custom_dir: "docs/overrides" font: - text: Incosolata + text: Roboto Flex code: JetBrains Mono favicon: assets/images/favicon/favicon.ico @@ -71,8 +71,11 @@ theme: icon: repo: fontawesome/brands/github - edit: material/pencil - view: material/eye + edit: material/file-eye + view: material/file-edit + search: octicons/search-16 + previous: octicons/arrow-left-16 + next: octicons/arrow-right-16 markdown_extensions: - abbr