Skip to content

Commit 32b1fa7

Browse files
committed
Refactor
1 parent c36d5d9 commit 32b1fa7

File tree

1 file changed

+3
-4
lines changed
  • catculator-core/src/main/scala/pl/writeonly/catculator/core/adt/calculus

1 file changed

+3
-4
lines changed

catculator-core/src/main/scala/pl/writeonly/catculator/core/adt/calculus/InputEncoder.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package pl.writeonly.catculator.core.adt.calculus
22

3-
import cats.implicits.catsSyntaxEq
43
import pl.writeonly.catculator.core.adt.calculus.Combinator.CombinatorBT
54
import pl.writeonly.catculator.core.adt.calculus.Constants._
65
import spire.math.Natural
@@ -21,9 +20,9 @@ object InputEncoder {
2120

2221
def cons(a: CombinatorBT, b: CombinatorBT): CombinatorBT = app3(sCom, Constants.app3SI(appK(a)), appK(b))
2322

24-
def church(n: Natural): CombinatorBT = n.toBigInt match {
25-
case n if n === BigInt(0) => falseCom
26-
case n => succChurch(Natural(n - BigInt(1)))
23+
def church(n: Natural): CombinatorBT = n match {
24+
case n if n === Natural.zero => falseCom
25+
case n => succChurch(n - Natural.one)
2726
}
2827

2928
private def succChurch(n: Natural): CombinatorBT = successor(church(n))

0 commit comments

Comments
 (0)