Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider the MonadState => ApplicativeAsk and FunctorTell implication. #31

Closed
LukaJCB opened this issue Jun 24, 2018 · 1 comment · Fixed by #83
Closed

Reconsider the MonadState => ApplicativeAsk and FunctorTell implication. #31

LukaJCB opened this issue Jun 24, 2018 · 1 comment · Fixed by #83

Comments

@LukaJCB
Copy link
Member

LukaJCB commented Jun 24, 2018

Right now we have two instances that give you an ApplicativeAsk[F, E] if there's a MonadState[F, E] instance in scope, and a FunctorTell[F, L] instance when MonadState[F, L] is in scope.

These instances are probably useful and lawful, but it still doesn't quite feel right for me.
I kind of expect the environment parameter E in ApplicativeAsk to be immutable and never change, whereas if I have a StateT[F, E], it can change with each flatMap.
I'm not sure if this is a problem or not, but wanted to see what others think about this. :)

@LukaJCB
Copy link
Member Author

LukaJCB commented Oct 4, 2018

Btw, this can lead to ambiguities when importing from cats.mtl.implicits._ as can be seen in this fiddle: https://scalafiddle.io/sf/eybd1uY/0

import cats.mtl._
import cats.implicits._
import cats.mtl.implicits._

def strToInt = (s: String) => s.length

def foo[F[_]](implicit F: ApplicativeAsk[F, String], S: MonadState[F, String]): F[Int] =
  strToInt.reader[F]

I recommend removing these very soon, I'll try to come up with a PR ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant