[Haskell-cafe] Avoiding code-duplication for what is roughly fmap

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Fri Oct 4 07:38:33 UTC 2019


On Thu, Oct 03, 2019 at 04:55:24PM -0400, Sebastiaan Joosten wrote:
> I'm writing a lot of code that looks like this:
> instance WhiteSpaced ClassItem where
>   removeWS (Method a b c) = Method (removeWS a) (removeWS b) (removeWS c)
>   removeWS (Declaration b) = Declaration (removeWS b)

I'll give you an example using product-profunctors, but could you provide
the class and data type definitions?  I'd like the example to actually
reflect the reality of the situation you are dealing with.


More information about the Haskell-Cafe mailing list