spebbe / dartz

Functional programming in Dart
MIT License
755 stars 59 forks source link

Compile error on Dart 2.4.0 #18

Closed xsobolx closed 5 years ago

xsobolx commented 5 years ago

I've got this compiler message:

Compiler message:
...pub-cache/hosted/pub.dartlang.org/dartz-0.8.5/lib/src/io.dart:69:7: Error: Class 'FreeMonad with MonadCatch<Free<IOOp, dynamic>>' inherits multiple members named 'bind' with incompatible signatures. Try adding a declaration of 'bind' to 'FreeMonad with MonadCatch<Free<IOOp, dynamic>>'. class IOMonad extends FreeMonad with MonadCatch<Free<IOOp, dynamic>> { // ignore: inconsistent_method_inheritance ^
...pub-cache/hosted/pub.dartlang.org/dartz-0.8.5/lib/src/free.dart:79:24: Context: This is the inherited member. @override Free<F, B> bind<A, B>(Free<F, A> fa, Free<F, B> f(A a)) => fa.bind(f); ^^^^
...pub-cache/hosted/pub.dartlang.org/dartz-0.8.5/lib/src/monad.dart:4:5: Context: This is the inherited member. F bind<A, B>(covariant F fa, covariant F f(A a));
^^^^
...pub-cache/hosted/pub.dartlang.org/dartz-0.8.5/lib/src/io.dart:69:7: Error: Class 'IOMonad' inherits multiple members named 'bind' with incompatible signatures. Try adding a declaration of 'bind' to 'IOMonad'.
class IOMonad extends FreeMonad with MonadCatch<Free<IOOp, dynamic>> { // ignore: inconsistent_method_inheritance ^^^^^^^
...pub-cache/hosted/pub.dartlang.org/dartz-0.8.5/lib/src/free.dart:79:24: Context: This is the inherited member. @override Free<F, B> bind<A, B>(Free<F, A> fa, Free<F, B> f(A a)) => fa.bind(f); ^^^^
...pub-cache/hosted/pub.dartlang.org/dartz-0.8.5/lib/src/monad.dart:4:5: Context: This is the inherited member. F bind<A, B>(covariant F fa, covariant F f(A a));
^^^^

Dart version:

Dart VM version: 2.4.0 (Wed Jun 19 11:53:45 2019 +0200) on "macos_x64"

spebbe commented 5 years ago

Thanks for reporting -- will have a look!

spebbe commented 5 years ago

@xsobolx: thanks for waiting. on vacation, but have now added a solution in PR #22. I'll merge it and make a new release if no one is opposed.

@modulovalue, thanks for your solution! I've commented on your PR.

xsobolx commented 5 years ago

That's good news! Thank you!

rich-j commented 5 years ago

Could use this in branch 0_9_0_wip_2 too.

Flutter beta channel just updated to v1.8.3 which uses Dart 2.5.0. I forked and merged your PR #22 - it works.

spebbe commented 5 years ago

@xsobolx, @rich-j -- Sorry for the radio silence -- been on vacay! This has now been released as 0.8.6 and also rebased onto 0_9_0_wip_2.