diff options
author | folone <folone@gmail.com> | 2013-07-25 12:05:51 +0200 |
---|---|---|
committer | folone <folone@gmail.com> | 2013-07-25 12:05:51 +0200 |
commit | 652e780f30f7640d3e7dd4a211c034247cc97a88 (patch) | |
tree | 4a5a45bfe25bb1582fa9fa531e541ee9183ac1aa | |
parent | 56b7c0f8fa6c1037905867aec88520476dbd3baa (diff) | |
download | scala-652e780f30f7640d3e7dd4a211c034247cc97a88.tar.gz scala-652e780f30f7640d3e7dd4a211c034247cc97a88.tar.bz2 scala-652e780f30f7640d3e7dd4a211c034247cc97a88.zip |
Removing unused things from scalap.
5 files changed, 0 insertions, 241 deletions
diff --git a/src/scalap/scala/tools/scalap/scalax/rules/Arrows.scala b/src/scalap/scala/tools/scalap/scalax/rules/Arrows.scala deleted file mode 100644 index f8761ca0ed..0000000000 --- a/src/scalap/scala/tools/scalap/scalax/rules/Arrows.scala +++ /dev/null @@ -1,37 +0,0 @@ -package scala.tools.scalap -package scalax -package rules - -trait Arrows extends UnitFunctors { - type Arr[-A, +B] <: Arrow[A, B] - type M[+B] = Arr[Nothing, B] - - def arrow[A, B](f : A => B) : Arr[A, B] - def diag[A] = arrow[A, (A, A)] { a => (a, a) } - - override def unit[B](b : => B) : M[B] = arrow { any : Any => b } - - trait Arrow[-A, +B] extends Functor[B] { this : Arr[A, B] => - - def map[C](f : B => C) = comp(arrow(f)) - def comp[C](bc : => Arr[B, C]) : Arr[A, C] - def fst[C] : Arr[(A, C), (B, C)] - } -} - -trait ApplicativeArrows extends Arrows { - type Arr[-A, +B] <: ApplicativeArrow[A, B] - - def app[A, B] : Arr[(Arr[A, B], A), B] - - trait ApplicativeArrow[-A, +B] extends Arrow[A, B] { self : Arr[A, B] => - def flatMap[SubA <: A, C](f : B => Arr[SubA, C]) : Arr[SubA, C] = - diag[SubA].comp(map(f).fst[SubA]).comp(app[SubA, C]) - } -} - -trait ArrowMonads extends ApplicativeArrows with Monads { - type Arr[-A, +B] <: ApplicativeArrow[A, B] with Monad[B] - - override def unit[A](a : => A) : M[A] = arrow[Unit, A](Unit => a) -} diff --git a/src/scalap/scala/tools/scalap/scalax/rules/Functors.scala b/src/scalap/scala/tools/scalap/scalax/rules/Functors.scala deleted file mode 100644 index aa852c1e63..0000000000 --- a/src/scalap/scala/tools/scalap/scalax/rules/Functors.scala +++ /dev/null @@ -1,81 +0,0 @@ -// ----------------------------------------------------------------------------- -// -// Scalax - The Scala Community Library -// Copyright (c) 2005-8 The Scalax Project. All rights reserved. -// -// The primary distribution site is http://scalax.scalaforge.org/ -// -// This software is released under the terms of the Revised BSD License. -// There is NO WARRANTY. See the file LICENSE for the full text. -// -// ----------------------------------------------------------------------------- - -package scala.tools.scalap -package scalax -package rules - -trait Functor[+A] { - type M[+A] <: Functor[A] - def map[B](f : A => B) : M[B] -} - -trait Filter[+A] { - type M[+A] <: Filter[A] - def filter(f : A => Boolean) : M[A] -} - -trait Plus[+A] { - type M[+A] <: Plus[A] - def plus[B >: A](other : => M[B]) : M[B] -} - -trait OrElse[+A] { - type M[+A] <: OrElse[A] - def orElse[B >: A](other : => M[B]) : M[B] -} - -trait Units { - type M[+A] - def unit : M[Unit] - def unit[A](a : => A) : M[A] -} - -trait Zero { - type M[+A] - def zero : M[Nothing] -} - -trait Functors { - type M[+A] <: Functor[A] - - trait Functor[+A] extends rules.Functor[A] { this : M[A] => - type M[+A] = Functors.this.M[A] - } - - trait ZeroFunctor extends Functor[Nothing] { this : M[Nothing] => - override def map[B](f : Nothing => B) : M[B] = this - def filter(f : Nothing => Boolean) : M[Nothing] = this - def plus[B](other : => M[B]) : M[B] = other - def orElse[B](other : => M[B]) : M[B] = other - } -} - -/** One of the 'unit' definitions must be overridden in concrete subclasses */ -trait UnitFunctors extends Units with Functors { - def unit : M[Unit] = unit(()) - def unit[A](a : => A) : M[A] = unit map { Unit => a } -} - - -trait Monoidals extends UnitFunctors { - type M[+A] <: Monoidal[A] - - implicit def app[A, B](fab : M[A => B]) = (fa : M[A]) => fa applyTo fab - implicit def appUnit[A, B](a2b : A => B) = app(unit(a2b)) - - /** One of 'and' and 'applyTo' definitions must be overridden in concrete subclasses */ - trait Monoidal[+A] extends Functor[A] { self : M[A] => - def and[B](fb : => M[B]) : M[(A, B)] = ((a : A) => (b : B) => (a, b))(this)(fb) - def applyTo[B](fab : M[A => B]) : M[B] = fab and this map { case (f, a) => f(a) } - } -} diff --git a/src/scalap/scala/tools/scalap/scalax/rules/Input.scala b/src/scalap/scala/tools/scalap/scalax/rules/Input.scala deleted file mode 100644 index 370eb0d054..0000000000 --- a/src/scalap/scala/tools/scalap/scalax/rules/Input.scala +++ /dev/null @@ -1,68 +0,0 @@ -// ----------------------------------------------------------------------------- -// -// Scalax - The Scala Community Library -// Copyright (c) 2005-8 The Scalax Project. All rights reserved. -// -// The primary distribution site is http://scalax.scalaforge.org/ -// -// This software is released under the terms of the Revised BSD License. -// There is NO WARRANTY. See the file LICENSE for the full text. -// -// ----------------------------------------------------------------------------- - -package scala.tools.scalap -package scalax -package rules - -trait Input[+A] extends Iterable[A] { - - def next : Result[Input[A], A, Nothing] - def index : Int - - def iterator = new Iterator[A] { - private var input : Input[A] = Input.this - private var result = input.next - - def hasNext = result != Failure - def next = { - val Success(input, value) = result - this.input = input - this.result = input.next - value - } - } -} - - -class ArrayInput[A](val array : Array[A], val index : Int) extends Input[A] { - def this(array : Array[A]) = this(array, 0) - - lazy val next : Result[ArrayInput[A], A, Nothing] = if (index >= array.length) Failure - else Success(new ArrayInput[A](array, index + 1), array(index)) - - override lazy val toString = this.iterator.mkString("\"", "", "\"") -} - - -class IterableInput[A](iterator : Iterator[A], val index : Int) extends Input[A] { - def this(iterable : Iterable[A]) = this(iterable.iterator, 0) - - lazy val next : Result[IterableInput[A], A, Nothing] = if (!iterator.hasNext) Failure - else Success(new IterableInput(iterator, index + 1), iterator.next) - - override lazy val toString = this.iterator.mkString("\"", "", "\"") -} - - -/** View one type of input as another based on a transformation rule */ -class View[A, B]( - transform : Input[A] => Result[Input[A], B, Nothing], - val input : Input[A], - val index : Int) - extends Input[B] { - - def next : Result[Input[B], B, Nothing] = transform(input) match { - case Success(context, b) => Success(new View(transform, context, index + 1), b) - case _ => Failure - } -} diff --git a/src/scalap/scala/tools/scalap/scalax/rules/Monad.scala b/src/scalap/scala/tools/scalap/scalax/rules/Monad.scala deleted file mode 100644 index 639c414675..0000000000 --- a/src/scalap/scala/tools/scalap/scalax/rules/Monad.scala +++ /dev/null @@ -1,46 +0,0 @@ -// ----------------------------------------------------------------------------- -// -// Scalax - The Scala Community Library -// Copyright (c) 2005-8 The Scalax Project. All rights reserved. -// -// The primary distribution site is http://scalax.scalaforge.org/ -// -// This software is released under the terms of the Revised BSD License. -// There is NO WARRANTY. See the file LICENSE for the full text. -// -// ----------------------------------------------------------------------------- - -package scala.tools.scalap -package scalax -package rules - -trait Monad[+A] extends Functor[A] { - type M[+A] <: Monad[A] - def flatMap[B](f : A => M[B]) : M[B] -} - -trait Monads extends UnitFunctors { - type M[+A] <: Monad[A] - - trait Monad[+A] extends Functor[A] with rules.Monad[A] { this : M[A] => - def map[B](f : A => B) = flatMap { a => unit(f(a)) } - } - - trait ZeroMonad extends Monad[Nothing] with ZeroFunctor { this : M[Nothing] => - def flatMap[B](f : Nothing => M[B]) : M[B] = this - } -} - - -trait StateReader extends Monads { - type S - - def get : M[S] - def read[A](f : S => A) : M[A] - def set(s : => S) : M[S] - def update(f : S => S) : M[S] -} - - - - diff --git a/src/scalap/scala/tools/scalap/scalax/rules/package.scala b/src/scalap/scala/tools/scalap/scalax/rules/package.scala deleted file mode 100644 index b1cc18f90b..0000000000 --- a/src/scalap/scala/tools/scalap/scalax/rules/package.scala +++ /dev/null @@ -1,9 +0,0 @@ -package scala.tools.scalap -package scalax - -package object rules { - implicit lazy val higherKinds = scala.language.higherKinds - implicit lazy val postfixOps = scala.language.postfixOps - implicit lazy val implicitConversions = scala.language.implicitConversions - implicit lazy val reflectiveCalls = scala.language.reflectiveCalls -} |