-
-
Save bqv/646ecb0be166555faddaed46ef57fe93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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