Skip to content

Instantly share code, notes, and snippets.

@Wilfred

Wilfred/demo.ml Secret

Last active April 8, 2019 12:58
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 Wilfred/9fa93451a5a33ebbb3cf4e841781fcef to your computer and use it in GitHub Desktop.
Save Wilfred/9fa93451a5a33ebbb3cf4e841781fcef to your computer and use it in GitHub Desktop.
inserting a key and value in a map
open Core_kernel
let foo (s : string): int Core_kernel.String.Map.t =
let m = String.Map.empty in
let m = String.Map.add m ~key:s ~data:1 in
m
(*
This expression has type
int Core_kernel.String.Map.t Base__.Map_intf.Or_duplicate.t
but an expression was expected of type
int Core_kernel.String.Map.t =
(Core_kernel.String.Map.Key.t, int,
Core_kernel.String.Map.Key.comparator_witness)
Base__Map.t
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment