Skip to content

Instantly share code, notes, and snippets.

View timperrett's full-sized avatar
🚧

Timothy Perrett timperrett

🚧
View GitHub Profile
// See http://lampsvn.epfl.ch/trac/scala/ticket/967.
//
// Gilles' fix causes the definition of Nat to be rejected with the error
// "Parameter type in structural refinement may not refer to a type member
// of that refinement". However we can work around the problem by
// quantifying out the problematic parameter type and reinstating it via
// a generalized type constraint.
type Num = {
type Rep
import scalaz._
/**
* playing with some of the ideas from the Haskell fclabels library
* using the new Lens functionality in scalaz
*
* http://hackage.haskell.org/package/fclabels
*/
object LensTest {
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
import scala.collection.mutable.ListBuffer
import akka.actor.{Actor,ActorRef}
import akka.actor.Actor._
import akka.routing.{ Listeners, Listen }
//Represents a domain event
trait Event
//A builder to create domain entities
trait EntityBuilder[Entity] {
import _root_.net.liftweb.mapper._
trait HasCreatedMetaMapper[T <: HasCreated[T]] {
self: T with LongKeyedMetaMapper[T] =>
import java.util.Date
def findByCreated(startDate:Date, endDate:Date) = findAll(By_>(created_at, startDate), By_<(created_at, endDate))
def findByCreatedSince(startDate: Date) = findAll(By_>(created_at, startDate))
}
trait HasCreated [T <: HasCreated[T]] extends KeyedMapper[Long, T] {
//
// FileUpload.j
// Editor
//
// Created by Francisco Tolmasky on 03/04/08.
// Copyright 2005 - 2008, 280 North, Inc. All rights reserved.
//
import <Foundation/CPObject.j>
import <Foundation/CPValue.j>
object ValueTypes6
{
abstract class Type[T](val p : (T) => boolean)
{
sealed protected[Type] case class X[T] protected[Type] (val value : T)
type Type = X[T]
def apply(t : T) : Option[Type] = if(p(t)) Some(mk(t)) else None
abstract class Foo[X](val value : X) { type T = X }
abstract class FooFactory[S <: Foo[_]](val P : (S#T) => boolean)
{
def apply(t : S#T) : Option[S] = if(P(t)) Some(fetch(t)) else None
def unapply(s : S) : Option[S#T] = if(s == null) None else Some(s.value)
def fetch(t : S#T) = mk(t)