All Projects → shawjef3 → Harmony

shawjef3 / Harmony

Licence: other
Scalaz and Cats compatibility

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to Harmony

action-cats
A quick Github action which posts a cat gif on your PRs to reward you for pushing code!
Stars: ✭ 64 (+190.91%)
Mutual labels:  cats
console4cats
💻 Effect-type agnostic Console I/O for Cats Effect (archived, use Cats Effect 3 instead)
Stars: ✭ 55 (+150%)
Mutual labels:  cats
cats-helper
Helpers for cats & cats-effect
Stars: ✭ 19 (-13.64%)
Mutual labels:  cats
ecommerce
A project for exploring Akka with Scala
Stars: ✭ 24 (+9.09%)
Mutual labels:  cats
tradeio
A disciplined way to purely functional domain models in Scala
Stars: ✭ 19 (-13.64%)
Mutual labels:  cats
fs2-ftp
Simple client for Ftp/Ftps/Sftp
Stars: ✭ 24 (+9.09%)
Mutual labels:  cats
bfect
Some bifunctor IO type classes
Stars: ✭ 19 (-13.64%)
Mutual labels:  cats
swam
WebAssembly engine in Scala
Stars: ✭ 38 (+72.73%)
Mutual labels:  cats
telegramium
Telegramium or F[ Tg ] - pure functional Telegram Bot API implementation for Scala.
Stars: ✭ 42 (+90.91%)
Mutual labels:  cats
http4s-dom
http4s, in a browser near you
Stars: ✭ 13 (-40.91%)
Mutual labels:  cats
bobcats
Typelevel's very own CryptoKitties!
Stars: ✭ 20 (-9.09%)
Mutual labels:  cats
advxml
A lightweight, simple and functional library DSL to work with XML in Scala with Cats
Stars: ✭ 54 (+145.45%)
Mutual labels:  cats
vault4s
Vault Client Library For Scala
Stars: ✭ 15 (-31.82%)
Mutual labels:  cats
nine-cards-backend
An Open Source Android Launcher built with Scala on Android
Stars: ✭ 61 (+177.27%)
Mutual labels:  cats
anise-cheezball-rising
an exciting new adventure for the Game Boy Color
Stars: ✭ 72 (+227.27%)
Mutual labels:  cats
zenith
⚡ Functional Scala HTTP server, client, and toolkit.
Stars: ✭ 15 (-31.82%)
Mutual labels:  cats
free-arrow
Implementation of the Free Arrow in Scala and other helpful tools for working with Arrows
Stars: ✭ 14 (-36.36%)
Mutual labels:  cats
alice
An hackathon project made for RSF/RWB by AnDaolVras' Devs (Coworking Space in #Brest , Western France)
Stars: ✭ 13 (-40.91%)
Mutual labels:  cats
trembita
Model complex data transformation pipelines easily
Stars: ✭ 44 (+100%)
Mutual labels:  cats
surepy
🐾 Library & CLI to monitor and control the Pet Door & Cat Flap Connect 🚪 the Pet Feeder Connect 🍽 and the Felaqua 💦 sold by Sure Petcare
Stars: ✭ 45 (+104.55%)
Mutual labels:  cats

Harmony

A Cats and Scalaz compatibility library.

Tired of writing separate code for Cats and Scalaz? All that preprocessor noise and those extra packages are too much work! Just pick between Scalaz and Cats. If your clients don't like your choice, they can use one import from this library to become happy.

We can all live together!

Usage

SBT dependency

cats-core

cats version scalaz version harmony version dependency
0.8.1 7.2.* 1.1 "me.jeffshaw.harmony" %% "harmony_cats0-8-1_scalaz7-2" % "1.1"
0.9.0 7.2.* 1.1 "me.jeffshaw.harmony" %% "harmony_cats0-9-0_scalaz7-2" % "1.1"
1.0.0-MF 7.2.* 2.0 "me.jeffshaw.harmony" %% "harmony_cats1-0-0-mf_scalaz7-2" % "2.0"

cats-mtl-core

cats version scalaz version harmony version dependency
0.0.2 7.2.* 2.0 "me.jeffshaw.harmony" %% "harmony_cats-mtl-core0-0-2_scalaz7-2" % "2.0"

The naming scheme will change if Cats or Scalaz change their binary compatibility guarantees. Cats has no such guarantee.

Harmony releases sharing an artifact name and major version should be binary compatible.

Imports

domain codomain type class data types both
Cats Scalaz import harmony.toscalaz.TypeClasses._ import harmony.toscalaz.Data._ import harmony.ToScalaz._
Scalaz Cats import harmony.tocats.TypeClasses._ import harmony.tocats.Data._ import harmony.ToCats._

Or, if you just want everyone to get along,

import harmony.Everyone._

Examples

Want a cats.Functor for scalaz.IList?

import harmony.tocats.typeclass.FunctorConverter._

cats.Functor[scalaz.IList]

Want to use a scalaz.Writer in a cats.data.Writer?

import cats.instances.int._
import harmony.tocats.data.WriterTConverter._

val tell3 = scalaz.WriterT.tell(3)

val w: cats.data.WriterT[cats.Id, Int, Unit] =
  for {
    _ <- cats.data.Writer.tell(2)
    _ <- tell3
  } yield ()

w.run // yields (5, ())

Provided conversions

Please see the Google doc.

Something missing?

Please fork this repo, add the relevant conversions to the relevant files, and do a pull request.

Or you can open an issue describing the conversions you need and someone might do it for you.

Tests

Harmony could use many more tests. As the library gains popularity I will add more.

Changes

2.0

  • minimize use of val for overrides.
  • Conversions that require a second instance require the instance be in the target library, not the source. For example, the converter to cats.arrow.Choice requires a cats.functor.Profunctor, not a scalaz.Profunctor.
  • Cats moved some type classes to a separate package, cats-mtl-core. The converters for those type classes are in a new Harmony library.

1.1

  • Initialization fixes

1.0

  • Initial release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].