Re: [Haskell-cafe] Re: Lazy evaluation from Why Functional programming matters
Have you seen Potential (http://intoverflow.wordpress.com/2010/05/21/announcing-potential-x86-64-assembler-as-a-haskell-edsl/)? Quote: The language’s goal is to provide a solid foundation for the development of a useful (multi-tasked, multi-processor, etc) microkernel Which sounds like it's exactly what you want. Also, see Harpy (http://uebb.cs.tu-berlin.de/harpy/). Thank you very very much Neil for pointing me to Potential. I'll take a look at it. -- Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Lazy evaluation from Why Functional programming matters
On Tue, Oct 5, 2010 at 9:19 PM, steffen steffen.sier...@googlemail.com wrote: Don't be to disappointed. One can always kinda fake lazy evaluation using mutable cells. But not that elegantly. In the example given above, all being used is iterators as streams... this can also be expressed using lazy lists, true. But one big difference between e.g. lazy lists and iterators is, that lazy values are (operationally) replaced by their result wheres values generated from iterators and streams are not. For example one can use Iterators and chain them together in Java, to achieve more or less the same space and runtime-efficiency found by Stream-fusion in haskell (the Java JIT can abstract loads away, once the iterators are build together). But If you need to access the iterator's values more then once, you have to either force the full iterator into a list or rerun/reevaluate the iterator every time you need a value. Lazy lists are nice, but haskell's laziness is not about lazy lists only. For example lazy evaluation also matters when creating elegant Embedded DSLs... have you ever tried to build a more complex EDSL without laziness and macros? Thanks Ertugrul for the nice primes example. Steffen, Thanks for the explanation. Is there some literature around other lazy entities from the imperative side. I'm currently trying to get my Makefile EDSL to work - not sure, if that could turn complex. My ultimate aim it to write an EDSL for x86 - as in, describe a micro-kernel in haskell, compiling and running which would generate C code ( not sure if it's even possible - but I am really hopeful). Could you send me a sample on how I could use the reader monad for my Makefile EDSL. Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Lazy evaluation from Why Functional programming matters
On 06/10/10 11:00, C K Kashyap wrote: My ultimate aim it to write an EDSL for x86 - as in, describe a micro-kernel in haskell, compiling and running which would generate C code ( not sure if it's even possible - but I am really hopeful). Have you seen Potential (http://intoverflow.wordpress.com/2010/05/21/announcing-potential-x86-64-assembler-as-a-haskell-edsl/)? Quote: The language’s goal is to provide a solid foundation for the development of a useful (multi-tasked, multi-processor, etc) microkernel Which sounds like it's exactly what you want. Also, see Harpy (http://uebb.cs.tu-berlin.de/harpy/). Thanks, Neil. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Lazy evaluation from Why Functional programming matters
C K Kashyap ckkash...@gmail.com wrote: Yes. It would slightly easier in, say, C# or C++. I think 'D' achieves its implementation of the 'lazy' keyword using a similar approach. But I did not understand why you are disappointed ? The disappointment was not on a serious note ... the thing is, I constantly run into discussions about why fp with my colleagues - in a few of such discussions, I had mentioned that Haskell is the only well known language with lazy evaluation (IIRC, I read it somewhere or heard it in one of the videos) And I had built up this impression that laziness distinguished Haskell by a huge margin ... but it seems that is not the case. Hence the disappointment. Don't be disappointed. There are some things, which are extremely elegant to express with laziness: isPrime :: Integral a = a - Bool isPrime n = all (\x - mod n x /= 0) . takeWhile (\x - x*x = n) $ primes primes :: Integral a = [a] primes = 2 : filter isPrime [3..] These two definitions use each other in a way, which is very difficult to express without lazy evaluation. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife = sex) http://ertes.de/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Lazy evaluation from Why Functional programming matters
Don't be to disappointed. One can always kinda fake lazy evaluation using mutable cells. But not that elegantly. In the example given above, all being used is iterators as streams... this can also be expressed using lazy lists, true. But one big difference between e.g. lazy lists and iterators is, that lazy values are (operationally) replaced by their result wheres values generated from iterators and streams are not. For example one can use Iterators and chain them together in Java, to achieve more or less the same space and runtime-efficiency found by Stream-fusion in haskell (the Java JIT can abstract loads away, once the iterators are build together). But If you need to access the iterator's values more then once, you have to either force the full iterator into a list or rerun/reevaluate the iterator every time you need a value. Lazy lists are nice, but haskell's laziness is not about lazy lists only. For example lazy evaluation also matters when creating elegant Embedded DSLs... have you ever tried to build a more complex EDSL without laziness and macros? On 5 Okt., 16:52, C K Kashyap ckkash...@gmail.com wrote: Yes. It would slightly easier in, say, C# or C++. I think 'D' achieves its implementation of the 'lazy' keyword using a similar approach. But I did not understand why you are disappointed ? The disappointment was not on a serious note ... the thing is, I constantly run into discussions about why fp with my colleagues - in a few of such discussions, I had mentioned that Haskell is the only well known language with lazy evaluation (IIRC, I read it somewhere or heard it in one of the videos) And I had built up this impression that laziness distinguished Haskell by a huge margin ... but it seems that is not the case. Hence the disappointment. -- Regards, Kashyap ___ Haskell-Cafe mailing list haskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe