Can is not an Option and to call it so in any way is an error of misintegration. Indeed it would be an error to "replace Option with Can" - they are completely different algebras. Either is kinded * -> * -> * so cannot possible be isomorphic and cannot possibly have map, flatMap etc (though it can have a bifunctor map being covariant in both type arguments). However, Either.LeftProjection and Either.RightProjection are kinded * -> * and are both covariant functors and monads, hence map, flatMap etc. are available. e.g. for(x <- either.left) ... is valid, try it.
Of mild interest, it is possible to construct an isomorphism to Can using both Either and Option. Indeed, it is possible to construct an isomorphism to Option using Either e.g. forall A. Option[A] ≡ Either [Unit, A] so it is possible using Either alone. I'll leave both as reader exercises. On Dec 21 2008, 5:15 am, Oliver Lambert <[email protected]> wrote: > Ok so Can is not either an Either or an Option, its a Can. I kind of > wondered when I first used Can, and it was described as an enhanced > Option, why it wasn't called something like Option+ with None, Some > and Failure. > > On 21/12/2008, at 5:47 AM, David Pollak wrote: > > > Can has map, flatMap, filter etc. So it can be used in a for > > comphrension. I don't believe Either has those methods. Further, > > Can has a bunch of helpers to turn Empty into Failure > > > On Dec 20, 2008 10:33 AM, "Oliver Lambert" <[email protected]> wrote: > > > Is Can a little less like Option and more like scala.Either, where > > the left side is used to indicate failure? > > On 21/12/2008, at 1:43 AM, David Pollak wrote: > Folks, > > Over the > > year that Lift has had Can[T... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
