Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Gregg Reynolds
On Sun, Feb 8, 2009 at 6:39 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: is a good one. If you want to say that a mathematical value with a non-mathematical effect is nonsensical, more power to you. I said I don't want to get far into White Knight territory. As long as you can agree A

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Tony Morris
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gregg Reynolds wrote: The point being that the metalanguage commonly used to describe IO in Haskell contains a logical contradiction. A thing cannot be both a value and a function, but e,g, getChar behaves like a function and has the type

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
Not it doesn't. getChar has the type signature IO Char. The IO type is abstract. GHC happens to implement it by a state monad. But in, e.g., hbc it is implemented in a totally different way, more like a continuation monad. Peeking inside an implementation of IO can be illuminating, but one must

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Tony Morris
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You're right - my statement is inaccurate. Implementation details aside, I am referring specifically to the statement getChar ... has the type signature of a value. It clearly does not. Lennart Augustsson wrote: Not it doesn't. getChar has the

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
But an (IO Char) is a value. You can do all the things with it that you can do with values, e.g., pass it as an argument, stick it in a list, etc. It is a special kind of value, since if it ever gets in contact with the top level it will be executed. But the fact that IO types also behave as

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Tony Morris
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I also agree it is a value. The original post was attempting to make a distinction that does not exist. I deliberately avoided that topic. A thing cannot be both a value and a function, but e,g, getChar My original intent was to hope the poster

[Haskell-cafe] Re: Switching from Mercurial to Darcs

2009-02-09 Thread Paolo Losi
Thomas Davie wrote: On 6 Feb 2009, at 10:12, Paolo Losi wrote: Henning Thielemann wrote: 4) hg commit -m message this commits my changes locally. I always do this before pulling since then I'm sure my changes are saved in the case a merge goes wrong. In old darcs its precisely the other

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
Sorry, I should have come down on the original poster too. ;) Functions are values, after all. On Mon, Feb 9, 2009 at 10:38 AM, Tony Morris tmor...@tmorris.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I also agree it is a value. The original post was attempting to make a

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Gregg Reynolds
On Mon, Feb 9, 2009 at 4:38 AM, Tony Morris tmor...@tmorris.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I also agree it is a value. The original post was attempting to make a distinction that does not exist. I deliberately avoided that topic. A thing cannot be both a value

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
Huh? The getChar function does yield a value of type (IO Char), exactly as the type signature says. If you want access to the Char you must use a =, just like in any other monad. 2009/2/9 Gregg Reynolds d...@mobileink.com: On Mon, Feb 9, 2009 at 4:38 AM, Tony Morris tmor...@tmorris.net wrote:

RE: [Haskell-cafe] Monad explanation

2009-02-09 Thread Sittampalam, Ganesh
My bad, I restate: a value cannot be both static and dynamic. Or an object and a morphism. Or an element and a function. Sure, you can treat a morphism as an object, but only by moving to a higher (or different) level of abstraction. That doesn't erase the difference between object and

[Haskell-cafe] Efficient string output

2009-02-09 Thread Ketil Malde
Hi, I'm currently working on a program that parses a large binary file and produces various textual outputs extracted from it. Simple enough. But: since we're talking large amounts of data, I'd like to have reasonable performance. Reading the binary file is very efficient thanks to

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Johan Tibell
On Mon, Feb 9, 2009 at 12:49 PM, Ketil Malde ke...@malde.org wrote: Reading the binary file is very efficient thanks to Data.Binary. However, output is a different matter. Currently, my code looks something like: summarize :: Foo - ByteString summarize f = let f1 = accessor f

Re: [Haskell-cafe] Haddock Markup

