Re: [Haskell-cafe] What are free Monads?

2010-03-02 Thread Sebastian Fischer
On Mar 2, 2010, at 5:59 AM, Dan Doel wrote: http://haskell.org/haskellwiki/Free_monad http://haskell.org/haskellwiki/Free_structure Nice, thank you for writing this. Feel free to make suggestions/changes. I enjoyed reading it although Section 3 is challenging for people (like me)

[Haskell-cafe] segmentation fault with ghc-6.10.4 on linux-x86_x64

2010-03-02 Thread Wim Vanderbauwhede
Hello, I'm writing a compiler and it segfaults when compiled with  ghc-6.10.4 on linux-x86_x64. It runs fine when compiled with ghc-6.10.4 on Mac OS X 10.5 (64-bit Intel) and with ghc-6.8.2 on Mac OS X 10.4 (32-bit PPC). I use the Haskell platform, the ghc -v output is Glasgow Haskell Compiler,

[Haskell-cafe] haskelldb problem

2010-03-02 Thread Immanuel Normann
Hi, I have problems with the usage of the DBSpec module. The following used to work a year ago: testDB :: DBInfo testDB = makeDBSpec testDB (DBOptions False) [t1] t1 :: TInfo t1 = makeTInfo t1 [c1,c2] c1 :: CInfo c1 = makeCInfo c1 (IntT,False) c2 :: CInfo c2 = makeCInfo c2 (StringT,False) Now

[Haskell-cafe] Gtk2hs on Snow Leopard: Failed to load interface for `System.Glib.UTFString'

2010-03-02 Thread Michael Goy
Hi, I am very close to suicide or similar acts of pure desperation... Since weeks, I am trying different approaches to get gtk2hs running on my Snow Leopard MacBook Pro... no success, you guess it... My current GHC is 6.10.4 (but I also tried 6.10.3 before) when I try to make GTK2HS from

Re: [Haskell-cafe] Has anybody translated Douglas Hofstadter's Scientific American articles introducting Scheme to a general audience into Haskell?

2010-03-02 Thread Gwern Branwen
On Tue, Mar 2, 2010 at 1:04 AM, Benjamin L. Russell dekudekup...@yahoo.com wrote: There is an interesting, if somewhat dated, suggestion on Lambda the Ultimate (see http://lambda-the-ultimate.org/node/1748) that someone translate Doug Hofstadter's Scientific American columns introducing Scheme

[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Simon Marlow
On 01/03/2010 00:04, Luke Palmer wrote: On Sun, Feb 28, 2010 at 2:06 AM, Pavel Perikovperi...@gmail.com wrote: Did you really seen 100ms pauses?! I never did extensive research on this but my numbers are rather in microseconds range (below 1ms). What causes such a long garbage collection?

[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Simon Marlow
On 01/03/2010 14:16, Sönke Hahn wrote: On Monday 01 March 2010 01:04:37 am Luke Palmer wrote: On Sun, Feb 28, 2010 at 2:06 AM, Pavel Perikovperi...@gmail.com wrote: Did you really seen 100ms pauses?! I never did extensive research on this but my numbers are rather in microseconds range (below

[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Simon Marlow
On 01/03/2010 14:53, Thomas Schilling wrote: On 28 February 2010 05:20, Luke Palmerlrpal...@gmail.com wrote: I have seen some proposals around here for SoC projects and other things to try to improve the latency of GHC's garbage collector. I'm currently developing a game in Haskell, and even

Re: [Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Malcolm Wallace
Both concurrent GC and incremental GC tend to add overheads to the mutator, because they need a read barrier. There was an incremental GC for GHC once [1], taking advantage of the built-in read barrier that we have whereby most closures are entered Was there a specific reason why that GC

[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Simon Marlow
On 01/03/2010 17:16, Sebastian Sylvan wrote: On Sun, Feb 28, 2010 at 5:20 AM, Luke Palmer lrpal...@gmail.com mailto:lrpal...@gmail.com wrote: I have seen some proposals around here for SoC projects and other things to try to improve the latency of GHC's garbage collector. I'm

[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Simon Marlow
On 02/03/2010 14:11, Malcolm Wallace wrote: Both concurrent GC and incremental GC tend to add overheads to the mutator, because they need a read barrier. There was an incremental GC for GHC once [1], taking advantage of the built-in read barrier that we have whereby most closures are entered

[Haskell-cafe] haskelldb problem

2010-03-02 Thread Immanuel Normann
Hi, I have problems with the usage of the DBSpec module. The following used to work a year ago: testDB :: DBInfo testDB = makeDBSpec testDB (DBOptions False) [t1] t1 :: TInfo t1 = makeTInfo t1 [c1,c2] c1 :: CInfo c1 = makeCInfo c1 (IntT,False) c2 :: CInfo c2 = makeCInfo c2 (StringT,False) Now

Re: [Haskell-cafe] references for compiler optimizations for functional languages

2010-03-02 Thread Andrew Coppin
Don Stewart wrote: mvanier42: Hi everyone, I'm interested in collecting good references for compiler optimizations for functional languages (lazy, strict, statically-typed or not). Any suggestions? There's lots for what GHC implements on SimonPJ's site:

[Haskell-cafe] How do you rewrite your code?

2010-03-02 Thread Sean Leather
There are numerous threads on the Haskell Café involving rewriting, refactoring, refining, and in general improving code (for some definition of improve). I am interested in seeing examples of how Haskell code can be rewritten to make it better. Some general examples are: - Eta-reduce -

[Haskell-cafe] Re: How do you rewrite your code?

2010-03-02 Thread Johannes Waldmann
Not exactly answering your question, but here's the top refactorings that I'd like to see in a Haskell IDE: * rename identifier (aware of scopes, modules, qualified imports etc.) * move definition from one module to another (aware of ...) * change type to newtype or data * change positional to

Re: [Haskell-cafe] How do you rewrite your code?

2010-03-02 Thread Alp Mestanogullari
For the style part, I recommend hlint [1]. Regarding the testing, QuickCheck is excellent and I have been happy with it so far. From a more general point of view, I agree with a point of view that many haskellers seem to share, but that Cale Gibbard put in words on #haskell regularly. It

[Haskell-cafe] Re: haskelldb problem

2010-03-02 Thread Christian Maeder
Documentation should be: http://hackage.haskell.org/packages/archive/haskelldb/0.12/doc/html/Database-HaskellDB-DBSpec.html http://hackage.haskell.org/packages/archive/haskelldb/0.12/doc/html/Database-HaskellDB-DBSpec-PPHelpers.html assuming you have the haskelldb-0.12 package installed. HTH

[Haskell-cafe] Re: Multiple Interpretations for a monad?

2010-03-02 Thread Heinrich Apfelmus
Ryan Ingram wrote: To take this a step further, there is the DSL: get :: m S put :: S - m () and the concrete implementation m = State S Of course, there are other monads which implement this DSL as well: m = StateT S IO m = Prompt StatePrompt with data StatePrompt

[Haskell-cafe] lhs2TeX \eval{} problem

2010-03-02 Thread Tom Lokhorst
Hello, I'm having a problem with lhs2Tex and \eval{}. It doesn't work. I have the following in a file test.lhs: %include polycode.fmt One %option ghci Two \eval{4} Three When I try to run this file through lhs2Tex, it crashes:

Re: [Haskell-cafe] How do you rewrite your code?

2010-03-02 Thread Felipe Lessa
On Tue, Mar 02, 2010 at 08:20:30PM +0100, Sean Leather wrote: There are numerous threads on the Haskell Café involving rewriting, refactoring, refining, and in general improving code (for some definition of improve). I am interested in seeing examples of how Haskell code can be rewritten to

[Haskell-cafe] Where is HEAD?

2010-03-02 Thread Louis Wasserman
Where is GHC 6.13 head? I can find sources of 6.13, and darcs for 6.12, but not darcs for 6.13...I'm trying to play with the LLVM backend, and this is the one question it seems to presuppose that you know the answer to. Heh. Louis Wasserman wasserman.lo...@gmail.com

Re: [Haskell-cafe] Where is HEAD?

2010-03-02 Thread Alp Mestanogullari
Download that tarball : http://darcs.haskell.org/ghc-HEAD-2009-10-23-ghc-corelibs-testsuite.tar.gz And then uncompress it, enter the directory, and execute : ./darcs-all pull -a (it may need you to chmod +x it) And then you will have ghc HEAD. On Tue, Mar 2, 2010 at 9:01 PM, Louis Wasserman

[Haskell-cafe] Re: lhs2TeX \eval{} problem

2010-03-02 Thread Andres Loeh
Hi. I'm having a problem with lhs2Tex and \eval{}. It doesn't work. I have the following in a file test.lhs: %include polycode.fmt One %option ghci Two \eval{4} Three When I try to run this file through lhs2Tex,

[Haskell-cafe] Monad laws

2010-03-02 Thread David Sabel
Hi, when checking the first monad law (left unit) for the IO-monad (and also for the ST monad): return a = f ≡ f a I figured out that there is the distinguishing context (seq [] True) which falsifies the law for a and f defined below let a = True let f = \x - (undefined::IO Bool) seq

Re: [Haskell-cafe] How do you rewrite your code?

2010-03-02 Thread Andrey Sisoyev
Speaking about macrorewriting, I do prefer to break big modules (prototypes) into smaller ones, then step by step separate them into a set of minimally dependent and highly general cabal packages. As for microrewriting I find it to be a good practice to explicate all possible (programmable or

Re: [Haskell-cafe] How do you rewrite your code?

2010-03-02 Thread Daniel Fischer
Am Dienstag 02 März 2010 21:00:56 schrieb Felipe Lessa: I think the right-hand side (RHS) is more concise and simpler. The types here do change: the type constructor has a Monad constraint in the left-hand side and a Functor constraint in the RHS. Types that are Monad instances are

[Haskell-cafe] Re: lhs2TeX \eval{} problem

2010-03-02 Thread Tom Lokhorst
First, it's %options ghci Oh, well that teaches me not to type myself... Copy-and-paste is way better! Now lhs2TeX no longer crashes, unfortunately it still doesn't work correctly. It now simply hangs after printing the line Two. It doesn't crash, or eat memory or cpu. It just sits there,

[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Luke Palmer
On Tue, Mar 2, 2010 at 7:17 AM, Simon Marlow marlo...@gmail.com wrote: For games, though, we have a very good point that occurs regularly where we know that all/most short-lived objects will no longer be referenced - at the start of a fresh frame. System.Mem.performGC is your friend, but if

Re: [Haskell-cafe] Monad laws

2010-03-02 Thread Luke Palmer
On Tue, Mar 2, 2010 at 1:17 PM, David Sabel sa...@ki.informatik.uni-frankfurt.de wrote: Hi, when checking the first monad law (left unit) for the IO-monad (and also for the ST monad): return a = f ≡ f a I figured out that there is the distinguishing context (seq [] True) which falsifies

Re: [Haskell-cafe] Re: lhs2TeX \eval{} problem

2010-03-02 Thread Andres Loeh
Oh, well that teaches me not to type myself... Copy-and-paste is way better! Now lhs2TeX no longer crashes, unfortunately it still doesn't work correctly. It now simply hangs after printing the line Two. It doesn't crash, or eat memory or cpu. It just sits there, doing nothing, until I

Re: [Haskell-cafe] Re: lhs2TeX \eval{} problem

2010-03-02 Thread Tom Lokhorst
Yes, this time I did copy/paste your code. ghci loads the file correctly and `x` is in scope. lhs2TeX just hangs on the \eval{4} line. On 2 March 2010 21:46, Andres Loeh and...@cs.uu.nl wrote: Oh, well that teaches me not to type myself... Copy-and-paste is way better! Now lhs2TeX no longer

[Haskell-cafe] FFI and lists?

2010-03-02 Thread Kimberly Wallmark
I'm working with FFI to make a Haskell DLL that's called by C# code. I understand how to share simple types. I've found reasonable documentation for struct-equivalents. Is there a clean way to share lists, or should I make a linked-list struct and do it manually? In other words, if I

[Haskell-cafe] minimal interface

2010-03-02 Thread Sean McLaughlin
Hello, I have a midsize program, and would like to simplify the module interfaces for my own sanity. I know there are tools to check for extraneous imports, but is there something similar for exports? For instance, if module A exports f, but A.f is never used in my compiled program, I would

Re: [Haskell-cafe] minimal interface

2010-03-02 Thread Don Stewart
seanmcl: Hello, I have a midsize program, and would like to simplify the module interfaces for my own sanity. I know there are tools to check for extraneous imports, but is there something similar for exports? For instance, if module A exports f, but A.f is never used in my compiled

[Haskell-cafe] A few ideas about FRP and arbitrary access in time

2010-03-02 Thread Phil Jones
...Are hereby presented at: http://www.ee.bgu.ac.il/~noamle/_downloads/gaccum.pdf Comments are more than welcome. (P.S Thanks to a whole bunch of people at #haskell for educating me about this, but most notably Conal Elliott) ___ Haskell-Cafe mailing

Fwd: [Haskell-cafe] minimal interface

2010-03-02 Thread Sean McLaughlin
Hi Don, This doesn't tell me what is extraneous in the exports. For instance If I have two modules A and Main module A (f, g) where f :: a - a f = id g :: a - a g = id module Main (main) where import qualified A main :: IO () main = do let a = A.f 7 putStrLn $ show a I'd like

[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-02 Thread Simon Marlow
On 02/03/10 20:37, Luke Palmer wrote: On Tue, Mar 2, 2010 at 7:17 AM, Simon Marlowmarlo...@gmail.com wrote: For games, though, we have a very good point that occurs regularly where we know that all/most short-lived objects will no longer be referenced - at the start of a fresh frame.

Re: [Haskell-cafe] minimal interface

2010-03-02 Thread Ivan Miljenovic
On 3 March 2010 08:25, Sean McLaughlin sean...@gmail.com wrote:  For instance, if module A exports f, but A.f is never used in my compiled program, I would like to be warned of this fact. My SourceGraph program ( http://hackage.haskell.org/package/SourceGraph ) does this, but you'll have to

Re: [Haskell-cafe] Monad laws

2010-03-02 Thread Andrés Sicard-Ramírez
On 2 March 2010 15:44, Luke Palmer lrpal...@gmail.com wrote: On Tue, Mar 2, 2010 at 1:17 PM, David Sabel sa...@ki.informatik.uni-frankfurt.de wrote: Hi, when checking the first monad law (left unit) for the IO-monad (and also for the ST monad): return a = f ≡ f a I figured out

Re: [Haskell-cafe] Monad laws

2010-03-02 Thread Yitzchak Gale
David Sabel wrote: when checking the first monad law (left unit) for the IO-monad (and also for the ST monad): I figured out that there is the distinguishing context (seq [] True) which falsifies the law... It's worse than that - Haskell types and functions do not even form a category under

Re: [Haskell-cafe] Real-time garbage collection for Haskell

2010-03-02 Thread Jason Dusek
2010/02/28 Neil Davies semanticphilosop...@googlemail.com: I've never observed ones that size. I have an application that runs in 'rate equivalent real-time' (i.e. there may be some jitter in the exact time of events but it does not accumulate). It does have some visibility of likely time of

Re: [Haskell-cafe] Monad laws

2010-03-02 Thread Luke Palmer
On Tue, Mar 2, 2010 at 4:37 PM, Yitzchak Gale g...@sefer.org wrote: For this reason, I consider it a bug in GHC that return :: IO a is lazy. Wait a minute... return undefined = const (return 42) = const (return 42) undefined = return 42 But if return undefined = undefined, then that

Re: [Haskell-cafe] Evolving Faster Haskell Programs (now with LLVM!)

2010-03-02 Thread Don Stewart
I hope to turn it all into a tool. vanenkj: What's the chance you have generational graphs for the rest of your examples like you do with the first? I'd be interested to see those. On Mon, Mar 1, 2010 at 3:02 AM, Don Stewart d...@galois.com wrote:

[Haskell-cafe] Re: FFI and lists?

2010-03-02 Thread Maciej Piechotka
On Tue, 2010-03-02 at 13:19 -0800, Kimberly Wallmark wrote: I'm working with FFI to make a Haskell DLL that's called by C# code. I understand how to share simple types. I've found reasonable documentation for struct-equivalents. Is there a clean way to share lists, or should I make a

[Haskell-cafe] Re: Monad laws

2010-03-02 Thread Maciej Piechotka
In GHC 6.12.1 both expressions reduce to True, but it doesn't happen in GHC 6.10.4. Any ideas why the behaviour is different? Maybe (I'm guessing) GHC 6.12.1 is smart enough to figure out that f a is not needed to evaluate True? In docs it was said that seq states that 'it may

[Haskell-cafe] Prelude.undefined

2010-03-02 Thread Tom Hawkins
How do I track down an reference to an undefined value? My program must not be using a library correctly because the program makes no direct use of 'undefined'. Running with +RTS -xc yields: GHC.Err.CAFTest: Prelude.undefined ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Prelude.undefined

2010-03-02 Thread Ivan Miljenovic
On 3 March 2010 16:06, Tom Hawkins tomahawk...@gmail.com wrote: How do I track down an reference to an undefined value?  My program must not be using a library correctly because the program makes no direct use of 'undefined'.  Running with +RTS -xc yields: GHC.Err.CAFTest: Prelude.undefined

Re: [Haskell-cafe] Prelude.undefined

2010-03-02 Thread Tom Hawkins
On Wed, Mar 3, 2010 at 6:11 AM, Tom Hawkins tomahawk...@gmail.com wrote: On Wed, Mar 3, 2010 at 6:07 AM, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: On 3 March 2010 16:06, Tom Hawkins tomahawk...@gmail.com wrote: How do I track down an reference to an undefined value?  My program must

Re: [Haskell-cafe] Prelude.undefined

2010-03-02 Thread Alex MDC
2010/3/3 Tom Hawkins tomahawk...@gmail.com On Wed, Mar 3, 2010 at 6:07 AM, Ivan Miljenovic -Wall only complains about shadow bindings, defined but not used, and no type signature. But no unmatched patterns. If you can run your code through the ghc debugger you can get it to break when an

Re: [Haskell-cafe] Prelude.undefined

2010-03-02 Thread Ivan Miljenovic
On 3 March 2010 16:11, Tom Hawkins tomahawk...@gmail.com wrote: -Wall only complains about shadow bindings, defined but not used, and no type signature.  But no unmatched patterns. Yes it does: one of the options it brings in is -fwarn-incomplete-patterns which tells you if you've missed a

Re: [Haskell-cafe] Prelude.undefined

2010-03-02 Thread Alexander Dunlap
On Tue, Mar 2, 2010 at 9:06 PM, Tom Hawkins tomahawk...@gmail.com wrote: How do I track down an reference to an undefined value?  My program must not be using a library correctly because the program makes no direct use of 'undefined'.  Running with +RTS -xc yields: GHC.Err.CAFTest:

Re: [Haskell-cafe] How do you rewrite your code?

2010-03-02 Thread Ryan Ingram
On Tue, Mar 2, 2010 at 11:20 AM, Sean Leather leat...@cs.uu.nl wrote: For all x, f: x = return . f -- fmap f x or f $ x -- requires importing Control.Applicative I think the right-hand side (RHS) is more concise and simpler. The types here do change: the type constructor has a Monad