[Haskell-cafe] Re: toSelem takes no format parameter

Sterling Clover s.clover at gmail.com
Fri Mar 27 18:41:06 EDT 2009


If you have a type that requires a format string, the proper place to  
pass that string in is not the toSElem method. Rather, one should  
construct a ToSElem instance that wraps the item in an (STSH .  
STShow) constructor. The item itself then should be made an instance  
of StringTemplateShows, with an appropriate  
stringTemplateFormattedShow method. It's a bit of plumbing, I'll  
grant, but allows for setting the format where it should be -- in the  
template itself.

If, on the other hand, you simply want to apply the locale to the  
attribute as you pass it in to the template, then you can just pack  
them together in a tuple or a record, and write a ToSElem instance  
for that.

Cheers,
S.

On Mar 27, 2009, at 8:41 AM, Kemps-Benedix Torsten wrote:

> Sterling,
>
> the toSElem function of ToSElem does not take a parameter that  
> allows specification of e.g. the locale that shall be used for  
> rendering a specific attribute. If one wants to change this, one  
> also has to change setAttribute and the like. Do you have any plans  
> to extend HStringTemplate in this way?
>
> Schöne Grüße
>
> Torsten Kemps-Benedix
> (Geschäftsführer)
>
>
> SKS Unternehmensberatung GmbH & Co KG
> Geheimrat-Hummel-Platz 4
> D-65239 Hochheim am Main
> Germany
> M +49.163.36017.01
> T +49.700.36017.000
> F +49.700.36017.011
> torsten.kemps-benedix at sks-ub.de
> http://www.sks-ub.de
>



More information about the Haskell-Cafe mailing list