2009-02-09 Thread Wolfgang Jeltsch
Am Samstag, 7. Februar 2009 13:46 schrieb Khudyakov Alexey: On Friday 06 February 2009 21:24:35 Andy Smith wrote: 2009/2/6 Wolfgang Jeltsch g9ks1...@acme.softbase.org: So using TeX as a general language for math is a very bad idea, in my opinion. The problem is that there is no good

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Bulat Ziganshin
Hello Ketil, Monday, February 9, 2009, 2:49:05 PM, you wrote: in B.concat [f1,pack \t,pack (show f2),...] inelegance were it only fast - but this ends up taking the better part of the execution time. i'm not a BS expert but it seems that you produce Strings using show

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Ketil Malde
Johan Tibell johan.tib...@gmail.com writes: Is building the strict ByteString what takes the most time? Yes. If so, you might want to use `writev` to avoid extra copying. Is there a Haskell binding somewhere, or do I need to FFI the system call? Googling 'writev haskell' didn't turn up

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Gregg Reynolds
On Sun, Feb 8, 2009 at 6:25 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 6 Feb 2009, at 4:20 am, Gregg Reynolds wrote: However, consider: getChar = \x - getChar An optimizer can see that the result of the first getChar is discarded and replace the entire expression with one

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Eugene Kirpichov
+1; it's obviously the packing that causes sloth. Memoize the pack \t etc. stuff , and write bytestring replacements for show for your data. I guess you can use the Put monad instead of B.concat for that, by the way. 2009/2/9 Bulat Ziganshin bulat.zigans...@gmail.com: Hello Ketil, Monday,

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Duncan Coutts
On Mon, 2009-02-09 at 12:49 +0100, Ketil Malde wrote: Hi, I'm currently working on a program that parses a large binary file and produces various textual outputs extracted from it. Simple enough. But: since we're talking large amounts of data, I'd like to have reasonable performance.

[Haskell-cafe] threadDelay

2009-02-09 Thread Immanuel Litzroth
Am I correct in assuming this program should run 100 secs? import Control.Concurrent main = do threadDelay 10 Why do I get the folling result then? ghc -threaded Main.hs -o delay time ./delay real0m0.104s user0m0.001s sys0m0.002s Thanks in advance for all your wonderful

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Ketil Malde
Bulat Ziganshin bulat.zigans...@gmail.com writes: in B.concat [f1,pack \t,pack (show f2),...] i'm not a BS expert but it seems that you produce Strings using show and then convert them to BS. of course this is inefficient - you need to replace show with BS analog Do

Re: [Haskell-cafe] threadDelay

2009-02-09 Thread Svein Ove Aas
2009/2/9 Immanuel Litzroth immanuel...@gmail.com: Am I correct in assuming this program should run 100 secs? No, you're off by a factor of a thousand. It's based on microseconds, not milliseconds. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] threadDelay

2009-02-09 Thread Bulat Ziganshin
Hello Immanuel, Monday, February 9, 2009, 3:42:24 PM, you wrote: Am I correct in assuming this program should run 100 secs? real    0m0.104s may be, 100 msecs? :) -- | Suspends the current thread for a given number of microseconds -- (GHC only). -- Best regards, Bulat

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Gregg Reynolds
On Mon, Feb 9, 2009 at 5:32 AM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: My bad, I restate: a value cannot be both static and dynamic. Or an object and a morphism. Or an element and a function. Sure, you can treat a morphism as an object, but only by moving to a

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Johan Tibell
On Mon, Feb 9, 2009 at 1:22 PM, Ketil Malde ke...@malde.org wrote: Johan Tibell johan.tib...@gmail.com writes: If so, you might want to use `writev` to avoid extra copying. Is there a Haskell binding somewhere, or do I need to FFI the system call? Googling 'writev haskell' didn't turn up

Re: [Haskell-cafe] The Haskell re-branding exercise

2009-02-09 Thread Richard Kelsall
Don Stewart wrote: Help identifying and implementing a voting process is very welcome. Maybe we could have an administrator who receives the votes by email and we confirm our emailed vote by appending the MD5 of our email to a Haskell wiki page. The machine-readable email format might be: I

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Lennart Augustsson
Just to clarify a little. If you implement the IO monad in a sane way (as some kind of state monad or continuation monad) then the compiler can optimize e=f even for the IO monad. The implementation of = will ensure the sequencing of effects in e before effects in f. The IO monad is less magic

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Gregg Reynolds
On Mon, Feb 9, 2009 at 7:17 AM, Lennart Augustsson lenn...@augustsson.netwrote: Just to clarify a little. If you implement the IO monad in a sane way (as some kind of state monad or continuation monad) then the compiler can optimize e=f even for the IO monad. The implementation of = will

[Haskell-cafe] Re: The Haskell re-branding exercise

