Skip to content

Commit

Permalink
Move classes
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-adam committed May 13, 2024
1 parent 6d00c0f commit c9a3b7b
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pl.writeonly.catculator.core
import cats.data.NonEmptyList
import mouse.all.anySyntaxMouse
import pl.writeonly.catculator.core.adt.calculus.Lambda
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._

object LambdaConfig {
val haskellConfig: LambdaConfig = LambdaConfig(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.writeonly.catculator.core.adt.calculus

import pl.writeonly.catculator.core.adt.tree.*
import pl.writeonly.catculator.core.adt.tree._

enum Combinator:
case S
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.writeonly.catculator.core.adt.calculus

import pl.writeonly.catculator.core.adt.calculus.Combinator.CombinatorBT
import pl.writeonly.catculator.core.adt.tree.BinaryTree.*
import pl.writeonly.catculator.core.adt.tree.BinaryTree._

object Constants {
val sCom: CombinatorBT = com(Combinator.S)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package pl.writeonly.catculator.core.adt.calculus

import cats.implicits.catsSyntaxEq
import pl.writeonly.catculator.core.adt.calculus.Combinator.CombinatorBT
import pl.writeonly.catculator.core.adt.calculus.Constants.*
import pl.writeonly.catculator.core.adt.calculus.Constants._
import spire.math.Natural

object InputEncoder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package pl.writeonly.catculator.core.generators

import pl.writeonly.catculator.core.adt.calculus.Combinator
import pl.writeonly.catculator.core.adt.calculus.Combinator.*
import pl.writeonly.catculator.core.adt.calculus.Combinator._
import pl.writeonly.catculator.core.adt.calculus.Lambda
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.adt.calculus.Sign

object HaskellGenerator {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package pl.writeonly.catculator.core.generators

import pl.writeonly.catculator.core.LambdaConfig.*
import pl.writeonly.catculator.core.LambdaConfig._
import pl.writeonly.catculator.core.adt.calculus.Combinator
import pl.writeonly.catculator.core.adt.calculus.Combinator.*
import pl.writeonly.catculator.core.adt.calculus.Combinator._
import pl.writeonly.catculator.core.adt.calculus.Lambda
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.adt.calculus.Sign
import pl.writeonly.catculator.core.reducer.SugarReducer.*
import pl.writeonly.catculator.core.reducers.SugarReducer._

object LambdaGenerator {
def generate(l: Lambda): String = l match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import cats.parse.Numbers.digits
import cats.parse.Parser.Expectation
import cats.parse.strings.Json.delimited.parser as jsonString
import cats.parse.Parser as P
import cats.syntax.all.*
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.*
import pl.writeonly.catculator.core.parsers.ParserUtil.*
import cats.syntax.all._
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.adt.calculus._
import pl.writeonly.catculator.core.parsers.ParserUtil._

object HaskellParser {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import cats.parse.Numbers.digits
import cats.parse.strings.Json.delimited.parser as jsonString
import cats.parse.{Parser => P}
import cats.parse.{Parser0 => P0}
import cats.syntax.all.*
import cats.syntax.all._
import pl.writeonly.catculator.core.adt.calculus
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Sign.*
import pl.writeonly.catculator.core.adt.calculus.*
import pl.writeonly.catculator.core.parsers.ParserUtil.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.adt.calculus.Sign._
import pl.writeonly.catculator.core.adt.calculus._
import pl.writeonly.catculator.core.parsers.ParserUtil._

object LambdaParser {
private val identifierStart: P[Char] = P.charWhere { c =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package pl.writeonly.catculator.core.reducer
package pl.writeonly.catculator.core.reducers

import pl.writeonly.catculator.core.Extras.ifElse
import pl.writeonly.catculator.core.adt.calculus.Combinator.*
import pl.writeonly.catculator.core.adt.calculus.Combinator._
import pl.writeonly.catculator.core.adt.calculus.Lambda
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import spire.implicits.eqOps

object AbstractionReducer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.writeonly.catculator.core.reducer
package pl.writeonly.catculator.core.reducers

import pl.writeonly.catculator.core.LambdaConfig
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.adt.calculus._

import scala.language.postfixOps

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package pl.writeonly.catculator.core.reducer
package pl.writeonly.catculator.core.reducers

import pl.writeonly.catculator.core.adt.calculus.Combinator.*
import pl.writeonly.catculator.core.adt.calculus.Combinator._
import pl.writeonly.catculator.core.adt.calculus.Lambda
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.tree.BinaryTree.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.adt.tree.BinaryTree._

object LambdaReducer {
def toCombinatorBT(l: Lambda): Either[Lambda, CombinatorBT] = l match {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package pl.writeonly.catculator.core.reducer
package pl.writeonly.catculator.core.reducers

import cats.data.NonEmptyList
import pl.writeonly.catculator.core.Extras.foldNonEmpty
import pl.writeonly.catculator.core.Extras.ifElse
import pl.writeonly.catculator.core.LambdaConfig
import pl.writeonly.catculator.core.adt.calculus
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Sign.*
import pl.writeonly.catculator.core.adt.calculus.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.adt.calculus.Sign._
import pl.writeonly.catculator.core.adt.calculus._
import spire.math.Natural.End
import spire.math.*
import spire.math._

object SugarReducer {
val haskellSugarReducer: SugarReducer = SugarReducer(LambdaConfig.haskellConfig)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.writeonly.catculator.core.adt.calculus

import pl.writeonly.catculator.core.adt.calculus.Combinator.*
import pl.writeonly.catculator.core.adt.calculus.Constants.*
import pl.writeonly.catculator.core.adt.tree.BinaryTree.*
import pl.writeonly.catculator.core.adt.calculus.Combinator._
import pl.writeonly.catculator.core.adt.calculus.Constants._
import pl.writeonly.catculator.core.adt.tree.BinaryTree._

import pl.writeonly.catculator.core.TableDrivenPropertySpec

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pl.writeonly.catculator.core.adt.calculus
package pl.writeonly.catculator.core.generators

import pl.writeonly.catculator.core.TableDrivenPropertySpec
import pl.writeonly.catculator.core.adt.calculus.Combinator.*
import pl.writeonly.catculator.core.adt.calculus.Combinator._

class CombinatorSpec extends TableDrivenPropertySpec {
it should "generate code for BinaryTree of Combinators" in {
import pl.writeonly.catculator.core.adt.tree.BinaryTree.*
import pl.writeonly.catculator.core.adt.tree.BinaryTree._
val combinators = Table(
("ast", "code"),
(Leaf(I), "I"),
Expand All @@ -17,7 +17,7 @@ class CombinatorSpec extends TableDrivenPropertySpec {
}

it should "generate code for Tree of Combinators" in {
import pl.writeonly.catculator.core.adt.tree.Tree.*
import pl.writeonly.catculator.core.adt.tree.Tree._
val combinators = Table(
("ast", "code"),
(Leaf(I), "I"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package pl.writeonly.catculator.core.adt.calculus
package pl.writeonly.catculator.core.parsers

import mouse.all.anySyntaxMouse
import org.scalatest.prop.*
import pl.writeonly.catculator.core.LambdaConfig.*
import org.scalatest.prop._
import pl.writeonly.catculator.core.LambdaConfig._
import pl.writeonly.catculator.core.TableDrivenPropertySpec
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.generators.HaskellGenerator
import pl.writeonly.catculator.core.parsers.HaskellParser
import pl.writeonly.catculator.core.reducer.AbstractionReducer.reduceAbstraction
import pl.writeonly.catculator.core.reducer.FunctionReducer
import pl.writeonly.catculator.core.reducer.FunctionReducer.*
import pl.writeonly.catculator.core.reducer.LambdaReducer.toCombinatorBT
import pl.writeonly.catculator.core.reducer.SugarReducer.*
import pl.writeonly.catculator.core.reducers.AbstractionReducer.reduceAbstraction
import pl.writeonly.catculator.core.reducers.FunctionReducer
import pl.writeonly.catculator.core.reducers.FunctionReducer._
import pl.writeonly.catculator.core.reducers.LambdaReducer.toCombinatorBT
import pl.writeonly.catculator.core.reducers.SugarReducer._

import scala.language.postfixOps

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package pl.writeonly.catculator.core.adt.calculus
package pl.writeonly.catculator.core.parsers

import org.scalatest.prop.TableFor3
import pl.writeonly.catculator.core.TableDrivenPropertySpec
import pl.writeonly.catculator.core.adt.calculus.Lambda.*
import pl.writeonly.catculator.core.adt.calculus.Lambda
import pl.writeonly.catculator.core.adt.calculus.Lambda._
import pl.writeonly.catculator.core.generators.LambdaGenerator
import pl.writeonly.catculator.core.parsers.LambdaParser
import pl.writeonly.catculator.core.reducer.AbstractionReducer.reduceAbstraction
import pl.writeonly.catculator.core.reducer.SugarReducer.*
import pl.writeonly.catculator.core.reducers.AbstractionReducer.reduceAbstraction
import pl.writeonly.catculator.core.reducers.SugarReducer._

class LambdaSpec extends TableDrivenPropertySpec {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package pl.writeonly.catculator.core.adt.calculus
package pl.writeonly.catculator.core.reducers

import pl.writeonly.catculator.core.UnitSpec
import pl.writeonly.catculator.core.adt.calculus.Combinator.I
import pl.writeonly.catculator.core.adt.calculus.Lambda.Com
import pl.writeonly.catculator.core.reducer.SugarReducer
import pl.writeonly.catculator.core.reducer.SugarReducer.lambdaSugarReducer
import pl.writeonly.catculator.core.reducers.SugarReducer
import pl.writeonly.catculator.core.reducers.SugarReducer.lambdaSugarReducer

class LambdaTest extends UnitSpec {
"A SugarReducer" should {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.writeonly.catculator.http4s

import cats.effect.IO
import org.http4s.*
import org.http4s.implicits.*
import org.http4s._
import org.http4s.implicits._
import munit.CatsEffectSuite

class HelloWorldSpec extends CatsEffectSuite:
Expand Down

0 comments on commit c9a3b7b

Please sign in to comment.