Ronald J. Legere writes:
> newtype SS = SS [Int]
> 
> Now I can override show for my newtype, but
> unfortunately , I cant overide 'take' 'drop' etc...so
> I have to rewrite new versions 'sstake, ssdrop' that does
> nothing but peel the wrapper off. Ok, so is there
> any nice way to do this?

Well, one thing you can do is to write a wrapper function/functor
which does precisely this, which at least means one needn't have manifest
redefinitions of _every_ listop.  Though it's a tad more long-winded
to write, at each application, and worse, it gets a little baroque
for different arities and arg-orders, requiring either several more
wrapper functions, or else somewhat baroque-looking argument-flipping
3rd-order functions to reuse the existing ones.


> (In the meantime, I just abandoned
> overiding show, and instead defined my own 'ssshow'

Pragmatically that's likely the easiest thing to do, at least if
that's the only list behaviour one wants to 'override'.

Slán,
Alex.

Reply via email to