From HaskellWiki
Revision as of 18:23, 4 December 2007 by Wolfgang Jeltsch (talk | contribs) (notes on WrappedApplicative and type composition)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Hello Conal,

I have a type WrappedApplicative defined in Data.Monoid.Bonus which is part of the grapefruit-data package. I introduced it because I wanted to make use of the fact that for every applicative functor a and every monoid m, a m is again a monoid. Data.Monoid.Bonus defines an instance (Applicative a, Monoid m) => Monoid (WrappedApplicative a m).

Actually, WrappedApplicative is just application of a * -> * type to a * type. So it seems much better to define a “composition” type which “composes” a unary type with a nullary type. Such a “composition” would be an instance of Monoid if an applicative functor is composed with a monoid. Thereby I could get rid of WrappedApplicative.

Interestingly, WrappedMonad is also type application. Maybe the above ideas could also be used to remove WrappedMonad. Maybe this would lead us to libraries which don’t introduce all kinds of wrapper types.

What do you think?

-- Wolfgang Jeltsch 18:23, 4 December 2007 (UTC)