         end
       end
 
-      def pop_lazy(dict, key, fun) do
+      def pop_lazy(dict, key, fun) when is_function(fun, 0) do
         case fetch(dict, key) do
           {:ok, value} ->
             {value, delete(dict, key)}

        end
      end

      def put_new_lazy(dict, key, fun) do
        case has_key?(dict, key) do
          true  -> dict
          false -> put(dict, key, fun.())

        end
      end

      def get_lazy(dict, key, fun) when is_function(fun, 0) do
        case fetch(dict, key) do
          {:ok, value} -> value
          :error -> fun.()
