com.phasmidsoftware.lascala.fp

Created by scalaprof on 11/12/16.

Attributes

Members list

Type members

Classlikes

object ??

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
??.type
case class ??[T](tso: Option[List[T]])

Type parameters

T

the underlying type

Value parameters

tso

an optional list of T

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
??[T]
object Args

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Args.type
case class Args(args: List[Any]) extends () => Try[(Any, Args)]

Created by scalaprof on 9/7/16.

Created by scalaprof on 9/7/16.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait () => Try[(Any, Args)]
class Object
trait Matchable
class Any
Show all
case class AssertingError(w: String) extends Exception

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
trait Benchmark[T] extends () => T

The result of a benchmark: invoking it evaluates the benchmarked expression once more.

The result of a benchmark: invoking it evaluates the benchmarked expression once more.

Type parameters

T

the result type of the benchmarked expression

Attributes

Companion
object
Supertypes
trait () => T
class Object
trait Matchable
class Any
object Benchmark

Declaration of implicit class Rep within Benchmark.

Declaration of implicit class Rep within Benchmark.

Created by scalaprof on 8/17/16.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Benchmark.type
case class Closure[T, R](f: RenderableFunction[R], ps: Parameter[T]*)(using evidence$1: ClassTag[R]) extends () => Try[R]

This case class represents a "closure" on a renderable function (f) and a set of bound parameters (ps).

This case class represents a "closure" on a renderable function (f) and a set of bound parameters (ps).

Type parameters

R

the result type of the closure

T

the parameter type of the closure

Value parameters

f

the (renderable) function

ps

the parameters, each of which may be a value or a Closure

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait () => Try[R]
class Object
trait Matchable
class Any
Show all
object Closure

Companion object to Closure

Companion object to Closure

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Closure.type
object FP

This is a collection of general functional-programming-style methods. We could probably get these from ScalaZ but I'd rather have no dependencies.

This is a collection of general functional-programming-style methods. We could probably get these from ScalaZ but I'd rather have no dependencies.

TODO flesh out the unit tests (coverage is low).

TODO replace as an output type with type based on CanBuildFrom

CONSIDER replace Seq with Iterator in signatures

CONSIDER use higher-kinded monad types in order to implement methods for Try and Option at the same time

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
FP.type
object FP_Cross

This is an 2.11-specific appendix to FP

This is an 2.11-specific appendix to FP

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
FP_Cross.type
case class FreeParam(s: String, cbn: Boolean)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object FreeParam

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
FreeParam.type

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class FunctionString(f: String, ps: List[Param])

Class to represent a (renderable) function string.

Class to represent a (renderable) function string.

Value parameters

f

the name of the function (not necessarily the same as the original definition of the corresponding function/method)

ps

a sequence of Param objects (these represent bound or unbound parameters)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait HasKey[V]

Type class trait to define something that has a key.

Type class trait to define something that has a key.

CONSIDER try to generalize this so that return value implements Ordering, rather than being any particular type like String.

Created by scalaprof on 11/17/16.

Attributes

Supertypes
class Object
trait Matchable
class Any
trait Lazy[T] extends () => T

Created by scalaprof on 8/22/16.

Created by scalaprof on 8/22/16.

Attributes

Supertypes
trait () => T
class Object
trait Matchable
class Any
trait Named

This trait defines the concept of a named object, i.e. having a name which is a String.

This trait defines the concept of a named object, i.e. having a name which is a String.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class NamedFunction0[R]
class NamedFunction2[T1, T2, R]
class NamedFunction3[T1, T2, T3, R]
class NamedFunction4[T1, T2, T3, T4, R]
class NamedFunction5[T1, T2, T3, T4, T5, R]
object NamedFunction

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class NamedFunction[-T, +R](val name: String, val f: T => R) extends T => R

NamedFunction class. Could equally be called NamedFunction1

NamedFunction class. Could equally be called NamedFunction1

Type parameters

R

the result type

T

the input type

Value parameters

f

the function itself

name

the name of this function

Attributes

Companion
object
Supertypes
trait T => R
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class NamedFunction0[+R](val name: String, val f: () => R) extends () => R, Named

NamedFunction0 class.

NamedFunction0 class.

Type parameters

R

the result type

Value parameters

f

the function itself

name

the name of this function

Attributes

Companion
object
Supertypes
trait Named
trait () => R
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class NamedFunction2[-T1, -T2, +R](val name: String, val f: (T1, T2) => R) extends (T1, T2) => R, Named

NamedFunction2 class.

NamedFunction2 class.

Type parameters

R

the result type

T1

the input type

T2

the input type

Value parameters

f

the function itself

name

the name of this function

Attributes

Companion
object
Supertypes
trait Named
trait (T1, T2) => R
class Object
trait Matchable
class Any
class NamedFunction3[-T1, -T2, -T3, +R](val name: String, val f: (T1, T2, T3) => R) extends (T1, T2, T3) => R, Named

NamedFunction3 class.

NamedFunction3 class.

Type parameters

R

the result type

T1

the input type

T2

the input type

T3

the input type

Value parameters

f

the function itself

name

the name of this function

Attributes

Companion
object
Supertypes
trait Named
trait (T1, T2, T3) => R
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class NamedFunction4[-T1, -T2, -T3, -T4, +R](val name: String, val f: (T1, T2, T3, T4) => R) extends (T1, T2, T3, T4) => R, Named

NamedFunction3 class.

NamedFunction3 class.

Type parameters

R

the result type

T1

the input type

T2

the input type

T3

the input type

T4

the input type

Value parameters

f

the function itself

name

the name of this function

