ScalazのEqualとScalaTest

正確にはScalaTestではなく、「ScalaTest作者が作っている、ScalaTestが依存している、"ScalaUtils"というライブラリ」と、Scalazの比較ですが
1
Toby Matejovsky @tobym

My favorite #scala import is: import org.scalautils.TypeCheckedTripleEquals._

2013-11-13 07:34:57
S @seanparsons

@tobym @bvenners I think you meant to say: import scalaz._,Scalaz._ :)

2013-11-13 09:15:16
Daniel Spiewak @djspiewak

@tobym @bvenners import scalaz._ That’s like, a zillion fewer characters. Just sayin’. :-)

2013-11-13 13:30:23
Bill Venners @bvenners

@djspiewak @tobym Typing characters builds character! Plus you can create an import object, like OurScalaUtils on: http://t.co/epbizhlZiq

2013-11-13 18:13:50
Bill Venners @bvenners

@djspiewak @tobym Also, is it true you need define Equal[T] instance for any new type T you create to use Scalaz's === with T?

2013-11-13 18:18:32
Bill Venners @bvenners

@jteigen @djspiewak @tobym Ah. But for case class Person(name: String) you'd still have to say implicit val eqp = TypeClass[Equal, Person]?

2013-11-13 19:08:48
Jon-Anders Teigen @jteigen

@bvenners @djspiewak @tobym haven't tried this myself, but it looks like import Equal.auto._ should be enough

2013-11-13 19:11:31
Bill Venners @bvenners

@jteigen @djspiewak @tobym Interesting. What version of scalaz is that? It doesn't seem to work in 7.0.4, unless I'm missing an import.

2013-11-14 00:33:43
Jon-Anders Teigen @jteigen

@bvenners @djspiewak @tobym don't know. Check with @larsr_h he is the magician behind this stuff

2013-11-14 02:57:52
Lars Hupel (@lars@hupel.info on Fedi) @larsr_h

@bvenners @djspiewak @tobym Yes, that's the point. You don't want equality to be available on arbitrary function types.

2013-11-14 03:37:11
Lars Hupel (@lars@hupel.info on Fedi) @larsr_h

@bvenners @jteigen @djspiewak @tobym It requires shapeless-contrib. Will post an example when I'm back home.

2013-11-14 03:37:38
Bill Venners @bvenners

@larsr_h Thanks, I'd like to try it out. Does auto cause the type class instance to be redefined anew inline each time it is needed?

2013-11-14 04:20:56
Bill Venners @bvenners

@larsr_h @djspiewak @tobym Equality is already available on arbitrary function types, because given functions f and g, you can say f == g.

2013-11-14 04:30:51
Bill Venners @bvenners

@larsr_h @djspiewak @tobym f == g is not very useful, so people don't do it much. What specific problems can you give that arise from it?

2013-11-14 04:32:37
Daniel Spiewak @djspiewak

@bvenners @larsr_h @tobym map function on Set arises directly from bad equality.

2013-11-14 04:36:57
Bill Venners @bvenners

@djspiewak @larsr_h @tobym Daniel, can you give a specific example? I'm not sure what you are referring to.

2013-11-14 04:49:06
Brian McKenna @puffnfresh

@bvenners @djspiewak @larsr_h @tobym it's reference equality and not extensional equality (where domains and codomains are checked instead)

2013-11-14 04:54:02
Lars Hupel (@lars@hupel.info on Fedi) @larsr_h

@bvenners Right. We (= scalaz) don't want that, and we especially don't want a custom `===` to provide it. @djspiewak

2013-11-14 04:57:01
Lars Hupel (@lars@hupel.info on Fedi) @larsr_h

@bvenners Here's a minimal example. The wildcard import of `shapeless.contrib.scalaz` gives you "automatic" mode. http://t.co/qw6YKqzZGO

2013-11-14 05:01:37
Lars Hupel (@lars@hupel.info on Fedi) @larsr_h

@bvenners Yes, it calls the macro every time an implicit of that type is summoned. In that sense, it behaves just like other implicits.

2013-11-14 05:02:10
Bill Venners @bvenners

@larsr_h Thanks. Unfortunately can't see it from behind this firewall. Will try it tonight from the hotel. Looks pretty interesting.

2013-11-14 05:07:42
Bill Venners @bvenners

@puffnfresh @djspiewak @larsr_h @tobym I see, so how (and how often) do you define Equal instances for extensionally equal functions?

2013-11-14 05:18:30