You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7782 Reporter: sagotch Assigned to:@Octachron Status: resolved (set by @Octachron on 2018-04-20T08:51:32Z) Resolution: not a bug Priority: normal Severity: minor Platform: Mac OS: Mac OS OS Version: 10.13.4 Version: 4.06.1 Category: typing
Bug description
let for_all =
let module IntSet =
Set.Make (struct type t = int let compare = Pervasives.compare end)
in
fun fn data ->
let maybe_update acc i v = if fn v then acc else IntSet.add i acc in
let init =
let rec fold i acc = function
| v :: tl -> fold (i + 1) (maybe_update acc i v) tl
| [] -> acc
in
fold 0 IntSet.empty
in
let update_idx_after i f acc =
IntSet.map (fun i' -> if i' >= i then f i' 1 else i') acc
in
let f = fun acc -> function
| Set x -> init x
| Patch updates ->
List.fold_left
(fun acc -> function
| X (i, i') ->
if IntSet.mem i acc = IntSet.mem i' acc
then acc
else if IntSet.mem i acc
then IntSet.add i' (IntSet.remove i acc)
else IntSet.add i (IntSet.remove i' acc)
| R i ->
let acc = update_idx_after i (-) acc in
IntSet.remove i acc
| I (i, v) ->
let acc = update_idx_after i (+) acc in
maybe_update acc i v
| U (i, v) ->
maybe_update (IntSet.remove i acc) i v)
acc
updates
in
React.S.fold f (init (value data)) (event data)
|> React.S.map IntSet.is_empty
Error: The implementation src/reactiveData.ml
does not match the interface src/reactiveData.cmi:
...
In module RList:
Values do not match:
val for_all : ('_weak1 -> bool) -> '_weak1 t -> bool React.signal
is not included in
val for_all : ('a -> bool) -> 'a t -> bool React.signal
File "src/reactiveData.mli", line 194, characters 2-54:
Expected declaration
File "src/reactiveData.ml", line 476, characters 6-13:
Actual declaration
This is the intended behavior. "Set.Make(...)" is a functor application, therefore "let module M = Set.make() in fun ... -> ... " is not a value and the value restriction applies.
Original bug ID: 7782
Reporter: sagotch
Assigned to: @Octachron
Status: resolved (set by @Octachron on 2018-04-20T08:51:32Z)
Resolution: not a bug
Priority: normal
Severity: minor
Platform: Mac
OS: Mac OS
OS Version: 10.13.4
Version: 4.06.1
Category: typing
Bug description
let for_all =
let module IntSet =
Set.Make (struct type t = int let compare = Pervasives.compare end)
in
fun fn data ->
let maybe_update acc i v = if fn v then acc else IntSet.add i acc in
let init =
let rec fold i acc = function
| v :: tl -> fold (i + 1) (maybe_update acc i v) tl
| [] -> acc
in
fold 0 IntSet.empty
in
let update_idx_after i f acc =
IntSet.map (fun i' -> if i' >= i then f i' 1 else i') acc
in
let f = fun acc -> function
| Set x -> init x
| Patch updates ->
List.fold_left
(fun acc -> function
| X (i, i') ->
if IntSet.mem i acc = IntSet.mem i' acc
then acc
else if IntSet.mem i acc
then IntSet.add i' (IntSet.remove i acc)
else IntSet.add i (IntSet.remove i' acc)
| R i ->
let acc = update_idx_after i (-) acc in
IntSet.remove i acc
| I (i, v) ->
let acc = update_idx_after i (+) acc in
maybe_update acc i v
| U (i, v) ->
maybe_update (IntSet.remove i acc) i v)
acc
updates
in
React.S.fold f (init (value data)) (event data)
|> React.S.map IntSet.is_empty
Error: The implementation src/reactiveData.ml
does not match the interface src/reactiveData.cmi:
...
In module RList:
Values do not match:
val for_all : ('_weak1 -> bool) -> '_weak1 t -> bool React.signal
is not included in
val for_all : ('a -> bool) -> 'a t -> bool React.signal
File "src/reactiveData.mli", line 194, characters 2-54:
Expected declaration
File "src/reactiveData.ml", line 476, characters 6-13:
Actual declaration
Steps to reproduce
Try to compile ocsigen/reactiveData#23 but with
let for_all =
let module IntSet =
Set.Make (struct type t = int let compare = Pervasives.compare end)
in
fun fn data ->
instead of
let for_all fn data =
Additional information
Delaring the IntSet module at toplevel solved the issue.
Declaring it inside the function works as well.
i.e.:
let for_all fn data =
let module IntSet =
Set.Make (struct type t = int let compare = Pervasives.compare end)
in
The text was updated successfully, but these errors were encountered: