Gabriella439 / pipes

Compositional pipelines
BSD 3-Clause "New" or "Revised" License
487 stars 72 forks source link

Relax Monad constraint to Functor #165

Closed infinity0 closed 6 years ago

infinity0 commented 8 years ago

The default way of recursing a Proxy transformation f inside the M case is to do M m -> M m >>= \p' -> return (f p') which can be simplified to M (fmap f m), in many cases allowing us to relax the Monad constraint to Functor.

I made a start to this in infinity0/Haskell-Pipes-Library@5218df7d but do you think it's a good idea? If so I can complete it and send in a PR. I don't see a specific use case for a non-Monad Functor Pipe right this minute, but someone else might in the future.

Gabriella439 commented 8 years ago

I do eventually plan on doing this. I was just waiting until Debian stable upgrades to ghc-7.10.3 so that there are no noisy (Functor m, Monad m) constraints in the code

infinity0 commented 8 years ago

Because of how the release process works, Debian stable is highly unlikely to get 7.10.3 until (probably) 2017-05 when stretch (current Debian testing) will probably be released as stable. However 7.10.3 is already in jessie-backports - which stable users would need to manually add to their system. Not sure if this changes your plans.

Gabriella439 commented 8 years ago

I'm fine waiting. There's no hurry

ghost commented 8 years ago

I presume that using fmap f rather than >>= return . f would also make pipes at least slightly faster?

ghost commented 7 years ago

I presume that using fmap f rather than >>= return . f would also make pipes at least slightly faster?

A lot faster, I would assume. build/foldr fusion should be a lot nicer.

cronokirby commented 6 years ago

Is there still interest in working on this?

Gabriella439 commented 6 years ago

@cronokirby: Yeah, I would definitely accept this change now

cronokirby commented 6 years ago

Perhaps we should close this, as of https://github.com/Gabriel439/Haskell-Pipes-Library/pull/194 ?

Gabriella439 commented 6 years ago

@cronokirby: Yep! This is fixed now. Thanks 🙂