[Haskell-cafe] Factoring into type classes

wren ng thornton wren at freegeek.org
Tue Jan 20 20:43:39 EST 2009


Luke Palmer wrote:
> On Mon, Jan 19, 2009 at 3:58 AM, Patai Gergely <patai_gergely at fastmail.fm>wrote:
> 
>> However, there are other type classes that are too general to assign
>> such concrete uses to. For instance, if a data structure can have more
>> than one meaningful (and useful) Functor or Monoid instance,
> 
> 
> As a side curiosity, I would love to see an example of any data structure
> which has more than one Functor instance.  Especially those which have more
> than one useful functor instance.

There are plenty of data structures which are multi-functors--- namely 
any type constructor with multiple arguments. The choice of order for 
arguments to the type constructor is arbitrary, so you can trivially 
choose the order you need for the Functor instance you want.

Depending on intensional vs extensional definitions for types, some may 
argue that these are "different" types due to currying and kinding 
issues, but those concerns only highlight the limitations of not having 
type-level functions like `flip`, rather than having any category 
theoretic basis.

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list