Commit 5319f02
committed
simplify the distribute Return case
This commit shouldn't change the meaning of the code:
lift (Return r) =
-- by Monad instance of Stream
lift (return r) =
-- by laws of MonadTrans/lift
return r
However, the result may be more efficient. In the case where t = Stream f, we have:
lift (Return r) =
-- by definition of lift
(Effect . fmap Return) (Return r) =
-- by definition of (.)
Effect (fmap Return (Return r)) =
-- by definition of fmap
Effect (Return (Return r))
But doing `return r` directly produces just `Return r` (without the no-op Effect wrapper).1 parent 608c4cf commit 5319f02
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
766 | | - | |
| 766 | + | |
767 | 767 | | |
768 | 768 | | |
769 | 769 | | |
| |||
0 commit comments