From d0f9ddad5ecceb525868672eb4d1697ca3464bd3 Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Sun, 8 Dec 2024 18:43:14 +0100 Subject: [PATCH] Pretty good version --- lib/miou_solo5.default.ml | 2 -- lib/miou_solo5.mli | 2 -- lib/miou_solo5.solo5.ml | 14 -------------- 3 files changed, 18 deletions(-) diff --git a/lib/miou_solo5.default.ml b/lib/miou_solo5.default.ml index 711adf6..62cbb05 100644 --- a/lib/miou_solo5.default.ml +++ b/lib/miou_solo5.default.ml @@ -98,9 +98,7 @@ and ('k, 'res) devices = let net name = Net name let block name = Block name -let opt arg = Args [ arg ] let map _fn args = Args args -let dft _v arg = Args [ arg ] let const _ = Args [] type t = [ `Block of string | `Net of string ] diff --git a/lib/miou_solo5.mli b/lib/miou_solo5.mli index 214677d..f809d62 100644 --- a/lib/miou_solo5.mli +++ b/lib/miou_solo5.mli @@ -190,8 +190,6 @@ type ('k, 'res) devices = val net : string -> (Net.t * Net.cfg) arg val block : string -> Block.t arg -val opt : 'a arg -> 'a option arg val map : 'f -> ('f, 'a) devices -> 'a arg -val dft : 'a -> 'a arg -> 'a arg val const : 'a -> 'a arg val run : ?g:Random.State.t -> ('a, 'b) devices -> 'a -> 'b diff --git a/lib/miou_solo5.solo5.ml b/lib/miou_solo5.solo5.ml index 48d8f8e..3b369d6 100644 --- a/lib/miou_solo5.solo5.ml +++ b/lib/miou_solo5.solo5.ml @@ -508,8 +508,6 @@ type 'a arg = | Net : string -> (Net.t * Net.cfg) arg | Block : string -> Block.t arg | Map : ('f, 'a) devices * 'f -> 'a arg - | Opt : 'a arg -> 'a option arg - | Dft : 'a * 'a arg -> 'a arg | Const : 'a -> 'a arg and ('k, 'res) devices = @@ -518,9 +516,7 @@ and ('k, 'res) devices = let net name = Net name let block name = Block name -let opt value = Opt value let map fn args = Map (args, fn) -let dft v arg = Dft (v, arg) let const v = Const v let rec ctor : type a. a arg -> a = function @@ -534,17 +530,7 @@ let rec ctor : type a. a arg -> a = function | Ok t -> t | Error (`Msg msg) -> failwithf "%s." msg end - | Opt arg -> begin - match go (fun fn -> fn ()) [ arg ] (fun v () -> Some v) with - | v -> v - | exception _ -> None - end | Const v -> v - | Dft (v, arg) -> begin - match go (fun fn -> fn ()) [ arg ] (fun v () -> v) with - | v' -> v' - | exception _ -> v - end | Map (args, fn) -> go (fun fn -> fn ()) args fn and go : type k res. ((unit -> res) -> res) -> (k, res) devices -> k -> res =