Skip to content

Commit 267a573

Browse files
authored
Merge pull request #18 from imandra-ai/john/decoders
Make the project compatible with Decoder 0.7, add a `make format` command
2 parents def9ba6 + b40dc0b commit 267a573

File tree

6 files changed

+39
-31
lines changed

6 files changed

+39
-31
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@ _opam:
3434
opam-install-deps: _opam
3535
opam install ./imandra-http-api-client.opam -y --deps-only
3636

37+
format:
38+
@dune build @fmt --auto-promote
39+
3740
.PHONY: all clean watch tests

bin/dune

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
(executables
44
(names test_http_api_eval test_http_api_instance test_http_api_verify)
5-
(public_names
6-
test_http_api_eval
7-
test_http_api_instance
8-
test_http_api_verify)
5+
(public_names test_http_api_eval test_http_api_instance test_http_api_verify)
96
(libraries containers imandra_http_api_client)
107
(modules test_http_api_eval test_http_api_instance test_http_api_verify))

src/api.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@ module Encoders (E : D.Encode.S) = struct
454454
let eval_req_src (x : Request.eval_req_src) =
455455
obj [ "syntax", src_syntax x.syntax; "src", string x.src ]
456456

457-
let decomp_req_src (x : Request.decomp_req_src) =
457+
let decomp_req_src (x : Request.decomp_req_src) =
458458
obj
459459
([ "name", string x.name; "prune", bool x.prune ]
460-
|> append_opt_key "assuming" string x.assuming
461-
|> append_opt_key "max_rounds" int x.max_rounds
460+
|> append_opt_key "assuming" string x.assuming
461+
|> append_opt_key "max_rounds" int x.max_rounds
462462
|> append_opt_key "stop_at" int x.stop_at)
463463
end
464464

src/api.mli

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ module Decoders : functor (D : Decoders.Decode.S) -> sig
150150
module Request : sig
151151
module Hints : sig
152152
module Induct : sig
153-
val structural : (D.value, Request.Hints.Induct.t) D.t_let
153+
val structural : Request.Hints.Induct.t D.decoder
154154

155-
val functional : (D.value, Request.Hints.Induct.t) D.t_let
155+
val functional : Request.Hints.Induct.t D.decoder
156156

157-
val t : (D.value, Request.Hints.Induct.t) D.t_let
157+
val t : Request.Hints.Induct.t D.decoder
158158
end
159159

160160
module Method : sig
161-
val unroll : (D.value, Request.Hints.Method.unroll) D.t_let
161+
val unroll : Request.Hints.Method.unroll D.decoder
162162

163-
val ext_solver : (D.value, Request.Hints.Method.ext_solver) D.t_let
163+
val ext_solver : Request.Hints.Method.ext_solver D.decoder
164164

165165
val t : Request.Hints.Method.t D.decoder
166166
end

src/imandra_http_api_client.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let default_headers (c : Config.t) =
3333
let make_body enc x =
3434
Decoders_yojson.Basic.Encode.encode_string enc x |> Cohttp_lwt.Body.of_string
3535

36-
let read_response dec s=
36+
let read_response dec s =
3737
match
3838
Decoders_yojson.Basic.Decode.decode_string (D.Response.with_capture dec) s
3939
with

src/imandra_http_api_client.mli

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,21 @@ module D : sig
8585
module Hints : sig
8686
module Induct : sig
8787
val structural :
88-
(Yojson.Basic.t, Api.Request.Hints.Induct.t) Decoders.Decoder.t
88+
Api.Request.Hints.Induct.t Decoders_yojson.Basic.Decode.decoder
8989

9090
val functional :
91-
(Yojson.Basic.t, Api.Request.Hints.Induct.t) Decoders.Decoder.t
91+
Api.Request.Hints.Induct.t Decoders_yojson.Basic.Decode.decoder
9292

93-
val t : (Yojson.Basic.t, Api.Request.Hints.Induct.t) Decoders.Decoder.t
93+
val t : Api.Request.Hints.Induct.t Decoders_yojson.Basic.Decode.decoder
9494
end
9595

