Skip to content

Commit

Permalink
Improve INtelliJ support, fix codec hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Kolmogortsev committed Jul 20, 2023
1 parent 1c3312a commit acbc2a7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ addCommandAlias("fixCheck", "scalafmtCheckAll")
addCommandAlias("fix", "scalafmtAll")

val commonSettings = Seq(
version := "0.2.1",
version := "0.2.2",
scalaVersion := "3.3.0",
scalacOptions ++= Seq(
"-explain",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ case class Handle[F[

object Handle {

extension [F[
implicit class RouterOps[F[
_
], H, N <: Singleton, CommandName <: Tuple, ActionName <: Tuple, ActionIn <: Tuple, DialogName <: Tuple, DialogIn <: Tuple](
h: Handle[F, H, N, CommandName, ActionName, ActionIn, DialogName, DialogIn]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ import muffin.codec.*
import muffin.error.MuffinError
import muffin.http.Body

object codec extends CodecSupport[Encoder, Decoder] {

object codec extends codecA

trait codecA extends CodecLow {
given NothingTo: io.circe.Encoder[Nothing] = UnitTo.asInstanceOf[Encoder[Nothing]]

given NothingFrom: io.circe.Decoder[Nothing] = UnitFrom.asInstanceOf[Decoder[Nothing]]
}

trait CodecLow extends CodecSupport[Encoder, Decoder] {

given EncoderTo: FunctionK[Encoder, Encode] =
new FunctionK[Encoder, Encode] {
Expand Down Expand Up @@ -68,10 +77,6 @@ object codec extends CodecSupport[Encoder, Decoder] {

given LongFrom: io.circe.Decoder[Long] = Decoder.decodeLong

given NothingTo: io.circe.Encoder[Nothing] = UnitTo.asInstanceOf[Encoder[Nothing]]

given NothingFrom: io.circe.Decoder[Nothing] = UnitFrom.asInstanceOf[Decoder[Nothing]]

given AnyTo: io.circe.Encoder[Any] = UnitTo.asInstanceOf[Encoder[Any]]

given AnyFrom: io.circe.Decoder[Any] = UnitFrom.asInstanceOf[Decoder[Any]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import muffin.codec.*
import muffin.error.MuffinError
import muffin.http.Body

object codec extends CodecSupport[JsonEncoder, JsonDecoder] {
object codec extends CodecA {
given NothingTo: JsonEncoder[Nothing] = UnitTo.asInstanceOf[JsonEncoder[Nothing]]

given NothingFrom: JsonDecoder[Nothing] = UnitFrom.asInstanceOf[JsonDecoder[Nothing]]
}

trait CodecA extends CodecSupport[JsonEncoder, JsonDecoder] {

given EncodeTo[A: JsonEncoder]: Encode[A] = _.toJson

Expand Down Expand Up @@ -53,10 +59,6 @@ object codec extends CodecSupport[JsonEncoder, JsonDecoder] {

given LongFrom: JsonDecoder[Long] = JsonDecoder.long

given NothingTo: JsonEncoder[Nothing] = UnitTo.asInstanceOf[JsonEncoder[Nothing]]

given NothingFrom: JsonDecoder[Nothing] = UnitFrom.asInstanceOf[JsonDecoder[Nothing]]

given AnyTo: JsonEncoder[Any] = UnitTo.asInstanceOf[JsonEncoder[Any]]

given AnyFrom: JsonDecoder[Any] = UnitFrom.asInstanceOf[JsonDecoder[Any]]
Expand Down

0 comments on commit acbc2a7

Please sign in to comment.