2009-02-09 Thread Simon Marlow
Sterling Clover wrote: IP based limitations are a terrible idea. Multiple users can be and often are behind the same IP if they're in some sort of intranet, be it corporate, academic, or simply multiple home computers. Mail-based authentication can be screwed with, sure, but it's also very

[Haskell-cafe] Re: Does readFile /proc/mounts hang for you?

2009-02-09 Thread Simon Marlow
David Fox wrote: On Wed, Jan 21, 2009 at 9:20 AM, David Fox dds...@gmail.com mailto:dds...@gmail.com wrote: I posted a bug about this (http://hackage.haskell.org/trac/ghc/ticket/2971) but its so odd I had to ask here. Using ghc 6.10.1, both readFile /proc/mounts and

[Haskell-cafe] lazy evaluation is not complete

2009-02-09 Thread Peter Padawitz
A simplied version of Example 5-16 in Manna's classical book Mathematical Theory of Computation: foo x = if x == 0 then 0 else foo (x-1)*foo (x+1) If run with ghci, foo 5 does not terminate, i.e., Haskell does not look for all outermost redices in parallel. Why? For efficiency reasons? It's

Re: [Haskell-cafe] Haddock Markup

2009-02-09 Thread Henning Thielemann
Wolfgang Jeltsch wrote: TeX is not so great for mathematics and especially not for conversion into MathML (which would be needed for HTML output). The TeX math language provides rather little semantic information. As input language for the concrete software named TeX this is mostly okay since

Re: [Haskell-cafe] Haddock Markup

2009-02-09 Thread Henning Thielemann
Khudyakov Alexey wrote: I think MathML is much less accessible than images. Yes, there are problems with them but any browser is able to display them save for text based ones. MathML on contrary doesn't have much support. According to wikipedia only recent versions of gecko based browsers and

[Haskell-cafe] Looking for pointfree version

2009-02-09 Thread Edsko de Vries
Hi, Is there a nice way to write down :: Focus - [Focus] down p = concat [downPar p, downNew p, downTrans p] in point-free style? (In doesn't make much difference what these functions do; if it helps, their types are downPar, downNew, downTrans :: Focus - [Focus]). Ideally, I would like

Re: [Haskell-cafe] Re: The Haskell re-branding exercise

2009-02-09 Thread Richard Kelsall
Simon Marlow wrote: I suggest we do voting by email, and restrict voting to those who have ever posted on haskell-cafe before 1 Jan 2009. We could then have an auto-confirmation scheme similar to mailing list sign-up where the confirmation message is sent back to the originator to confirm

Re: [Haskell-cafe] lazy evaluation is not complete

2009-02-09 Thread Bulat Ziganshin
Hello Peter, Monday, February 9, 2009, 5:10:22 PM, you wrote: If run with ghci, foo 5 does not terminate, i.e., Haskell does not look for all outermost redices in parallel. Why? For efficiency reasons? of course. if you will create new thread for every cpu instruction executed, you will

Re: [Haskell-cafe] lazy evaluation is not complete

2009-02-09 Thread Robin Green
On Mon, 09 Feb 2009 15:10:22 +0100 Peter Padawitz peter.padaw...@udo.edu wrote: A simplied version of Example 5-16 in Manna's classical book Mathematical Theory of Computation: foo x = if x == 0 then 0 else foo (x-1)*foo (x+1) If run with ghci, foo 5 does not terminate, i.e., Haskell

[Haskell-cafe] FFI binding to CGAL?

2009-02-09 Thread Peter Verswyvelen
I was wandering of someone already made a FFI binding to http://www.cgal.org or something similar that does computational geometry? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Looking for pointfree version

2009-02-09 Thread Robin Green
On Mon, 9 Feb 2009 14:18:18 + Edsko de Vries devri...@cs.tcd.ie wrote: Hi, Is there a nice way to write down :: Focus - [Focus] down p = concat [downPar p, downNew p, downTrans p] in point-free style? I think this should work: down = concat . swing map [downPar, downNew,

Re: [Haskell-cafe] Looking for pointfree version

2009-02-09 Thread Wouter Swierstra
snip How about using Data.Monoid: down = downPar `mappend` downNew `mappend` downTrans Wouter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Looking for pointfree version

2009-02-09 Thread Aai
Rewriting it to: concatMap ($ p)[downPar , downNew , downTrans ] gives: ($ p) = [downPar, downNew, downTrans] didn't check though! =@@i Edsko de Vries schreef: Hi, Is there a nice way to write down :: Focus - [Focus] down p = concat [downPar p, downNew p, downTrans p] in point-free

Re: [Haskell-cafe] FFI binding to CGAL?

2009-02-09 Thread minh thu
2009/2/9 Peter Verswyvelen bugf...@gmail.com: I was wandering of someone already made a FFI binding to http://www.cgal.org or something similar that does computational geometry? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Haddock Markup

2009-02-09 Thread Duncan Coutts
On Mon, 2009-02-09 at 15:18 +0100, Henning Thielemann wrote: Khudyakov Alexey wrote: I think MathML is much less accessible than images. Yes, there are problems with them but any browser is able to display them save for text based ones. MathML on contrary doesn't have much support.

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Ketil Malde
Duncan Coutts duncan.cou...@worc.ox.ac.uk writes: Have you considered using Data.Binary to output the data too? It has a pretty efficient underlying monoid for accumulating output data in a buffer. You'd want some wrapper functions over the top to make it a bit nicer for your use case, but it

Re: [Haskell-cafe] Looking for pointfree version

2009-02-09 Thread Edsko de Vries
Perfect! Beautiful. I was hoping there'd be a simple solution like that. Thanks! On 9 Feb 2009, at 14:31, Wouter Swierstra wrote: snip How about using Data.Monoid: down = downPar `mappend` downNew `mappend` downTrans Wouter ___ Haskell-Cafe

Re: [Haskell-cafe] Haddock Markup

2009-02-09 Thread drblanco
Wolfgang Jeltsch-2 wrote: This is only true if your destination format is PDF, DVI or PS. For a webpage, you’ll need MathML in the end and TeX is not so good in producing MathML, I suppose. Has jsMath been considered as an alternative to images in HTML?

Re: [Haskell-cafe] lazy evaluation is not complete

2009-02-09 Thread Jochem Berndsen
Peter Padawitz wrote: A simplied version of Example 5-16 in Manna's classical book Mathematical Theory of Computation: foo x = if x == 0 then 0 else foo (x-1)*foo (x+1) If run with ghci, foo 5 does not terminate, i.e., Haskell does not look for all outermost redices in parallel. Why? For

[Haskell-cafe] Re: Haskell and Automation

2009-02-09 Thread Michael Snoyman
Gunther, Thanks for the heads-up. I might need to interface with Excel in the future. Michael On Sat, Feb 7, 2009 at 8:14 PM, GŸuenther Schmidt red...@fedoms.com wrote: Dear Michael, sorry too, for not telling you sooner that meanwhile I found out how to get it working, I hope you did not

[Haskell-cafe] Haskell and Java interaction

2009-02-09 Thread Silviu ANDRICA
Hello, I was wondering if there is a way to call Haskell code from Java. I tried using jvm-bridge(http://sourceforge.net/projects/jvm-bridge/), but I'm stuck on building it. Thank you very much, Silviu ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Haskell and Java interaction

2009-02-09 Thread C.M.Brown
Hi Silviu, There's the GCJNI: http://www.haskell.org/gcjni/ Which is basically a greencard-ed JNI interface for Haskell. I'm not sure it's still suported but may be worth a shot. Regards, Chris. On Mon, 9 Feb 2009, Silviu ANDRICA wrote: Hello, I was wondering if there is a way to call

[Haskell-cafe] Formal semantics for Haskell?

2009-02-09 Thread Gregg Reynolds
ML has a formal definition[1]; why not Haskell? Would this be a Good Thing, or a Waste Of Time? The Report strikes me as a hybrid of formal and informal. I guess that's not a problem so far, but there aren't that many implementations; if we had dozens, how could we verify conformance? A formal

Re: [Haskell-cafe] Re: Data.Map: Enumerating ordered subset of keys

2009-02-09 Thread Jared Updike
I had a similar thought. That will probably do the trick. Jared. On 2/8/09, Svein Ove Aas svein@aas.no wrote: On Mon, Feb 9, 2009 at 8:02 AM, Jared Updike jupd...@gmail.com wrote: It looks like two Map.splits will do what I need except for allowing more exact testing of = vs.

Re: [Haskell-cafe] Re: Data.Map: Enumerating ordered subset of keys

2009-02-09 Thread Jared Updike
On 2/8/09, Anish Muttreja anishmuttr...@gmail.com wrote: Maybe you wantData.Map.partition (\key - key = key1 key = key2) map This will return what I want, but partition is O(n) and touches all the keys, so if I had a million keys and only 2 of them matched the key1..key2 range, it would still

Re: [Haskell-cafe] Data.Map: Enumerating ordered subset of keys

2009-02-09 Thread Jared Updike
On 2/8/09, Evan Laforge qdun...@gmail.com wrote: I have a little util library with various map functions. 'within' is almost what you want, except it's half-open. You can make an inclusive one by pulling the lowest element off the above map. I'm also curious if there's a better way to do

Re: [Haskell-cafe] Error in building profiling

2009-02-09 Thread Marco Túlio Gontijo e Silva
Em Sex, 2009-02-06 às 22:55 +, Duncan Coutts escreveu: On Fri, 2009-02-06 at 08:28 -0200, Marco Túlio Gontijo e Silva wrote: $ ./setup configure --enable-library-profiling --disable-library-vanilla /usr/bin/ld: dist/build/Control/Monad/Cont.o: No such file: No such file or

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Tillmann Rendel
Gregg Reynolds wrote:: My original question was motivated by the observation that a human reader of an expression of the form e = f , on seeing that f is constant, may pull the constant value out of f, disregard e and dispense with the application f e. While a human reader may well do that,

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread David Menendez
2009/2/9 Gregg Reynolds d...@mobileink.com: On Sun, Feb 8, 2009 at 6:25 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 6 Feb 2009, at 4:20 am, Gregg Reynolds wrote: However, consider: getChar = \x - getChar An optimizer can see that the result of the first getChar is discarded and

Re: [Haskell-cafe] Haddock Markup

2009-02-09 Thread Wolfgang Jeltsch
Am Montag, 9. Februar 2009 15:10 schrieben Sie: I want for long to write math formulas in a paper in Haskell. Actually, lhs2TeX can do such transformations but it is quite limited in handling of parentheses and does not support more complicated transformations (transforming prefix notation in

Re: [Haskell-cafe] Formal semantics for Haskell?

2009-02-09 Thread Tim Newsham
ML has a formal definition[1]; why not Haskell? Would this be a Good Thing, or a Waste Of Time? Not exactly what you are asking for, but a start: http://www.cs.kent.ac.uk/pubs/1992/123/index.html gregg Tim Newsham http://www.thenewsh.com/~newsham/

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread David Menendez
2009/2/9 Gregg Reynolds d...@mobileink.com: Right; implementation of IO means also an implementation for =, not just the IO operators. I hadn't thought about that but it's hugely important for the exposition of monads and IO. The IO Char indicates that getChar, when invoked, performs some

Re: [Haskell-cafe] Efficient string output

2009-02-09 Thread Don Stewart
ketil: Hi, I'm currently working on a program that parses a large binary file and produces various textual outputs extracted from it. Simple enough. But: since we're talking large amounts of data, I'd like to have reasonable performance. Reading the binary file is very efficient

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Tillmann Rendel
Hi Gregg, Gregg Reynolds wrote: Right; implementation of IO means also an implementation for =, not just the IO operators. I hadn't thought about that but it's hugely important for the exposition of monads and IO. Indeed, that's very important. Note that the topics monads in Haskell and IO

Re: [Haskell-cafe] Re: The Haskell re-branding exercise

2009-02-09 Thread Don Stewart
marlowsd: Sterling Clover wrote: IP based limitations are a terrible idea. Multiple users can be and often are behind the same IP if they're in some sort of intranet, be it corporate, academic, or simply multiple home computers. Mail-based authentication can be screwed with, sure, but

[Haskell-cafe] Control.Arrow being icky

2009-02-09 Thread Louis Wasserman
In GHCi, I import Control.Arrow, and Kliesli doesn't appear: Prelude Control.Arrow :t Kliesli interactive:1:0: Not in scope: data constructor `Kliesli' Prelude Control.Arrow :browse (^) :: (Arrow a) = a c d - (b - c) - a b d (^) :: (Arrow a) = a b c - (c - d) - a b d class

Re: [Haskell-cafe] Control.Arrow being icky

2009-02-09 Thread Andrew Wagner
It's spelled 'Kleisli'. You spelled it 'Kliesli' 2009/2/9 Louis Wasserman wasserman.lo...@gmail.com In GHCi, I import Control.Arrow, and Kliesli doesn't appear: Prelude Control.Arrow :t Kliesli interactive:1:0: Not in scope: data constructor `Kliesli' Prelude Control.Arrow :browse (^) ::

[Haskell-cafe] Re: Control.Arrow being icky

2009-02-09 Thread mail
Louis Wasserman wasserman.lo...@gmail.com writes: In GHCi, I import Control.Arrow, and Kliesli doesn't appear: Prelude Control.Arrow :t Kliesli interactive:1:0: Not in scope: data constructor `Kliesli' It's spelled `Kleisli' ___ Haskell-Cafe

Re: [Haskell-cafe] Formal semantics for Haskell?

2009-02-09 Thread gregg reynolds
Is that () or _|_? ;) Tim Newsham news...@lava.net wrote: null___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: how to use a literal string with bystring useAsCString

2009-02-09 Thread minh thu
2009/2/9 minh thu not...@gmail.com: Hi, I have a Haskell source file encoded in utf-8. Inside that source, I have literal strings that I'd like to pass to a C function. withCString does the job well until I tried to use the double-quote character . I get /usr/lib/ghc-6.10.1/ghc: `@: Bad

Re: [Haskell-cafe] Re: how to use a literal string with bystring useAsCString

2009-02-09 Thread Colin Adams
2009/2/9 minh thu not...@gmail.com: Anyway, I'd like to get my utf-8 string to C but in ascii (or latin1). How can do this ? You can't (in general). If the data just happens to be ascii, then your utf-8 string will BE ascii (there is no way to tell the difference). If it just happens to be

[Haskell-cafe] Re: Haddock Markup

2009-02-09 Thread Heinrich Apfelmus
Henning Thielemann wrote: I want for long to write math formulas in a paper in Haskell. Actually, lhs2TeX can do such transformations but it is quite limited in handling of parentheses and does not support more complicated transformations (transforming prefix notation in infix notation or

Re: [Haskell-cafe] Re: how to use a literal string with bystring useAsCString

2009-02-09 Thread minh thu
2009/2/9 Colin Adams colinpaulad...@googlemail.com: 2009/2/9 minh thu not...@gmail.com: Anyway, I'd like to get my utf-8 string to C but in ascii (or latin1). How can do this ? You can't (in general). If the data just happens to be ascii, then your utf-8 string will BE ascii (there is no

Re: [Haskell-cafe] Re: how to use a literal string with bystring useAsCString

2009-02-09 Thread minh thu
2009/2/9 minh thu not...@gmail.com: 2009/2/9 Colin Adams colinpaulad...@googlemail.com: 2009/2/9 minh thu not...@gmail.com: Anyway, I'd like to get my utf-8 string to C but in ascii (or latin1). How can do this ? You can't (in general). If the data just happens to be ascii, then your

[Haskell-cafe] Re: Haskell and Java interaction

2009-02-09 Thread John A. De Goes
The bridging projects are all dead and unsupported. You can still do it, but you'll have to write Haskell wrappers that use C types, then write C code that calls the wrapped Haskell code, then write JNI code to call the C code from Java.

[Haskell-cafe] Why does sleep not work?

2009-02-09 Thread John Ky
Hi Haskell Cafe, I wrote very short program to sleep for 5 seconds compiled with the -threaded option in ghc on the Mac OS X 1.5. I am finding that using the sleep function doesn't sleep at all, whereas using threadDelay does: main = do putStrLn Waiting for 5 seconds. threadDelay

Re: [Haskell-cafe] Formal semantics for Haskell?

2009-02-09 Thread Alberto G. Corona
Gregg,Too late for me, but, anyway. I support the idea of the warning 2009/2/9 gregg reynolds d...@mobileink.com Is that () or _|_? ;) Tim Newsham news...@lava.net wrote: null ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Why does sleep not work?

2009-02-09 Thread Bulat Ziganshin
Hello John, Tuesday, February 10, 2009, 12:35:25 AM, you wrote: I am finding that using the sleep function doesn't sleep at all, whereas using threadDelay does: Anybody know what's happening? 1) this depends on your sleep definition 2) read threadDelay docs -- Best regards, Bulat

Re: [Haskell-cafe] Haskell and Java interaction

2009-02-09 Thread Robert Greayer
I'm sure this isn't the solution you are looking for, but when I had to do something similar (integrate an Eclipse plugin to Haskell code) the simplest approach I found was to simply invoke the Haskell in a separate process, binding the stdin/stdout of the Haskell process to Java output/input

Re: [Haskell-cafe] Why does sleep not work?

2009-02-09 Thread Peter Verswyvelen
Hi John, Which sleep are you using? From which module? Can you show the full source with import statements? Cheers, Peter 2009/2/9 John Ky newho...@gmail.com Hi Haskell Cafe, I wrote very short program to sleep for 5 seconds compiled with the -threaded option in ghc on the Mac OS X 1.5. I

[Haskell-cafe] Painting logs to get a coloured tree

2009-02-09 Thread Joachim Breitner
Hi, I have a problem that, it seems, I can not solve cleanly without resorting to imperative programming (via ST): Assume you have a tree (and you can think of a real tree here), defined by something like this: data Tree a = Bud | Branch a Double Tree Tree -- | ` Lenght

Re: [Haskell-cafe] Why does sleep not work?

2009-02-09 Thread John Ky
Hi Peter, Source code: import System.IO import System.Posix main = do putStrLn Waiting for 5 seconds. sleep 5 -- doesn't sleep at all putStrLn Done. OS: Mac OS X 10.5 Compile command: ghc --threaded testsleep.hs If I remove --threaded, then it does sleep. Thanks, -John On

Re: [Haskell-cafe] Painting logs to get a coloured tree

2009-02-09 Thread Luke Palmer
2009/2/9 Joachim Breitner m...@joachim-breitner.de Now while this works, and while ST is still somewhat pure, I'm wondering if there is no better way of expressing This piece of information came from the point in a data structure, so something else can be put here easily. You might want to

[Haskell-cafe] Re: Monad explanation

2009-02-09 Thread Emilio Jesús Gallego Arias
Gregg Reynolds d...@mobileink.com writes: But it can't be a function, since it is non-deterministic. IMHO, if you assume IO a = World - (World, a), then getChar is indeed a function and deterministic. It is, there are not w :: World such that getChar w != getChar. The fact that World is too

[Haskell-cafe] Re: Monad explanation

2009-02-09 Thread Emilio Jesús Gallego Arias
egall...@babel.ls.fi.upm.es (Emilio Jesús Gallego Arias) writes: IMHO, if you assume IO a = World - (World, a), then getChar is indeed a function and deterministic. It is, there are not w :: World such that getChar w != getChar. Sorry I meant: There is not w :: World such that getChar w !=

[Haskell-cafe] Haskell Fest

2009-02-09 Thread Lyle Kopnicky
Looks like a lot of fun! http://www.haskellchamber.com/page6.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Richard O'Keefe
On 10 Feb 2009, at 12:24 am, Gregg Reynolds wrote: My bad, I restate: a value cannot be both static and dynamic. It's not clear what you mean here, but in what sense are static values not a subset of dynamic ones? Or an object and a morphism. Crack open any book on category theory and

Re: [Haskell-cafe] Haskell Fest

2009-02-09 Thread John Van Enk
Pie auction and contest? Count me in! /jve 2009/2/9 Lyle Kopnicky li...@qseep.net Looks like a lot of fun! http://www.haskellchamber.com/page6.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Haskell Fest

2009-02-09 Thread Andrew Wagner
We believe in Haskell! 2009/2/9 Lyle Kopnicky li...@qseep.net Looks like a lot of fun! http://www.haskellchamber.com/page6.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Haskell Fest

2009-02-09 Thread Derek Elkins
On Mon, 2009-02-09 at 16:54 -0800, Lyle Kopnicky wrote: Looks like a lot of fun! http://www.haskellchamber.com/page6.html I could readily go there. Maybe I could pick up a beauty at the pageant. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Richard O'Keefe
On 9 Feb 2009, at 9:56 pm, Gregg Reynolds wrote: Here's an analogy that will make the logical contradiction clear. Forget computers and assume you have been asked to referee a paper containing a proof with the following passage: Let x = ___ (Please fill in the blank) I think you will

Re: [Haskell-cafe] Haddock Markup

2009-02-09 Thread Richard O'Keefe
On 10 Feb 2009, at 1:19 am, Wolfgang Jeltsch wrote: This is only true if your destination format is PDF, DVI or PS. For a webpage, you’ll need MathML in the end and TeX is not so good in producing MathML, I suppose. Hmm. I find designed-for-HTML documentation horrible. In many ways the

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Richard O'Keefe
On 10 Feb 2009, at 1:35 am, Gregg Reynolds wrote: My original question was motivated by the observation that a human reader of an expression of the form e = f , on seeing that f is constant, may pull the constant value out of f, disregard e and dispense with the application f e. There

[Haskell-cafe] Re: Haskell Fest

2009-02-09 Thread Benjamin L . Russell
On Mon, 9 Feb 2009 16:54:15 -0800, Lyle Kopnicky li...@qseep.net wrote: Looks like a lot of fun! http://www.haskellchamber.com/page6.html They should extend this by adding the domain Virtualhaskellcounty (see http://whois.domaintools.com/virtualhaskellcounty.com) so we can all participate! --

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Gregg Reynolds
On Mon, Feb 9, 2009 at 11:06 AM, Tillmann Rendel ren...@cs.au.dk wrote: Gregg Reynolds wrote:: My original question was motivated by the observation that a human reader of an expression of the form e = f , on seeing that f is constant, may pull the constant value out of f, disregard e and

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Gregg Reynolds
On Mon, Feb 9, 2009 at 8:37 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: There isn't any application f e. Any human reader who does that is simply WRONG to do so. Sorry, should have written f* In your fragmentary example, monster computation may be discarded EVEN IF it contains IO

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Richard O'Keefe
On 10 Feb 2009, at 5:07 pm, Gregg Reynolds wrote: Thanks. I see the error of my ways. So, IO expressions must be evaluated if they are in the chain leading to main. We need some standard terminology to distinguish between *evaluating* an expression and *performing* the result of an

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread David Menendez
2009/2/9 Gregg Reynolds d...@mobileink.com: On Mon, Feb 9, 2009 at 11:06 AM, Tillmann Rendel ren...@cs.au.dk wrote: Gregg Reynolds wrote:: My original question was motivated by the observation that a human reader of an expression of the form e = f , on seeing that f is constant, may pull

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread wren ng thornton
Gregg Reynolds wrote: Tillmann Rendel wrote: An example where it would be wrong to ignore e: sum ([1, 2] = const [21]) This expression should evaluate to sum [21, 21] = 42, not sum [21] = 21. Sigh. I hate it when this happens. Just when I thought I had it figured out, it turns out I'm

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Bernie Pope
On 10/02/2009, at 4:45 AM, Tillmann Rendel wrote: A Haskell runtime system is a somewhat vaguely specified interpreter for (IO a) values. While it would be nice to a have a better specification of that interpreter, it is not part of the semantics of the language Haskell. While not

Re: [Haskell-cafe] lazy evaluation is not complete

2009-02-09 Thread Iavor Diatchki
Hi, Just for fun, here is the code that does this: newtype Int' = I Int deriving Eq instance Show Int' where show (I x) = show x instance Num Int' where I x + I y = I (x + y) I 0 * _ = I 0 I x * I y = I (x * y) I x - I y = I (x - y) abs (I x) = I (abs x)

Re: [Haskell-cafe] lazy evaluation is not complete

2009-02-09 Thread Max Rabkin
On Mon, Feb 9, 2009 at 10:50 PM, Iavor Diatchki iavor.diatc...@gmail.com wrote: I 0 * _ = I 0 I x * I y = I (x * y) Note that (*) is now non-commutative (w.r.t. _|_). Of course, that's what we need here, but it means that the obviously correct transformation of foo x = if x == 0

  1   2   >