stacycurl / pimpathon

Adds useful methods to scala & java classes.
Apache License 2.0
35 stars 9 forks source link

Add String.quote: String #206

Closed stacycurl closed 6 years ago

fommil commented 9 years ago

isn't this going to be heavily domain specific?

stacycurl commented 9 years ago

Do you mean different domains would want to quote in different ways ?

I probably won't need it, instead I'm going to create a new project to define a 'Homoiconic' type class.

val someHardToRecreateValue: Blah = ... val asCode: String = Homoiconic[Blah].show(someHardToRecreateValue)

assert(eval(asCode) == someHardToRecreateValue)

This is so I can paste the value of 'asCode' into some unit test.

implicit val homoiconicString: Homoiconic[String] = new Homoiconic[String] { def show(value: String): String = "\"" + value + "\"" }

// shapeless voodoo to create instances for case classes using structural recursion to leaves.

On 10 April 2015 at 17:48, Sam Halliday notifications@github.com wrote:

isn't this going to be heavily domain specific?

— Reply to this email directly or view it on GitHub https://github.com/stacycurl/pimpathon/issues/206#issuecomment-91617500.

Stacy