ocaml-multicore/effects-examples
소개
Multicore OCaml에서 대수적 이펙트를 사용하는 방법을 보여 주는 예제입니다.
학습 및 교육측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalOCaml effects examples
Examples to illustrate the use of algebraic effects in OCaml. See
- Effective Concurrency with Algebraic Effects
- Pearls of Algebraic Effects and Handlers
- Retrofitting Effect Handlers onto OCaml
Examples
- A concurrent round-robin scheduler
- Mutable state
- ML-style refs
- Transactional state
- Asynchronous IO in direct-style
- Dynamic wind
- Deriving generator from any interator
- Promises
- Monadic reflection
- MVars
- Chameneos-redux
- Message-passing pipeline: Sieve of Eratostheneses
- Deep pipes
- Non termination from effects
- Continuation cloning is tricky
- A solution to the Same Fringe Problem
- Reverse-mode Algorithmic Differentiation
The original implementation of Multicore OCaml allowed a user to Obj.clone_continuation. This has been removed, the examples that used this are in the multishot directory. See this conversation about the removal of this feature. They now use the ocaml-multicont library.
- Delimcc encoding
- Nondeterminism
- Backtracking N-Queens
- Memoization
- A mathematical game: Nim
- Dynamic State
Running the examples
To run the examples with OCaml, be sure to install Opam with these instructions. These examples use the new effect syntax introduced with OCaml 5.3 and onwards. If you wish to see the examples which used the underlying effect functions directly, please checkout the 5.1.1 tag of this repository instead.
# After cloning this repository, create a 5.4.1 switch
opam update
opam switch create 5.4.1
opam install . --deps-only
Running make will build all of the examples. If you want to run a single executable that is built with dune you can run:
$ dune exec -- ./<executable_name>.exe
External examples
These are other examples that utilise OCaml effect handlers that are not in this repo:
Citation
If you are citing this work in an academic paper, please cite the PLDI 2021 paper "Retrofitting Effect Handlers onto OCaml": https://dl.acm.org/doi/10.1145/3453483.3454039.
관련 프로젝트 살펴보기
불러오는 중…