Skip to content

Instantly share code, notes, and snippets.

@stedolan
Created April 8, 2016 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stedolan/fbdc974dbf96be8959908fed3be2ada7 to your computer and use it in GitHub Desktop.
Save stedolan/fbdc974dbf96be8959908fed3be2ada7 to your computer and use it in GitHub Desktop.
module rec Element' : sig
module T : sig
type t = {
level : Container'.t;
}
end
type t = T.t
val remove_from_container : t -> unit
end = struct
module T = Element'.T
include T
let remove_from_container t =
Container'.remove_element t.level t
end
and Container' : sig
type t = { mutable elements : Element'.t list }
val remove_element : t -> Element'.t -> unit
end = struct
type t = {
mutable elements : Element'.t list;
}
let remove_element t element =
t.elements <-
List.filter (fun element' -> not (element == element')) t.elements
end
module rec Element : sig
type t
val remove_from_container : t -> unit
end = Element'
and Container : sig
type t
val remove_element : t -> Element.t -> unit
end = Container'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment