[Haskell-cafe] Detecting numeric overflows

2012-07-29 Thread Евгений Пермяков
Can someone tell me if there are any primitives, that used to detect machine type overflows, in ghc haskell ? I perfectly understand, that I can build something based on preconditioning of variables, but this will kill any performance, if needed. ___

Re: [Haskell-cafe] Reddy on Referential Transparency

2012-07-29 Thread wren ng thornton
On 7/27/12 1:49 PM, Ross Paterson wrote: So a language is referentially transparent if replacing a sub-term with another with the same denotation doesn't change the overall meaning? But then isn't any language RT with a sufficiently cunning denotational semantics? Or even a dumb one that gives e

Re: [Haskell-cafe] Is (==) commutative?

2012-07-29 Thread wren ng thornton
On 7/24/12 9:19 PM, Christian Sternagel wrote: (x == y) = True ==> x = y (x == y) = False ==> not (x = y) (x == _|_) = _|_ (_|_ == y) = _|_ Those axioms state that (==) is sound w.r.t. to meta-equality and strict in both it's arguments. An immediate problem that arises here is: what exactly do

Re: [Haskell-cafe] Is (==) commutative?

2012-07-29 Thread wren ng thornton
On 7/24/12 9:19 PM, Christian Sternagel wrote: Dear all, Thanks for your replies. Just to clarify: I am fully aware that inside Haskell there is no guarantee that certain (intended) requirements on type class instances are satisfied. I was asking whether the intention for Eq is that (==) is comm

Re: [Haskell-cafe] Logging pure code

2012-07-29 Thread Thomas Schilling
On 27 July 2012 14:52, Marco Túlio Gontijo e Silva wrote: > thread blocked indefinitely in an MVar operation IIRC, that means that a thread is blocked on an MVar and the MVar is only reachable by that thread. You said you tried adding NOINLINE, which is usually required for unsafePerformIO. Did

Re: [Haskell-cafe] Capturing the parent element as I parse XML using parsec

2012-07-29 Thread Richard O'Keefe
On 29/07/2012, at 6:21 PM, C K Kashyap wrote: > I am struggling with an idea though - How can I capture the parent element of > each element as I parse? Is it possible or would I have to do a second pass > to do the fixup? Why do you *want* the parent element of each element? One of the insanel

Re: [Haskell-cafe] Logging pure code

2012-07-29 Thread Marco Túlio Gontijo e Silva
Hi Joey. Thanks for your answer. On Sun, Jul 29, 2012 at 3:16 PM, Joey Adams wrote: > On Fri, Jul 27, 2012 at 9:52 AM, Marco Túlio Gontijo e Silva > wrote: >> I thought that the only thing I needed to take care while using >> unsafePerformIO was knowing that the time of execution is undetermine

Re: [Haskell-cafe] Current state of garbage collection in Haskell

2012-07-29 Thread Thomas Schilling
GHC does not provide any form of real-time guarantees (and support for them is not planned). That said, it's not as bad as it sounds: - Collecting the first (young) generation is fast and you can control the size of that first generation via runtime system (RTS) options. - The older generation

Re: [Haskell-cafe] Logging pure code

2012-07-29 Thread Joey Adams
On Fri, Jul 27, 2012 at 9:52 AM, Marco Túlio Gontijo e Silva wrote: > I thought that the only thing I needed to take care while using > unsafePerformIO was knowing that the time of execution is undetermined > and that it could even run more than once. This is not a problem for > my logging. Is t

[Haskell-cafe] GHC rendering of non-ASCII characters configurable?

2012-07-29 Thread Richard Cobbe
I'm working on an application that involves processing a lot of Unicode data, and I'm finding the built-in Show implementation for Char to be really inconvenient. Specifically, it renders all characters at U+0080 and above with decimal escapes: Prelude> '\x80' '\128' This is annoying bec

Re: [Haskell-cafe] Capturing the parent element as I parse XML using parsec

2012-07-29 Thread Antoine Latter
On Sun, Jul 29, 2012 at 1:21 AM, C K Kashyap wrote: > Hi, > > With the help of the cafe I've been able to write up the xml parser using > parsec - > https://github.com/ckkashyap/really-simple-xml-parser/blob/master/RSXP.hs > > I am struggling with an idea though - How can I capture the parent elem

Re: [Haskell-cafe] Current state of garbage collection in Haskell

2012-07-29 Thread Alexander Solla
On Sun, Jul 29, 2012 at 12:52 AM, C K Kashyap wrote: > Hi, > I was looking at a video that talks about GC pauses. That got me curious > about the current state of GC in Haskell - say ghc 7.4.1. > Would it suffer from lengthy pauses when we talk about memory in the range > of 500M +? > What would

Re: [Haskell-cafe] How to define a Monad instance

2012-07-29 Thread Johan Holmquist
As for understanding monads, you can try to define the State monad [1]. Not sure if it's the best example but it's intuitive in that it let's you thread a state "behind the scenes". *** Not related to your question -- in your example if you want to translate characters but do not plan to change t

[Haskell-cafe] Munich Haskell Meeting

2012-07-29 Thread Heinrich Hördegen
Dear all, next Tuesday, 31st of July, at 19h30, Munich's functional programming enthusiasts will meet at Max-Emanuell-Brauerei. If the weather is fine, we will sit outside. If you plan to join, please go to: http://www.haskell-munich.de/dates and click the button. Heinrich

[Haskell-cafe] Explaining instance declarations

2012-07-29 Thread Patrick Browne
{- I am trying to understand and provide a *simplified* explanation of instance contexts and their relationship with class hierarchies. I use the example from [1]. Are the following two sentences and annotated code a reasonable explanation? " When instantiating an instance I of C, its context must

[Haskell-cafe] Current state of garbage collection in Haskell

2012-07-29 Thread C K Kashyap
Hi, I was looking at a video that talks about GC pauses. That got me curious about the current state of GC in Haskell - say ghc 7.4.1. Would it suffer from lengthy pauses when we talk about memory in the range of 500M +? What would be a good way to keep abreast with the progress on haskell GC? Rega