Proposal: Add IsString and Monoid instances for Doc

Thomas Schilling nominolo at googlemail.com
Mon Oct 11 12:32:11 EDT 2010


+1, conditional upon there not being to many breakages.

That reminds me of the proposal to make `mappend == <>`.  What
happened to that one?

On 8 October 2010 08:52, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> Hello,
>
> Since we're discussing a proposal for the pretty package I would like
> to make another one:
>
> The proposal is to add the following to Text.PrettyPrint.HughesPJ:
>
> instance IsString Doc where
>    fromString = text
>
> This allows users to use string literals as Doc values using the
> OverloadedStrings language extension.
>
> I would also like to add:
>
> instance Monoid Doc where
>    mempty  = empty
>    mappend = (<>)
>
> If there's enough demand (because it's a lot of work) I can find out
> if this change breaks anything by analyzing pretty's direct reverse
> dependencies:
>
> http://bifunctor.homelinux.net/~roel/cgi-bin/hackage-scripts/revdeps/pretty-1.0.1.1#direct
>
> to see if some of them define an orphaned instance for IsString or Monoid.
>
> The patch that implements this is attached to the ticket:
>
> http://hackage.haskell.org/trac/ghc/ticket/4378
>
> Deadline: 2 weeks (Friday 22 October 2010)
>
> Regards,
>
> Bas
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>



-- 
Push the envelope. Watch it bend.


More information about the Libraries mailing list