Skip to content

Commit

Permalink
Implement Invariant, tidy imports
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Jan 29, 2023
1 parent d0a9c7b commit a6ac0b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion dom/src/main/scala/fs2/dom/History.scala
Expand Up @@ -16,7 +16,6 @@

package fs2.dom

import cats.data.OptionT
import cats.effect.kernel.Async
import cats.effect.kernel.Ref
import cats.effect.std.Queue
Expand Down
6 changes: 5 additions & 1 deletion dom/src/main/scala/fs2/dom/Serializer.scala
Expand Up @@ -17,7 +17,6 @@
package fs2.dom

import cats.Invariant
import cats.effect.kernel.Sync
import cats.syntax.all._
import scodec.bits.ByteVector

Expand All @@ -42,6 +41,11 @@ sealed abstract class Serializer[A] { outer =>

object Serializer {

implicit lazy val invariant: Invariant[Serializer] = new Invariant[Serializer] {
def imap[A, B](fa: Serializer[A])(f: A => B)(g: B => A): Serializer[B] =
fa.imap(f)(g)
}

private final case object Identity extends Serializer[js.Any]
private final case object Number extends Serializer[Double]
private final case object String extends Serializer[java.lang.String]
Expand Down

0 comments on commit a6ac0b8

Please sign in to comment.