typelevel / scalaz-contrib

Interoperability libraries & additional data structures and instances for Scalaz
http://typelevel.org
MIT License
54 stars 16 forks source link

Add more instances #10

Closed larsrh closed 11 years ago

larsrh commented 11 years ago

See https://github.com/scalaz/scalaz/pull/213.

edofic commented 11 years ago

also monad transformers for included monads for Try and Future would be very nice. might give it a go if I can find some time

EDIT upon trying to implement FutureT I realized it is impossible without blocking. consider this piece of code

def generate(n: Int): FutureT[List,Int] = FutureT(List.fill(n)(Future(n)))
val list: FutureT[List, Int] = ...
list flatMap generate

I repeats each number it's-value times. In order to return from the flatMap you need to know the number of elements. Therefore flatMap must be blocking so it's better not to include FutureT at all

larsrh commented 11 years ago

Good idea. If you could do it, that would be terrific!