This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
class A2 extends A | |
class B | |
trait M[X] | |
// | |
// Upper Type Bound | |
// | |
def upperTypeBound[AA <: A](x: AA): A = x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
NewerOlder