containers-backpack
containers-backpack copied to clipboard
Add default implementations of some functions
These functions can be put directly to containers-sig-* packages.
!?as an operator version oflookup//for Map difference
For example, there's this useful operator:
infixl 9 !?
(!?) :: Key k => Map k v -> k -> Maybe v
(!?) m k = lookup k m
And probably there exist other useful functions with default implementations. We need to collect such functions and put them near signatures. Though, good naming for module is most difficult part here...
Hi! I would like to grab this issue.
@wisn Go for it!
@wisn If you're going to do this issue. let's also do one more thing: let's remove lookupDefault function from signature and every instance and add default implementation using lookup and fromMaybe. I think that it doesn't make much sense to put this function into signatures, it's enough to have default implementation that automatically works for every data type. You can even rename it to lookupDef if you prefer shorter name :slightly_smiling_face: