|
Play Framework/Scala example source code file (Alternative.scala)
The Alternative.scala Play Framework example source code/* * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs.functional import scala.language.higherKinds trait Alternative[M[_]] { def app: Applicative[M] def |[A, B >: A](alt1: M[A], alt2: M[B]): M[B] def empty: M[Nothing] //def some[A](m: M[A]): M[List[A]] //def many[A](m: M[A]): M[List[A]] } class AlternativeOps[M[_], A](alt1: M[A])(implicit a: Alternative[M]) { def |[B >: A](alt2: M[B]): M[B] = a.|(alt1, alt2) def or[B >: A](alt2: M[B]): M[B] = |(alt2) } Other Play Framework source code examplesHere is a short list of links related to this Play Framework Alternative.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.