Re: [Haskell-cafe] Newbie: State monad example questions

On Fri, May 23, 2008 at 5:17 PM, Thomas Hartman
Maybe I don't like to read backwards. ;-)
(from Control.arrow) is like flip (.)
That's something I considered. I like the `|>` operator found in F# (I hope it's not a curse word on this list) which is equivalent to `flip (.)`. It's easy to define in Haskell (|>) :: (a -> b) -> (b -> c) -> a -> c (|>) = flip (.) I even started to use it in my code and then stopped. It may be a stupid concern but as many optimizations performed by GHC are made through rewrite rules and I was worried that those rules may not fire when using this new operator. I never thought of using `>>>` for this, but again I wonder how it will work with rewrite rules. Olivier.

Hello Olivier, Saturday, May 24, 2008, 5:37:32 AM, you wrote: (|>>) = flip (.)
I even started to use it in my code and then stopped. It may be a stupid concern but as many optimizations performed by GHC are made through rewrite rules and I was worried that those rules may not fire when using this new operator.
afaik ghc, |> would be rewritten to flip (.) which would be rewritten to application of first function to second one and so on. rewrite rules doesn't work only on your original code but on intermediate variations too -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Sat, May 24, 2008 at 3:39 AM, Bulat Ziganshin
Hello Olivier,
Saturday, May 24, 2008, 5:37:32 AM, you wrote:
(|>>) = flip (.)
I even started to use it in my code and then stopped. It may be a stupid concern but as many optimizations performed by GHC are made through rewrite rules and I was worried that those rules may not fire when using this new operator.
afaik ghc, |> would be rewritten to flip (.) which would be rewritten to application of first function to second one and so on. rewrite rules doesn't work only on your original code but on intermediate variations too
That's really good news.
Thanks Bulat, Olivier.
participants (2)
-
Bulat Ziganshin
-
Olivier Boudry