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 com.softwaremill.freemonads | |
import cats.free.Free | |
import cats.~> | |
import cats._, cats.std.all._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.Future | |
sealed trait External[A] | |
case class Tickets(count: Int) extends AnyVal |
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
object aggregate { | |
type ValidationStatus[S] = \/[String, S] | |
type ProcessingStatus[S] = \/[String, S] | |
type ReaderTStatus[A, S] = ReaderT[ValidationStatus, A, S] | |
object ReaderTStatus extends KleisliInstances with KleisliFunctions { | |
def apply[A, S](f: A => ValidationStatus[S]): ReaderTStatus[A, S] = kleisli(f) | |
} |
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 com.mtgox.api; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
import java.net.URLEncoder; | |
import java.util.HashMap; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import javax.crypto.Mac; |
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
object Rebates { | |
type RebatePolicy = (Product, Int, Money) => Money | |
} | |
object standardRebate extends ((Double, Int) => RebatePolicy) { | |
def apply(rebate: Double, minimalQuantity: Int) = { | |
(product, quantity, regularCost) => { | |
val rebateRatio = BigDecimal(rebate / 100) | |
if (quantity >= minimalQuantity) |
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
public abstract class RebateDecorator implements RebatePolicy { | |
protected RebatePolicy decorated; | |
protected RebateDecorator(RebatePolicy decorated){ | |
this.decorated = decorated; | |
} | |
} |
NewerOlder