tag:blogger.com,1999:blog-6373963829340632529.post9124392334477770320..comments2024-01-30T05:40:30.415-03:00Comments on Algorithmically challenged: Type Class pattern exampleDanielhttp://www.blogger.com/profile/07505997833685327219noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-6373963829340632529.post-7107206444948509312011-03-28T12:23:32.234-03:002011-03-28T12:23:32.234-03:00Thanks! I'll take a look to it.
I'm pret...Thanks! I'll take a look to it.<br /> <br />I'm pretty in a hurry so I did not state my problem clearly, I'm sorry for that. I'll try to post it later with a first solution if you will. <br /><br />Nevertheless, thanks for answering to me here and to others on stackoverflow. I started learning Scala 2 weeks ago and I must say your answers are often helpful ;)<br /><br />--<br />JulienAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6373963829340632529.post-37039912611335245192011-03-26T18:45:59.476-03:002011-03-26T18:45:59.476-03:00I don't have any particular recommendation reg...I don't have any particular recommendation regarding immutable graphs, but you might want to look at the Graph project on Scala Incubator (https://scala-incubator.assembla.com/code/scala-graph/subversion/nodes).Danielhttps://www.blogger.com/profile/07505997833685327219noreply@blogger.comtag:blogger.com,1999:blog-6373963829340632529.post-83340404748379172532011-03-25T11:59:15.022-03:002011-03-25T11:59:15.022-03:00Very nice post Daniel! Thank you.
I'm looking...Very nice post Daniel! Thank you.<br /><br />I'm looking for a way to deserialize an XML file representing a cyclic class/object graph. Almost every class/object contains a id field which is used to represent (mutual) references when serializing to the XML file.<br />Moreover, I would like to keep all my object/classes immutables! <br /><br />Do you have any hint to do the work properly ?<br /><br />Thanks by advance<br /><br />--<br />JulienAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6373963829340632529.post-14651522389488874782010-06-20T13:55:31.940-03:002010-06-20T13:55:31.940-03:00Yeah right. I missed that ;-)Yeah right. I missed that ;-)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6373963829340632529.post-10104672296961643992010-06-20T13:51:07.294-03:002010-06-20T13:51:07.294-03:00There's no hint to let the compiler infer F. I...There's no hint to let the compiler infer F. It will only do so if there's a single implicit available, otherwise I expect it to return a message about ambiguity.Danielhttps://www.blogger.com/profile/07505997833685327219noreply@blogger.comtag:blogger.com,1999:blog-6373963829340632529.post-36306564254992847362010-06-20T13:44:50.848-03:002010-06-20T13:44:50.848-03:00Thanks for the nice posts on the topic!
I think ...Thanks for the nice posts on the topic! <br /><br />I think for the case where two type parameters are needed the following will also work:<br /><br />def output[T, F](what: T)(implicit formatter: Formatter[T, F]) = ..<br /><br />The compiler will successfully infer both types.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6373963829340632529.post-90073690163042295052010-06-19T15:04:57.003-03:002010-06-19T15:04:57.003-03:00Nice post (the previous one also). Thanks for shar...Nice post (the previous one also). Thanks for sharing.Olivierhttps://www.blogger.com/profile/02226343019178357911noreply@blogger.comtag:blogger.com,1999:blog-6373963829340632529.post-48650361305493583702010-06-18T17:59:57.483-03:002010-06-18T17:59:57.483-03:00One non-standard-library place where this pattern ...One non-standard-library place where this pattern is within Lift, in the Binding framework. The source code of the interesting bits is <a href="http://scala-tools.org/mvnsites-snapshots/liftweb/lift-base/lift-webkit/scaladocs/net/liftweb/http/Bindings.scala.html" rel="nofollow">here</a>. Note that here, the "implicit typeclass" is simply a type alias for a curried function with the signature T => NodeSeq => NodeSeq.Kris Nuttycombehttps://www.blogger.com/profile/06347383351250086727noreply@blogger.com