mirror of
https://github.com/anoma/juvix.git
synced 2024-12-26 17:13:35 +03:00
3b34f6e4ff
This PR adds frontend support for the Anoma Random API: The frontend builtin APIs are: ``` builtin anoma-random-generator axiom RandomGenerator : Type; builtin anoma-random-generator-init axiom randomGeneratorInit : Nat -> RandomGenerator; builtin anoma-random-generator-split axiom randomGeneratorSplit : RandomGenerator -> Pair RandomGenerator RandomGenerator; builtin anoma-random-next-bytes axiom randomNextBytes : Nat -> RandomGenerator -> Pair ByteArray RandomGenerator; ``` ### Nockma Evaluator The Nockma evaluator intercepts the corresponding Anoma random stdlib calls using the [System.Random](https://hackage.haskell.org/package/random-1.2.1.2/docs/System-Random.html) API. The implementation uses the [splitmix](https://hackage.haskell.org/package/splitmix-0.1.0.5/docs/System-Random-SplitMix.html) generator directly because it has an API to destructure the generator into a pair of integers. We can use this to serialise the generator. * Closes https://github.com/anoma/juvix/issues/2902 |
||
---|---|---|
.. | ||
Compilation | ||
Compilation.hs |