Skip to content

Instantly share code, notes, and snippets.

@bqv

bqv/error.txt Secret

Last active July 7, 2017 09:03
Show Gist options
  • Save bqv/646ecb0be166555faddaed46ef57fe93 to your computer and use it in GitHub Desktop.
Save bqv/646ecb0be166555faddaed46ef57fe93 to your computer and use it in GitHub Desktop.
ocamlfind ocamlopt -package unix,extlib,dynlink,lwt.unix,core,curl,xml-light -thread -shared -o plugins/weather.cmxs plugins.ml plugins/weather.ml
File "plugins/weather.ml", line 60, characters 26-164:
Error: Signature mismatch:
...
Values do not match:
val handle_privmsg :
< writef : string -> 'a -> string -> 'b; .. > ->
'a -> string -> 'b
is not included in
val handle_privmsg : #Plugins.bot -> string -> string -> unit Lwt.t
File "plugins/weather.ml", line 62, characters 8-22:
Actual declaration
open Lwt
class type bot = object
method writef : 'a. ('a, unit, string, unit Lwt.t) format4 -> 'a
end
module type Plugin = sig
val initialize : #bot -> unit Lwt.t
val handle_privmsg : #bot -> string -> string -> unit Lwt.t
end;;
let table : (string, (module Plugin)) Hashtbl.t = Hashtbl.create 7
open Plugins
open Lwt
open Xml
let weather location =
(* ... *)
module Weather : Plugin = struct
let initialize bot = return ()
let handle_privmsg bot chan msg =
weather msg |> bot#writef "NOTICE %s :%s" chan
end
let () = Hashtbl.replace Plugins.table "weather" (module Weather)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment