API: base types with applied type parameters

Compile task: fix detection of classpath changes
Aggressive compiler seems to work on scalaz now
This commit is contained in:
Mark Harrah 2010-01-23 09:33:42 -05:00
parent dc7b7d5363
commit 058e28e9b1
1 changed files with 16 additions and 0 deletions

View File

@ -16,6 +16,22 @@ trait Tracked extends NotNull
/** Clears the cache. If also cleaning, 'clean' should be called first as it might require information from the cache.*/
def clear: Task[Unit]
}
class Timestamp(val cacheFile: File) extends Tracked
{
val clean = Clean(cacheFile)
def clear = Task.empty
def apply[T](f: Long => Task[T]): Task[T] =
{
val getTimestamp = Task { readTimestamp }
getTimestamp bind f map { result =>
FileUtilities.write(cacheFile, System.currentTimeMillis.toString)
result
}
}
def readTimestamp: Long =
try { FileUtilities.read(cacheFile).toLong }
catch { case _: NumberFormatException | _: java.io.FileNotFoundException => 0 }
}
object Clean
{
def apply(src: Task[Set[File]]): Task[Unit] = src map FileUtilities.delete