core


License

License

GroupId

GroupId

org.manatki
ArtifactId

ArtifactId

volga-core_2.13
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

core
core
Project URL

Project URL

https://github.com/manatki/volga
Project Organization

Project Organization

org.manatki
Source Code Management

Source Code Management

https://github.com/manatki/volga

Download volga-core_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/org.manatki/volga-core_2.13/ -->
<dependency>
    <groupId>org.manatki</groupId>
    <artifactId>volga-core_2.13</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.manatki/volga-core_2.13/
implementation 'org.manatki:volga-core_2.13:0.1'
// https://jarcasting.com/artifacts/org.manatki/volga-core_2.13/
implementation ("org.manatki:volga-core_2.13:0.1")
'org.manatki:volga-core_2.13:jar:0.1'
<dependency org="org.manatki" name="volga-core_2.13" rev="0.1">
  <artifact name="volga-core_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.manatki', module='volga-core_2.13', version='0.1')
)
libraryDependencies += "org.manatki" % "volga-core_2.13" % "0.1"
[org.manatki/volga-core_2.13 "0.1"]

Dependencies

compile (6)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.1
org.typelevel : cats-core_2.13 jar 2.0.0
com.github.julien-truffaut : monocle-macro_2.13 jar 2.0.0
ru.tinkoff : tofu-optics-macro_2.13 jar 0.5.5
ru.tinkoff : tofu-core_2.13 jar 0.5.5
org.typelevel : simulacrum_2.13 jar 1.0.0

test (5)

Group / Artifact Type Version
com.lihaoyi : fastparse_2.13 jar 2.1.3
org.scalatest : scalatest_2.13 jar 3.1.0
org.scalacheck : scalacheck_2.13 jar 1.14.1
org.scalatestplus : scalacheck-1-14_2.13 jar 3.1.0.0
org.typelevel : mouse_2.13 jar 0.23

Project Modules

There are no modules declared in this project.

Volga

Release
Maven Central

Arrow and Symmetric Monoidal Category composition syntax helper

How to use:

Let's say you have type Process[Input, Output], you want to use process comprehensions for your type

  1. Define volga.Arr or volga.Symon instance for your type
  2. Import syntax extensions
    import volga.syntax.comp._
    import volga.syntax.cat._
    import volga.syntax.symon._ 
    // or import volga.syntax.arr._
  3. Prepare syntax composer for your type
        val process = arr[Process]
    or
        val process = symon[Process, Pair, One]
    where Pair and One are tensor product type constructor and unit type for your Symon instance
  4. write your arrows
    val someProcess1: Process[Pair[A,B], Pair[X, Y]] = ...
    val someProcess2: Process[Pair[C, X], Z] = ...
    val someProcess3: Process[One, D] = ...
    val someProcess4: Process[Y, One] = ...
    val someProcess5: Process[Z, E] = ...
    
    val myProcess: Process[Pair[Pair[A, B], C], Pair[D, E]] = process{ (a, b, c) =>
        val (x, y) = someProcess1(a, b)
        val z = someProcess2(c, x)
        ----
        val d = someProcess3()
        someProcess4(y)
        val e = someProcess5(z)
        (d, e)
    }

Syntactic rules

  1. a comprehension for arrow

    proc: (X1, X2, ...) -> (Y1, Y2, ...)

    or monoidal morphism (note left associativity of products)

    proc: (Tensor(...(Tensor(X1, X2), ...) -> Tensor(...Tensor(Y1, Y2),..)

    should form a lambda function having parameters of types (V[X1], V[X2], ...) =>

  2. last line in comprenension defined in (1.)

    should be in the form (y1, y2, ...) or non-assigning application someProcess(z1, z2, ...) where someProcess is an arrow

    proc: (Z1, Z2, ...) -> (Y1, Y2, ...)

    or monoidal morpshism (note left associativity of products)

    proc: (Tensor(...(Tensor(Z1, Z2), ...) -> Tensor(...Tensor(Y1, Y2),..)
  3. to use some arrow

    proc: (X1, X2, ...) -> (Y1, Y2, ...)

    or monoidal morphism (note left associativity of products)

    proc: (Tensor(...(Tensor(X1, X2), ...) -> Tensor(...Tensor(Y1, Y2),..)

    you can write

    val (y1, y2, ...) = proc(x1, x2, ...)
    
  4. non-assigning construction

    proc(x1, x2, ...)

    could be used to dispose of the result of an arrow, or use morphism with unit domain

  5. special block-separator

     ----

    could be used to enforce the end of parallel block

Additional rules for symmetric monoidal categories

  1. Any variable defined in the lambda parameter clause or extracted as a result of morphism application should be used exactly one time

Limitations.

Volga syntax works by extending your arrows and morphisms with the apply methods which then are analyzed by the macros.

Types which have apply method already i.e. Function1 and cats.data.Kleisli may not work. Consider volga.data.Kleisli instead.

org.manatki

Versions

Version
0.1