[Haskell-cafe] HStringTemplate and syb-with-class usage

Christopher Lewis c at functionx.org
Fri Dec 3 19:31:27 CET 2010

I've seen questions on using HStringTemplate with syb-with-class on
the list before, but haven't seen this issue addressed. I'm hoping
it's a noob issue, and, therefore, thought I would check with the list
before spending too much time digging around for solutions.

I'm attempting to use HStringTemplate with the syb-with-class support.
I've made sure HStringTemplate is installed with
'syb-with-class=True'. 'genericToSElem' is always failing on the 'True
=' guard with an error of "Unable to serialize the primitive type
[...]" with whatever primitive Haskell type I've included in my ADT;
for example, "Unable to serialize the primitive type 'Prelude.Int'".

I've made sure to include 'Text.StringTemplate.GenericWithClass',
'Data.Generics.SYB.WithClass.Basics', and
'Data.Generics.SYB.WithClass.Derive', and to derive instances of the
'Typeable' and 'Data' classes with '$(derive [''Test])', where 'Test'
is my test ADT. This makes me think that the overloaded 'toSElem'
functions defined by the instances in 'Text.StringTemplate.Instances'
are not being called? A cursory comparison to RJson, which the
HStringTemplate syb-with-class solution is based on, didn't lead me to
any obvious differences that I was missing.

For reference, my current configuration is (Sorry, it's an older
configuration, but the one I'm stuck with for now)
    GHC                  6.10.4 (Mac OS X 10.6.4, Intel)
    HStringTemplate 0.6.3
    syb-with-class    0.6

More information about the Haskell-Cafe mailing list