9696
module Method : sig
9797
val unroll :
98-
(Yojson.Basic.t, Api.Request.Hints.Method.unroll) Decoders.Decoder.t
98+
Api.Request.Hints.Method.unroll Decoders_yojson.Basic.Decode.decoder
9999

100100
val ext_solver :
101-
( Yojson.Basic.t,
102-
Api.Request.Hints.Method.ext_solver )
103-
Decoders.Decoder.t
101+
Api.Request.Hints.Method.ext_solver
102+
Decoders_yojson.Basic.Decode.decoder
104103

105104
val t : Api.Request.Hints.Method.t Decoders_yojson.Basic.Decode.decoder
106105
end
@@ -164,46 +163,55 @@ val read_error :
164163
val read :
165164
'a Decoders_yojson.Basic.Decode.decoder ->
166165
Cohttp.Response.t * Cohttp_lwt.Body.t ->
167-
('a Api.Response.with_capture, [> error] ) Lwt_result.t
166+
('a Api.Response.with_capture, [> error ]) Lwt_result.t
168167

169168
val eval :
170169
Config.t ->
171170
Api.Request.eval_req_src ->
172-
(Api.Response.eval_result Api.Response.with_capture, [> error]) result Lwt.t
171+
(Api.Response.eval_result Api.Response.with_capture, [> error ]) result Lwt.t
173172

174173
val get_history :
175-
Config.t -> (string Api.Response.with_capture, [> error]) result Lwt.t
174+
Config.t -> (string Api.Response.with_capture, [> error ]) result Lwt.t
176175

177176
val get_status :
178-
Config.t -> (string Api.Response.with_capture, [> error]) result Lwt.t
177+
Config.t -> (string Api.Response.with_capture, [> error ]) result Lwt.t
179178

180179
val instance_by_name :
181180
Config.t ->
182181
Api.Request.instance_req_name ->
183-
(Api.Response.instance_result Api.Response.with_capture, [> error]) result Lwt.t
182+
(Api.Response.instance_result Api.Response.with_capture, [> error ]) result
183+
Lwt.t
184184

185185
val instance_by_src :
186186
Config.t ->
187187
Api.Request.instance_req_src ->
188-
(Api.Response.instance_result Api.Response.with_capture, [> error]) result Lwt.t
188+
(Api.Response.instance_result Api.Response.with_capture, [> error ]) result
189+
Lwt.t
189190

190191
val reset :
191-
Config.t -> unit -> (unit Api.Response.with_capture, [> error]) result Lwt.t
192+
Config.t -> unit -> (unit Api.Response.with_capture, [> error ]) result Lwt.t
192193

193194
val shutdown :
194-
Config.t -> unit -> (string Api.Response.with_capture, [> error]) result Lwt.t
195+
Config.t ->
196+
unit ->
197+
(string Api.Response.with_capture, [> error ]) result Lwt.t
195198

196199
val verify_by_name :
197200
Config.t ->
198201
Api.Request.verify_req_name ->
199-
(Api.Response.verify_result Api.Response.with_capture, [> error]) result Lwt.t
202+
(Api.Response.verify_result Api.Response.with_capture, [> error ]) result
203+
Lwt.t
200204

201205
val verify_by_src :
202206
Config.t ->
203207
Api.Request.verify_req_src ->
204-
(Api.Response.verify_result Api.Response.with_capture, [> error]) result Lwt.t
208+
(Api.Response.verify_result Api.Response.with_capture, [> error ]) result
209+
Lwt.t
205210

206211
val decompose :
207212
Config.t ->
208213
Api.Request.decomp_req_src ->
209-
(Yojson.Basic.t Api.Response.decompose_result Api.Response.with_capture, [> error]) result Lwt.t
214+
( Yojson.Basic.t Api.Response.decompose_result Api.Response.with_capture,
215+
[> error ] )
216+
result
217+
Lwt.t

0 commit comments

Comments
 (0)