[Haskell-cafe] Re: Useful: putCharLn {inspire by the Int->[Char] thread
John, Thanks very much for that bit of insight. I am not really writing anything right now that is in more hurry than what Haskell can handle nicely. I was feeling a bit guilty as, Shao said, I use $ over (.) and thought that my code could get some amount of ridicule as to style... when it gets a look by guru types.. Now I can just say, "Hey, it is just my style!".. I have written things that involved lists, where it was building and rebuilding lists of some length that took lots of time.. but that had nothing to do, as you had said with the syntax I chose to use. it would seem that the big ones are things like ordering placements to take advantage of tail recursion and such are more the issue.. and using more efficient data structures than a "straight" list when appropriate. Since you know this sort of thing... Point Free, does that end up being the exact same code after the compiler gets done with it.. I assume it must, but ... ?? Does it cause the compiler less or more work to get to that resultant code.. hmmm thanks, gene ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Useful: putCharLn {inspire by the Int->[Char] thread
On Mon, Aug 21, 2006 at 04:31:42PM -0700, Gene A wrote: > hi, > Now, is there a speed or "cleaness of code" advantage to using the > function composition method using (.) : > putStrLn . return . head $ "This and that" > over the application method...using ($): > putStrLn $ return $ head "this and that" > > some thoughts on that ... they both work.. but any advantage or disadvantage > to one over the other.. I find a lot of these kind of things in > Haskell, and it is purely wonderful.. but always go away wondering if > I am really using the most efficient, or most acceptable method.. > gene There is no difference with any good compiler. (.) is always inlined and the types are fixed by the 'putStrLn' so all the overloaded will be gotten rid of. You can pretty much write code in whatever style you want in haskell and count on the compiler to optimize it to be as efficient as possible. The things the compiler can't optimize are usually general inefficient algorithms, not matters of style. There is no need to second guess the compiler for the most part. And certainly not until after you have done profiling or looked at the core and actually seen there is an issue. John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Useful: putCharLn {inspire by the Int->[Char] thread
hi, Now, is there a speed or "cleaness of code" advantage to using the function composition method using (.) : putStrLn . return . head $ "This and that" over the application method...using ($): putStrLn $ return $ head "this and that" some thoughts on that ... they both work.. but any advantage or disadvantage to one over the other.. I find a lot of these kind of things in Haskell, and it is purely wonderful.. but always go away wondering if I am really using the most efficient, or most acceptable method.. gene ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Useful: putCharLn {inspire by the Int->[Char] thread
yumagene: > On 8/19/06, Henk-Jan van Tuyl <[EMAIL PROTECTED]> wrote: > > >Or you could use: > > putStrLn [head "This and that"] > > > Gotta say I really like this ... running the head function inside of the > list... > Okay so I can really learn something here... what would that look like > in "raw" monadic notation? > using bind and such notation... >>= etc.. > hey, mention was made of lists being monads.. so Perhaps: putStrLn . return . head $ "This and that" -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Useful: putCharLn {inspire by the Int->[Char] thread
On 8/19/06, Henk-Jan van Tuyl <[EMAIL PROTECTED]> wrote: Or you could use: putStrLn [head "This and that"] Gotta say I really like this ... running the head function inside of the list... Okay so I can really learn something here... what would that look like in "raw" monadic notation? using bind and such notation... >>= etc.. hey, mention was made of lists being monads.. so gene ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe