Val

object Val

Value Container Framework

Read more in the Guide.

Val is fully exported to scalqa root, thus all members and aliases of Val can be called with or without "Val." prefix.

For example:

val v:  Val.~[Int]  = ???
// is same as
val v: ~[Int]       = ???
Source
__.scala
class java.lang.Object
trait scala.Matchable
class Any

Member

abstract class Buffer[A] extends Idx.Mutable[A] with Able.Contain[A]

Value Buffer

Buffer is the default implementation of Mutable Indexed Collection

Source
__.scala
abstract class Buffer[A] extends Idx.Mutable[A] with Able.Contain[A]

Value Buffer

Buffer is the default implementation of Mutable Indexed Collection

Source
__.scala
trait Collection[+A] extends Able.~[A] with Able.Size

Value Collection

Collection is the root of collections framework

There are 3 main subtypes:

  • Idx - values can be accessed by Int index
  • Lookup - values can be accessed by key lookup
  • StableSet - collection of unique values
Source
__.scala
trait Collection[+A] extends Able.~[A] with Able.Size

Value Collection

Collection is the root of collections framework

There are 3 main subtypes:

  • Idx - values can be accessed by Int index
  • Lookup - values can be accessed by key lookup
  • StableSet - collection of unique values
Source
__.scala
trait Idx[+A] extends Collection[A]

Indexed Collection

Elements in Idx can be efficiently accessed with Int index starting from 0

The immutable implementation of Idx is >< (pack)

Source
__.scala
trait Idx[+A] extends Collection[A]

Indexed Collection

Elements in Idx can be efficiently accessed with Int index starting from 0

The immutable implementation of Idx is >< (pack)

Source
__.scala
trait Lookup[A, +B] extends Collection[B]

Lookup Collection

In Lookup collection every element is stored with a 'key' and can be accessed (looked up) with this 'key'

It is a greatly simplified equivalent of scala.Map

Source
__.scala
trait Lookup[A, +B] extends Collection[B]

Lookup Collection

In Lookup collection every element is stored with a 'key' and can be accessed (looked up) with this 'key'

It is a greatly simplified equivalent of scala.Map

Source
__.scala
opaque type Opt[+A]

Value Option

Opt is a container, which can hold a single value or be empty

Option can be converted to value with method or, which also takes default value for the case when option is empty

Option is often used as Boolean, where ''Option'' with value is converted to 'true' and empty option is converted to 'false'

By Scalqa convention, method names, which return Opt type, are ended with '_?' instead of word 'Option'

val l: Lookup[Int,String] = ???

val o: Opt[String] = l.get_?(12)

if(o) println("Value found.")
else  println("Value not found.")
Source
__.scala
abstract class ><[A] extends Idx[A]

>< is Value Pack

>< is the most ubiquitous immutable collection, like List in Scala

Unlike List, >< is mostly backed by an Array and can be specialized. It usually has smaller memory footprint and in most cases is faster to manipulate data.

Source
__.scala
abstract class ><[A] extends Idx[A]

>< is Value Pack

>< is the most ubiquitous immutable collection, like List in Scala

Unlike List, >< is mostly backed by an Array and can be specialized. It usually has smaller memory footprint and in most cases is faster to manipulate data.

Source
__.scala
trait Pro[+A]

Value Provider

Whenever value provider belongs to an object, it effectively becomes a property holder for this object.

Properties Framework

There are 4 types of standard properties:

The inheritance graph looks like:

       Pro.O
      /      \
   Pro        Pro.OM
      \     /
       Pro.M

By Scalqa convention, method names, which return Pro type, are ended with '_*' instead of word 'Property'

Here is an example of 'name' property definition hierarchy:

        trait Foo:                                   // 'name' is read only
          def name_*          : Pro[String]
          def name            : String = name_*()    // required shortcut

        trait Foo_M extends Foo:                     // 'name' is read/write
          def name_*          : Pro.M[String]
          def name_=(v:String): Unit = name_*() = v  // required shortcut

        trait Foo_O extends Foo:                     // 'name' is read/listenTo
          def name_*          : Pro.O[String]

        trait Foo_OM extends Foo_O with Foo_M:       // 'name' is read/write/listenTo
          def name_*          : Pro.OM[String]

Note. The 'required shortcuts' must be implemented. They will not even show up in documentation, because they are assumed to be there

