Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions monad_lib/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(library
(name monad_lib)
(public_name snarky.monad_lib)
(library_flags -linkall)
(inline_tests)
(libraries core_kernel)
(preprocess
(pps ppx_jane ppx_deriving.eq bisect_ppx -- --conditional))
(synopsis "internal monad types for snarky"))
File renamed without changes.
3 changes: 3 additions & 0 deletions monad_lib/monad_lib.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Monad_let = Monad_let
module Monad_sequence = Monad_sequence
module Restrict_monad = Restrict_monad
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions src/base/as_prover0.ml → src/base/as_prover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ end)
(Types : Types.Types
with type field = Backend.Field.t
and type field_var = Backend.Cvar.t
and type 'a As_prover.t = (Backend.Cvar.t -> Backend.Field.t) -> 'a) =
and type 'a As_prover.t = (Backend.Cvar.t -> Backend.Field.t) -> 'a) : As_prover_intf.S with module Types := Types =
struct
module Types = Types
(**
`t` is a monad that has access to lookup table `tbl` with type `tbl : var -> field. In Haskell parlance,
`t` simply `Reader (var -> field)`.
*)

type 'a t = 'a Types.As_prover.t

let map t ~f tbl =
Expand All @@ -28,12 +34,6 @@ struct

let run t tbl = t tbl

let get_state _tbl s = (s, s)

let set_state s _tbl _ = (s, ())

let modify_state f _tbl s = (f s, ())

let map2 x y ~f tbl =
let x = x tbl in
let y = y tbl in
Expand All @@ -49,7 +49,7 @@ struct
let fields = Array.map ~f:tbl field_vars in
value_of_fields (fields, aux)

include Monad_let.Make (struct
include Monad_lib.Monad_let.Make (struct
type nonrec 'a t = 'a t

let map = `Custom map
Expand Down
6 changes: 3 additions & 3 deletions src/base/as_prover_intf.ml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module type Basic = sig
module type S = sig
module Types : Types.Types

type 'a t = 'a Types.As_prover.t

include Monad_let.S with type 'a t := 'a t
include Monad_lib.Monad_let.S with type 'a t := 'a t

val run : 'a t -> (Types.field_var -> Types.field) -> 'a

Expand All @@ -14,7 +14,7 @@ module type Basic = sig
val read : ('var, 'value) Types.Typ.t -> 'var -> 'value t

module Provider : sig
type 'a t
type 'a t := 'a Types.Provider.t

val run :
'a t -> (Types.field_var -> Types.field) -> Request.Handler.t -> 'a option
Expand Down
169 changes: 0 additions & 169 deletions src/base/backend_extended.ml

This file was deleted.

Loading
Loading