[Haskell-cafe] Formatting strict Text

Mark Fine mark.fine at gmail.com
Thu Dec 24 21:07:37 UTC 2015


I've been using Formatting <http://hackage.haskell.org/package/formatting>
 recently.

Mark

On Wed, Dec 23, 2015 at 5:13 PM, fr33domlover <fr33domlover at riseup.net>
wrote:

> Hello,
>
> I have code which uses Text.Printf.printf with String. Now I'm moving the
> code
> to use strict Text everywhere (I picked strict since all my strings are
> very
> short, mostly less than 400 chars). What should I use instead of printf
> now?
>
> One solution I found is the text-format package, which seems to simply
> split a
> Text on occurences of "{}" and insert values there. Are there other simple
> and
> efficient options? All I need is to append Text values and sometimes Ints
> too,
> so it's enough to have
>
> (1) efficient append and concat
> (2) A function that is :: Int -> Text
>
> Why is strict Text not a Monoid instance? And Builder has no `toStrictText`
> function? There is a function to convert Int to Builder and a Buildable
> instance for Int, but for a simple Int->Text it seems I'm left with an ugly
> `T.pack . show`.
>
>
> Suggestions / advice / comments on this?
>
> Thanks in advance :)
>
> fr33
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151224/46dbea42/attachment.html>


More information about the Haskell-Cafe mailing list