5 ms·
That actually sounds like you encountered code that shouldn't have been or you had people using Scalaz (which has weird operators taken from Haskell, looking at
by wheaties 12y ago
That actually sounds like you encountered code that shouldn't have been or you had people using Scalaz (which has weird operators taken from Haskell, looking at you <*>.)
- tormeh 12y agoScalaz is evil. Some of the operators are even non-ASCII. Anyway, scala needs less weird operators, not more. Looking at you, parser combinator library.
- throwawuy222 12y agoFor those who don't understand: Scalaz is an additional layer of syntax and tricks on top of what is already there. It seems to have quite a lot of power! implicit val option = new Traverse[Option] with MonadPlus[Option] { def point[A](a: => A) = Some(a) def bind[A, B](fa: Option[A])(f: A => Option[B]): Option[B] = fa flatMap f override def map[A, B](fa: Option[A])(f: A => B): Option[B] = fa map f def traverseImpl[F[_], A, B](fa: Option[A])(f: A => F[B])(implicit F: Applicative[F]) = fa map (a => F.map(f(a))(Some(_): Option[B])) getOrElse F.point(None) def empty[A]: Option[A] = None def plus[A](a: Option[A], b: => Option[A]) = a orElse b def foldR[A, B](fa: Option[A], z: B)(f: (A) => (=> B) => B): B = fa match { case Some(a) => f(a)(z) case None => z } } Excerpt from https://github.com/scalaz/scalaz#type-class-instance-definition https://github.com/scalaz/scalaz#type-class-instance-definit....
- justthistime_ 12y agoLooks pretty readable and reasonable.
- lmm 12y agoThat part is fine. The trouble with Scalaz is it adds a bunch of extra operators (that is, methods - the distinction doesn't exist in Scala) like |+|, \*> and >=>.