I chose the newtype solution.

Thanks :)



2014-07-23 14:40 GMT+02:00 Chaddaï Fouché <chaddai.fouche@gmail.com>:
On Wed, Jul 23, 2014 at 2:20 PM, Christian Sperandio <christian.sperandio@gmail.com> wrote:
I know the quote problem comes from the show function on String value. 
How could I do a show for no-string values and return directly the value for strings?

You can't ! (ok you can but you'll need to use OverlappingInstances)

Anyway, using Show for this is wrong, Show is supposed to translate datatypes in a form you could copy in your code to get the value back, it isn't supposed to be for presentation. You have libraries that do pretty formatting better.

If you absolutely want this, I would suggest writing another class for it and use OverlappingInstances to allow for one "DataLog String" instance and one "(Show a) => YourClass (DataLog a)" instance.

Another possibility is to do a newtype for strings that have a Show instance that doesn't put quotes around. That might even be a better idea, maybe your Strings really represent variables or something in this case anyway ?
--
Jedaï


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners