proper icon indicating copy to clipboard operation
proper copied to clipboard

Support for `map`s

Open StoneCypher opened this issue 8 years ago • 1 comments

As Kostis mentioned back in 2015, at some point, Proper needs to support maps.

For me that point is today. Would a PR for a map generator be accepted? Do you have rules or guidelines regarding your code preferences somewhere?

StoneCypher avatar Jan 06 '16 21:01 StoneCypher

For others, while we wait, here are a few utility functions that have been serving me modestly well, although they're quite limited:

gen_map() ->
    ?LET(L, list({term(), term()}), maps:from_list(L)).

gen_nonempty_map() -> 
    ?SUCHTHAT(M, gen_map(), M =/= #{}).

gen_nonempty_map_without_key(K) -> 
    ?SUCHTHAT(M, gen_map(), M =/= #{} andalso (maps:find(K, M) =:= error)).

StoneCypher avatar Jan 08 '16 22:01 StoneCypher