Attributes

Companion
object
Supertypes
trait Named
trait (T1, T2, T3, T4) => R
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class NamedFunction5[-T1, -T2, -T3, -T4, -T5, +R](val name: String, val f: (T1, T2, T3, T4, T5) => R) extends (T1, T2, T3, T4, T5) => R, Named

NamedFunction3 class.

NamedFunction3 class.

Type parameters

R

the result type

T1

the input type

T2

the input type

T3

the input type

T4

the input type

T5

the input type

Value parameters

f

the function itself

name

the name of this function

Attributes

Companion
object
Supertypes
trait Named
trait (T1, T2, T3, T4, T5) => R
class Object
trait Matchable
class Any
object Param

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Param.type
case class Param(p: Either[String, Either[FreeParam, FunctionString]])

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Companion object to RenderableFunction

Companion object to RenderableFunction

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class RenderableFunction[R](arity: Int, w: FunctionString, cbn: List[Boolean], cs: ParamClasses)(f: Product => R)(using evidence$1: ClassTag[R]) extends Product => Try[R], Serializable

A representation of a function call. The function (func) which defines the function call is of form Product=>R where the product (tuple)

A representation of a function call. The function (func) which defines the function call is of form Product=>R where the product (tuple)

Created by scalaprof on 1/11/17.

TODO change Seq to List in definition of cbn

Type parameters

R

the ultimate return type of this RenderableFunction (must support ClassTag)

Value parameters

arity

the number of input parameters that are required to fully apply the given function (f)

cbn

a sequence of booleans, corresponding to each of the parameters of (untupled) func. If the boolean is true, then that parameter is call-by-name, i.e. a Function0[T] rather than a T.

cs

a sequence of ClassTags corresponding to the parameters to be passed to f

f

the function itself (this field is not considered in the hashCode and equals methods)

w

a human-readable representation of the function

Attributes

Companion
object
Supertypes
trait Product
trait Equals
trait Serializable
trait Product => Try[R]
class Object
trait Matchable
class Any
Show all
case class RenderableFunctionException(s: String, t: Throwable = ...) extends Exception

RenderableFunctionException

RenderableFunctionException

Value parameters

s

the message

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
trait SmartLogger

FP implementation of a logger.

FP implementation of a logger.

Created by scalaprof on 8/17/16.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class SmartLoggerBasic(logFunc: String => Unit, errorFunc: (String, Throwable) => Unit) extends SmartLogger

A basic logger.

A basic logger.

Value parameters

errorFunc

the error function

logFunc

the logger function

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait SmartLogger
class Object
trait Matchable
class Any
Show all
class SmartLoggerException(s: String, ex: Throwable) extends Exception

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
case class SmartLoggerSlf4JDebug(logger: Logger) extends SmartLogger

A logger which will log as debug on an Slf4J logger

A logger which will log as debug on an Slf4J logger

Value parameters

logger

an Slf4J logger

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait SmartLogger
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class SmartLoggerSlf4JInfo(logger: Logger) extends SmartLogger

A logger which will log as info on an Slf4J logger

A logger which will log as info on an Slf4J logger

Value parameters

logger

an Slf4J logger

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait SmartLogger
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object Spy

Companion object to Spy.

Companion object to Spy.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Spy.type
trait Spy

This trait and its related object provide a functional-programming style (if somewhat quick-and-dirty) spy feature for logging (or otherwise peeking at) the values of Scala expressions.

This trait and its related object provide a functional-programming style (if somewhat quick-and-dirty) spy feature for logging (or otherwise peeking at) the values of Scala expressions.

While this mechanism (by default) logs values using SLF4J, it does so in a functional style. You do not have to break up your functional expressions to write logging statements (unless they are the recursive calls of a tail-recursive method).

If you just want to slip in a quick invocation of Spy.spy, you will need to provide an implicit spyFunc. The proper simple way to do this is to declare a logger as follows (you can use any name you like since it's an implicit):

implicit val spyLogger: org.slf4j.Logger = Spy.getLogger(getClass)

There's even an (improper) default logger based on the Spy class itself which you can use simply by adding this: import Spy._

In order to use it with an explicitly defined spyFunc, please see the way it's done in SpySpec.

By default, spying is turned on so, if you want to turn it off for a portion of a run, you must set spying to false, then reset it as it was when you return. This is useful for benchmarking or any time you know that there will be just too much information (TMI).

However, there is another mechanism for turning spying off. For example, you have some code which you are continually working on. You don't like to release it with the calls to Spy intact so you remove them. Then you have to go to a significant amount of trouble to put them back. An alternative is to declare the spyLogger to be null (but then you really must include the type annotation as shown above).

Created by scalaprof on 8/17/16.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
case class Streamer[X](var s: Stream[X]) extends () => X

This class is based on a mutable Stream. Its purpose is like a one-time-pad: each value is yielded by the Streamer once and once only.

This class is based on a mutable Stream. Its purpose is like a one-time-pad: each value is yielded by the Streamer once and once only.

Type parameters

X

the underlying type and the type of the result

Value parameters

s

the Stream

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait () => X
class Object
trait Matchable
class Any
Show all
object TryWith

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
TryWith.type
case class VarArgs[T, X, Y](xYes: List[Either[X, Y]], x2t: X => T)

Type parameters

T

the underlying type of the args

X

one alternative underlying type of Either

Y

the other alternative underlying type of Either

Value parameters

x2t

a conversion function from X to T

xYes

a list of Either[X,Y] objects

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

type ParamClasses = List[ClassTag[_]]
type Parameter[T] = Either[T, Closure[_, T]]