frees-io / freestyle-cassandra

Freestyle Cassandra
http://frees.io/
Apache License 2.0
17 stars 4 forks source link

Parameterized implicits handlers #115

Closed eperinan closed 7 years ago

eperinan commented 7 years ago

Following this example https://github.com/frees-io/freestyle-cassandra-example/blob/master/basic/src/main/scala/freestyle/cassandra/sample/Implicits.scala#L42, I just seen that these implicits should be in the library.

I am starting to use in a real project and I would have to copy and paste these implicits but in my case, using Try vs Monix.

Apart form that, in others librarys we are providing these implicits.

What do you think @fedefernandez @FPerezP ?

fedefernandez commented 7 years ago

These implicits depend on the Session and Cluster instances and on the MonadError of monix. I agree with you, we could provide these implicits based on an existing MonadError instance:

implicit def clusterAPIInterpreter[M[_]](implicit cluster: Cluster, E: MonadError[M, Throwable]): ClusterAPI.Op ~> M = 
  clusterAPIHandler[M] andThen apiInterpreter[M, Cluster](cluster)