Standard Set type?

I tried to create an abstract set based on a Map with generic value as you suggest.

abstract Set<T>(Map<T, Bool>) {
    public function new() {
        this = new Map<T, Bool>();
    }

    public function push(val:T) this[val] = true;
    public function pop(val:T) this.remove(val);
    public function has(val:T):Bool return this.exists(val);
    public function toString() return toArray().toString();

	@:from static public function fromArray(arr:Array<Int>) {
        final newSet = new Set();
        for (val in arr) newSet.push(val);
        return newSet;
    }

    @:to public function toArray<T>() {
        return [for (val in this.keys()) val];
    };
}

But there’s an issue, when trying to create an instance of this type I get the following error:
Set.hx:3: characters 16-34 : Abstract haxe.ds.Map has no @:to function that accepts haxe.IMap<Set.T, Bool>

I think it’s related to Map not supporting all types, e.g. Float.

Do you have a suggestion to solve this issue?
I can just create a non-generic set, but it would be pretty nice to have a generic version.