{"action":"created","issue":{"url":"https://api.github.com/repos/javaslang/javaslang/issues/288","labels_url":"https://api.github.com/repos/javaslang/javaslang/issues/288/labels{/name}","comments_url":"https://api.github.com/repos/javaslang/javaslang/issues/288/comments","events_url":"https://api.github.com/repos/javaslang/javaslang/issues/288/events","html_url":"https://github.com/javaslang/javaslang/issues/288","id":83055139,"number":288,"title":"Add substitute for removed Monad interface","user":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/javaslang/javaslang/labels/feature","name":"feature","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/javaslang/javaslang/milestones/18","html_url":"https://github.com/javaslang/javaslang/milestones/2.0.0","labels_url":"https://api.github.com/repos/javaslang/javaslang/milestones/18/labels","id":1091674,"number":18,"title":"2.0.0","description":"","creator":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"open_issues":17,"closed_issues":71,"state":"open","created_at":"2015-04-30T20:29:59Z","updated_at":"2015-07-31T13:05:53Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-05-31T10:06:35Z","updated_at":"2015-07-31T13:19:11Z","closed_at":null,"body":"The `Monad` interface was mainly used to standardize `map` and `flatMap` across types. This did not work well because we _relaxed_ the flatMap signature for Traversables (`flatMap(Function<? super T, ? extends Iterable<T>>`), which in turn did not work well with other monadic types like `Try`, `Option`, etc.\r\n\r\nChanging the `flatMap` signature of Traversables made them semi-monadic, because the original monad laws are not applicable any more but structural properties keep roughly the same.\r\n\r\nScala uses the trait [FilterMonadic](http://www.scala-lang.org/api/2.11.5/index.html#scala.collection.generic.FilterMonadic) to express properties which are needed for _for-comprehensions_. It would be nice, if Javaslang would have also one super-type for (semi-)monadic types.\r\n\r\nThe `flatMap` signature of such a type would have to be compatible with the existing `flatMap` definitions. Or the signature is extended by an instance builder, which is in Scala currently implicit and needed to convert an `Iterable` to an instance of the current type, e.g. `Option` (which may only contain one element). If this problem is solved, we may also have a common super interface `FilterMonadic`."},"comment":{"url":"https://api.github.com/repos/javaslang/javaslang/issues/comments/126689639","html_url":"https://github.com/javaslang/javaslang/issues/288#issuecomment-126689639","issue_url":"https://api.github.com/repos/javaslang/javaslang/issues/288","id":126689639,"user":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T13:19:11Z","updated_at":"2015-07-31T13:19:11Z","body":"What do you think of having a `Monad` / `FilterMonadic` interface with methods (in conjunction with the `Kind` for semi-higher order kinds):\r\n\r\n* `flatMapM`\r\n* `flattenM`\r\n\r\nHave these methods a different meaning, too, in other languages?\r\n\r\nI can't use the original names `flatMap` and `flatten` because they have a different, relaxed signature (with `Iterable` instead of Monad/FilterMonadic for Traversables).\r\n\r\nE.g. Play Framework's `Iteratee` [has a](https://www.playframework.com/documentation/2.4.x/api/scala/index.html#play.api.libs.iteratee.Iteratee) `flatMapM`."}}