[Haskell-cafe] a beginner question: decorate-op-undecorate
stephen.tetley at gmail.com
Mon Feb 8 11:26:01 EST 2010
On 8 February 2010 11:16, John Lato <jwlato at gmail.com> wrote:
> Regardless, I think this is a valid approach. By thinking of data in
> terms of Functor, Traversable, etc., one can recognize these patterns.
> Even if Binding is part of a larger syntax tree and can't reasonably
> be made polymorphic, creating an fmap-like function to do what the OP
> requested is IMHO simple and idiomatic Haskell. Using Generics then
> simplifies the implementation.
Most definitely! - 'making a functor' is one of the strategies /
patterns to consider when designing data types. It would be nice if
there was a reference listing and defining such strategies. Phantom
types are another strategy (well, maybe a family of strategies if you
look closely), as is the de-normalisation by 'moving the sum' that I
mentioned previously in the thread, albeit on a smaller scale.
More information about the Haskell-Cafe