purescript/purescript-record

Builder Profunctor instance

matthewleon opened this issue · 3 comments

There should be a Profunctor instance for Builders.

I'm not sure this is doable, actually. The problem is that, as I understand it, a Builder a b is a function a -> b which is guaranteed to use its argument exactly once, but allowing you to lmap with any old function could break that guarantee. I've haven't been able to come up with an example of this breaking things yet but I expect it can be done.

@paf31 does this sound reasonable?

@hdgarrood I see what you're saying.

paf31 commented

Something like lmap (const r) builder seems like it would cause trouble by modifying the immutable record r.