Source
__.scala
trait Pro[+A]

Value Provider

Whenever value provider belongs to an object, it effectively becomes a property holder for this object.

Properties Framework

There are 4 types of standard properties:

The inheritance graph looks like:

       Pro.O
      /      \
   Pro        Pro.OM
      \     /
       Pro.M

By Scalqa convention, method names, which return Pro type, are ended with '_*' instead of word 'Property'

Here is an example of 'name' property definition hierarchy:

        trait Foo:                                   // 'name' is read only
          def name_*          : Pro[String]
          def name            : String = name_*()    // required shortcut

        trait Foo_M extends Foo:                     // 'name' is read/write
          def name_*          : Pro.M[String]
          def name_=(v:String): Unit = name_*() = v  // required shortcut

        trait Foo_O extends Foo:                     // 'name' is read/listenTo
          def name_*          : Pro.O[String]

        trait Foo_OM extends Foo_O with Foo_M:       // 'name' is read/write/listenTo
          def name_*          : Pro.OM[String]

Note. The 'required shortcuts' must be implemented. They will not even show up in documentation, because they are assumed to be there

Source
__.scala
trait Promise[+A]

Value Promise

Promise represents value which will be available later (at some point of time), but it can now be incorporated in current calculations

val s: String = "Hello"

val v: Promise[String] = Promise(s + " Concurrent Promise!")

v.result_?.tp    // Value is likely not available yet

v.onResult(_.tp) // Will run when value is available

// Output
Opt(\/)
Result(Hello Concurrent Promise!)
Source
__.scala
trait Promise[+A]

Value Promise

Promise represents value which will be available later (at some point of time), but it can now be incorporated in current calculations

val s: String = "Hello"

val v: Promise[String] = Promise(s + " Concurrent Promise!")

v.result_?.tp    // Value is likely not available yet

v.onResult(_.tp) // Will run when value is available

// Output
Opt(\/)
Result(Hello Concurrent Promise!)
Source
__.scala
abstract class <>[A] extends Able.Contain[A]

<> is Value Range

<> is defined with the following defs:

  • start
  • end,
  • and ordering, which makes the above meaningful

<> has a notion that an element can be within the range, i.e. between start and end, or outside

Note. Scala provided range structures (Range and NumericRange) are implemented more as collections and this class is designed to close this void focusing on generic range operations

Source
__.scala
abstract class <>[A] extends Able.Contain[A]

<> is Value Range

<> is defined with the following defs:

  • start
  • end,
  • and ordering, which makes the above meaningful

<> has a notion that an element can be within the range, i.e. between start and end, or outside

Note. Scala provided range structures (Range and NumericRange) are implemented more as collections and this class is designed to close this void focusing on generic range operations

Source
__.scala
opaque type Result[+A]

Value Result

Result is a container, which holds either 'value' or 'problem', which explains why value is not available.

Unlike Opt, Result is never void, even if there is no value, then, there must be a problem.

By Scalqa convention, method names, which return Result type, are ended with '_??' instead of word 'Result'

val r1: Result[Int] = "123".toInt_??

r1.tp   // Prints Result(123)

val r2: Result[Int] = "ABC".toInt_??

r2.tp   // Prints Result(Problem(For input string: "ABC"))
Source
__.scala
trait ~[+A]

~ is Value Stream

Note. Stream companion object is Val.~, but when called without prefix it is ~~ (double tilde).

Stream has just one method to be implemented, but it has large attached libraries for:

By Scalqa convention, method names, which return ~, are ended with '_~'

val s: ~[Char] = "ABCD".char_~

s.tp  // Prints ~(A, B, C, D)

Read more in the Guide.

Source
__.scala
trait ~[+A]

~ is Value Stream

Note. Stream companion object is Val.~, but when called without prefix it is ~~ (double tilde).

Stream has just one method to be implemented, but it has large attached libraries for:

By Scalqa convention, method names, which return ~, are ended with '_~'

val s: ~[Char] = "ABCD".char_~

s.tp  // Prints ~(A, B, C, D)

Read more in the Guide.

Source
__.scala

Alias

Type alias

Type alias

Shortcut to Val.Collection.StableSet

Source
__.scala

Companion alias

Companion alias

Shortcut to Val.Collection.StableSet

Source
__.scala