This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.arrow.Category | |
import cats.data.{Chain, Kleisli, Writer} | |
import cats.syntax.writer._ | |
import cats.syntax.compose._ | |
type ChainWriter[T] = Writer[Chain[String], T] | |
type KWriter[A, B] = Kleisli[ChainWriter, A, B] | |
//val chainInstance: Category[KWriter] = new Category[KWriter] { | |
// def id[A]: KWriter[A, A] = Kleisli[ChainWriter, A, A] { _.writer(Chain.empty) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Contravariant | |
import cats.implicits._ | |
case class Money(amount: Int) | |
case class Earnings(basic: Money) | |
case class Deductions(tax: Money) | |
case class Salary(earnings: Earnings, deductions: Deductions) | |
val salary: Salary = Salary(Earnings(Money(100)), Deductions(Money(10))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.data.Chain | |
import cats.instances.option._ | |
import cats.instances.tuple._ | |
import cats.syntax.bifoldable._ | |
import cats.syntax.bitraverse._ | |
import cats.syntax.option._ | |
import cats.syntax.traverse._ | |
import cats.{Applicative, Bitraverse, Eval} | |
import scala.language.higherKinds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Alternative | |
import cats.syntax.apply._ | |
import cats.syntax.semigroupk._ | |
import cats.syntax.option._ | |
import cats.instances.option._ | |
import cats.syntax.traverse._ | |
import cats.instances.list._ | |
trait Div[A] { | |
def div(n: Int): Option[A] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package adcal_1222 | |
import adcal_1222.Amida._ | |
import cats.instances.AllInstances | |
import cats.kernel.laws.discipline.GroupTests | |
import cats.{Eq, Group} | |
import org.scalacheck.{Arbitrary, Gen} | |
import org.specs2.Specification | |
import org.typelevel.discipline.specs2.Discipline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package adcal1222_3 | |
import cats.{Applicative, Order} | |
import cats.data.NonEmptyList | |
import cats.data.NonEmptyList.one | |
import cats.instances.list._ | |
import cats.instances.string._ | |
import cats.syntax.either._ | |
import cats.syntax.traverse._ | |
import org.scalacheck.cats.implicits._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
trait Prime4949Solver { | |
def primes: Stream[Int] | |
def is4949Prime(n: Int): Boolean = { | |
def loop(m: Int): Boolean = (m / 10, m % 10) match { | |
case (_, 4) | (_, 9) => true | |
case (0, _) => false | |
case (d, _) => loop(d) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import re | |
import logging | |
from urllib.parse import unquote | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
def lambda_handler(event, context): | |
logger.info(json.dumps(event)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import logging | |
from urllib import request, parse | |
token = os.environ['TOKEN'] | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
def lambda_handler(event, context): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import json | |
import logging | |
from urllib import request, parse | |
import pymysql | |
token = os.environ['TOKEN'] | |
rds_host = os.environ['RDS_HOST'] | |
name = os.environ['NAME'] |