GithubHelp home page GithubHelp logo

harmony's Introduction

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 version scalaz version harmony version dependency
0.8.1 7.2.* 1.0 "me.jeffshaw" %% "harmony_cats0.8.1_scalaz7.2" % "1.0"
0.9.0 7.2.* 1.0 "me.jeffshaw" %% "harmony_cats0.9.0_scalaz7.2" % "1.0"

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

Imports

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

domain codomain type class data types both
Cats Scalaz import harmony.toscalaz.TypeClasses._ import harmony.tocats.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 a 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.

harmony's People

Contributors

shawjef3 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.