Re: [GHC] #4164: stm-2.1.2.0 build failure on GHC 6.10
#4164: stm-2.1.2.0 build failure on GHC 6.10 +--- Reporter: j3h| Owner: Type: bug| Status: closed Priority: normal | Milestone: Component: libraries (other) |Version: Resolution: fixed | Keywords: stm GHC.Conc readTVarIO Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: None/Unknown | +--- Changes (by simonmar): * status: new = closed * resolution: = fixed Comment: thanks to Duncan we know what the problem is - a bug that was fixed in Cabal 1.8.0.4. I've uploaded `stm-2.1.2.2` with a workaround. Please re-open if you still have problems. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4164#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4180: do not consider associativity for unary minus for fixity resolution
#4180: do not consider associativity for unary minus for fixity resolution --+- Reporter: maeder |Owner: Type: proposal | Status: new Priority: normal |Milestone: Component: Compiler | Version: 6.12.3 Keywords: fixity resolution | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Comment(by maeder): I've added a clearer resolution algorithm. I don't think the proposal is worth an extra language extension or compiler flag. I rather consider my proposal as a bug fix of the language description (that ghc conformed to), whereas various (all?) other compilers implemented resolution differently. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4180#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4180: do not consider associativity for unary minus for fixity resolution
#4180: do not consider associativity for unary minus for fixity resolution --+- Reporter: maeder |Owner: Type: proposal | Status: new Priority: normal |Milestone: Component: Compiler | Version: 6.12.3 Keywords: fixity resolution | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Comment(by maeder): I would rather propose a flag to get the old haskell98 resolution but make the default my proposed improvement. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4180#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4180: do not consider associativity for unary minus for fixity resolution
#4180: do not consider associativity for unary minus for fixity resolution --+- Reporter: maeder |Owner: Type: proposal | Status: new Priority: normal |Milestone: Component: Compiler | Version: 6.12.3 Keywords: fixity resolution | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Comment(by simonmar): If we made it the default then we would not be implementing Haskell 2010. That's ok, but we have to document very carefully the ways in which we diverge from the standard, which we do in the User's Guide: [http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/bugs-and- infelicities.html#vs-Haskell-defn]. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4180#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4180: do not consider associativity for unary minus for fixity resolution
#4180: do not consider associativity for unary minus for fixity resolution --+- Reporter: maeder |Owner: Type: proposal | Status: new Priority: normal |Milestone: Component: Compiler | Version: 6.12.3 Keywords: fixity resolution | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Comment(by maeder): I've proposed the improvement for Haskell 2010 (however final the description may be). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4180#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3064: Very long compile times with type functions
#3064: Very long compile times with type functions +--- Reporter: simonpj |Owner: chak Type: bug | Status: new Priority: low |Milestone: 6.14.1 Component: Compiler (Type checker) | Version: 6.10.1 Keywords: | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: Compile-time performance bug +--- Comment(by simonpj): Here's another example of poor performance: http://paczesiowa.blogspot.com/2010/07/two-dimensional-analog-literals- in.html -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3064#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #4201: Improve eta reduction
#4201: Improve eta reduction -+-- Reporter: simonpj |Owner: Type: bug | Status: new Priority: normal|Milestone: Component: Compiler | Version: 6.12.3 Keywords:| Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Consider {{{ -- bar :: Int - Int -- g :: Moo ~ Int f :: (Moo - Int) - Char foo f = f (\ x - bar (x `cast` a)) }}} This will allocate a closure for `(\ x - bar (x `cast` a))` before calling `f`. But really it should eta-reduce the lambda to {{{ foo f = f (bar `cast` (sym g - Int)) -- (sym g - Int) :: (Int - Int) ~ (Moo - Int) }}} Result: no allocation before calling `f`. Thanks to Louis for suggesting this http://www.haskell.org/pipermail /glasgow-haskell-users/2010-July/018982.html -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4201 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4201: Improve eta reduction
#4201: Improve eta reduction -+-- Reporter: simonpj |Owner: Type: bug | Status: new Priority: normal|Milestone: Component: Compiler | Version: 6.12.3 Keywords:| Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by kfrdbs): * cc: kfr...@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4201#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3064: Very long compile times with type functions
#3064: Very long compile times with type functions +--- Reporter: simonpj |Owner: chak Type: bug | Status: new Priority: low |Milestone: 6.14.1 Component: Compiler (Type checker) | Version: 6.10.1 Keywords: | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: Compile-time performance bug +--- Changes (by kfrdbs): * cc: kfr...@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3064#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3024: Rewrite hp2ps in Haskell
#3024: Rewrite hp2ps in Haskell -+-- Reporter: SamB |Owner: Type: task | Status: new Priority: normal|Milestone: _|_ Component: Profiling | Version: 6.10.1 Keywords:| Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by lelf): * cc: anton@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3024#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4198: waitForProcess fails with Bad file descriptor
#4198: waitForProcess fails with Bad file descriptor ---+ Reporter: yugr| Owner: Type: bug | Status: new Priority: normal | Component: libraries/process Version: 6.12.3 |Keywords: waitForProcess Os: Windows |Testcase: Architecture: x86_64 (amd64) | Failure: Incorrect result at runtime ---+ Comment(by yugr): System.Cmd system also fails with same error. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4198#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4201: Improve eta reduction
#4201: Improve eta reduction -+-- Reporter: simonpj |Owner: Type: bug | Status: new Priority: normal|Milestone: Component: Compiler | Version: 6.12.3 Keywords:| Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Comment(by LouisWasserman): I actually wrote a patch for this, will upload it when I get in this morning (yay, my first GHC patch!) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4201#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #4201: Improve eta reduction
#4201: Improve eta reduction -+-- Reporter: simonpj |Owner: Type: bug | Status: new Priority: normal|Milestone: Component: Compiler | Version: 6.12.3 Keywords:| Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Comment(by LouisWasserman): Patch uploaded. Arity checking appears to still need some tweaking, because I still get functions that look like (\ x - f (x `cast` a)) inside bigger functions, and replacing fun_arity fun = incoming_arity with True seems to eliminate that, so something might be up with testing the arity of casted functions. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4201#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #4202: Cannot open a file with double quotes in the name
#4202: Cannot open a file with double quotes in the name +--- Reporter: guest| Owner: Type: bug | Status: new Priority: normal | Component: libraries/base Version: 6.12.1 |Keywords: Os: Windows |Testcase: Architecture: x86 | Failure: Runtime crash +--- When trying to open a file with double quotes in the name, using System.IO.openBinaryFile or System.IO.openFile, an exception is thrown: Prelude System.IO openBinaryFile Restaurant \A B C\ ReadMode return () *** Exception: Restaurant A B C: openBinaryFile: invalid argument (Invalid argument) As System.Directory.copyFile uses System.IO.openBinaryFile, copyFile also results in an exception; this is probably the same for other functions. Henk-Jan van Tuyl (hjgtuyl at chello dot nl) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4202 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
RE: Casting + eta reduction
now I understand. I've created a Trac ticket. Shouldn't be hard. http://hackage.haskell.org/trac/ghc/ticket/4201 Thanks Simon From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell-users-boun...@haskell.org] On Behalf Of Louis Wasserman Sent: 13 July 2010 17:46 To: Simon Peyton-Jones Cc: glasgow-haskell-users@haskell.org Subject: Re: Casting + eta reduction Or a different way: I want -fdo-lambda-eta-expansion (which, if I understand correctly, actually triggers eta *reduction*) to eliminate argument casts, as well. My motivation: I'm working on a generalized trie library, and due to http://hackage.haskell.org/trac/ghc/ticket/4185, I can't use GeneralizedNewtypeDeriving to minimize the overhead of a stack of about 20 newtypes, each with their own class instance, even if I wasn't trying to use Template Haskell, which currently has no syntax for doing GeneralizedNewtypeDeriving on multi-parameter type classes (it only derives single-argument type classes.) As it stands, I have a lot of methods that compile to foo f = bar (\ x - f (x `cast` a)) and they stack 20 deep, which means I have to do 20 allocations (\ x - f (x `cast` a)) for even the most simple methods. What I'd like to see is this getting reduced to foo = bar `cast` (...) which would reduce my overhead significantly. Louis Wasserman wasserman.lo...@gmail.commailto:wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis On Tue, Jul 13, 2010 at 10:06 AM, Louis Wasserman wasserman.lo...@gmail.commailto:wasserman.lo...@gmail.com wrote: Mmmm, let's give a slightly different example: foo :: Foo - Int foo (Foo a) = a + 1 bar :: Int - Int bar = foo . Foo and I'd expect bar to be replaced with (foo `cast` (Int - Int)) and inlined, eliminating an allocation. In general, we'd get the equivalent of the no-allocation versions of GeneralizedNewtypeDeriving instances, so long as we could write them out for ourselves. Louis Wasserman wasserman.lo...@gmail.commailto:wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis On Tue, Jul 13, 2010 at 9:09 AM, Simon Peyton-Jones simo...@microsoft.commailto:simo...@microsoft.com wrote: It compiles to lift f d = f (d `cast` blah) which seems fine to me. Are you unhappy with that? Simon From: glasgow-haskell-users-boun...@haskell.orgmailto:glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell-users-boun...@haskell.orgmailto:glasgow-haskell-users-boun...@haskell.org] On Behalf Of Louis Wasserman Sent: 09 July 2010 03:30 To: glasgow-haskell-users@haskell.orgmailto:glasgow-haskell-users@haskell.org Subject: Casting + eta reduction Consider newtype Foo = Foo Int lift :: (Int - a) - Foo - a lift f (Foo x) = f x Now, I'd expect this to compile with -O2 down to something like lift f = f `cast` (Foo - a) but it doesn't. It seems that GeneralizedNewtypeDeriving assumes that these two things *are* equivalent, and it just directly casts the class dictionary. The implication would be that that GeneralizedNewtypeDeriving gives more efficient instances than you could *possibly* get if you wrote them by hand, which is very sad. Louis Wasserman wasserman.lo...@gmail.commailto:wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: behaviour of ghci on .c modules that are part of a library
Dear Haskell maintainers, I've progressed a little and found that the problem is down to accessing global variables that are declared in dynamic libraries. In a nutshell, this doesn't as the addresses of these global variables are all wrong when ghci is executing the code. So, I think I hit: http://hackage.haskell.org/trac/ghc/ticket/781 I was able to work around this problem by compiling the C modules with -fPIC. This bug is pretty bad, I'd say. I've added myself to its CC list. Cheers, Axel On 14.07.2010, at 16:51, Axel Simon wrote: Hi all, I'm trying to debug a segfault relating to the memory management in Gtk2Hs. Rather than make you read the ticket http://hackage.haskell.org/trac/gtk2hs/ticket/1183 , I'll describe the problem: - compiler 6.12.1 or 6.12.3 - darcs head of Gtk2Hs with #define DEBUG instead of #undef DEBUG in gtk/Graphics/UI/Gtk/General/hsthread.c - platform Ubuntu Linux, x86-64 - to reproduce: cd gtk2hs/gtk/demo/hello and run ghci World.hs and type 'main' A window with the Hello World button appears. After a few seconds, the GC runs and the finaliser of the GtkButton is run since the Haskell program no longer holds a reference to that object (only the GtkWindow in C land has). Thus, the GC calls a C function gtk2hs_g_object_unref_from_mainloop which is supposed to enqueue the object into a global data structure from which objects are later taken and g_object_unref is called on them. This global data structure is protected by a mutex, which is acquired using g_static_mutex_lock: void gtk2hs_g_object_unref_from_mainloop(gpointer object) { int mutex_locked = 0; if (threads_initialised) { #ifdef DEBUG printf(acquiring lock to add a %s object at %lx\n, g_type_name(G_OBJECT_TYPE(object)), (unsigned long) object); printf(value of lock function is %lx\n, (unsigned long) g_thread_functions_for_glib_use.mutex_lock); #endif g_rand_new(); #if defined( WIN32 ) EnterCriticalSection(gtk2hs_finalizer_mutex); #else g_static_mutex_lock(gtk2hs_finalizer_mutex); #endif mutex_locked = 1; } [..] The program prints: acquiring lock to add a GtkButton object at 22d8020 value of lock function is 0 zsh: segmentation fault ghci World Now the debugging weirdness starts. Whatever I do, I cannot get gdb to find the symbol gtk2hs_g_object_unref_from_mainloop. Since the function above is contained in a C file that comes with our Haskell library, I tried to add cc-options: -g and cc- options: -ggdb -O0, but maybe somewhere symbols are stripped. So I added the bogus function call to g_rand_new() which is not called anywhere else and gdb stops as follows: acquiring lock to add a GtkButton object at 2105020 value of lock function is 0 [Switching to Thread 0x741ff710 (LWP 15735)] Breakpoint 12, 0x7115bfa0 in g_rand_new () from /usr/lib/ libglib-2.0.so This all seems reasonable, but: (gdb) bt #0 0x7115bfa0 in g_rand_new () from /usr/lib/libglib-2.0.so #1 0x419b3792 in ?? () #2 0x7678f078 in ?? () i.e. the calling context is broken. I'm very, very sure that the caller is indeed the above mentioned function and since g_rand_new isn't called anywhere in my Haskell program (and otherwise the calling context would be sane). I'm also passing the address of gtk2hs_g_object_unref_from_mainloop as FinalizerPtr to all my ForeignPtrs, so there is no inlining going on. Back to the culprit, the call to g_static_mutex_lock. This is a macro that expands to *g_thread_functions_for_glib_use.mutex_lock where g_thread_functions_for_glib is a global variable that contains a lot of function pointers. At the break point, it contains this: (gdb) print g_thread_functions_for_glib_use $33 = {mutex_new = 0x70cd9820 g_mutex_new_posix_impl, mutex_lock = 0x76c8b3c0 __pthread_mutex_lock, mutex_trylock = 0x70cd97b0 g_mutex_trylock_posix_impl, mutex_unlock = 0x76c8ca00 __pthread_mutex_unlock, mutex_free = 0x70cd9740 g_mutex_free_posix_impl, [..] So the call to g_mutex_lock should call the function __pthread_mutex_lock but it calls NULL. I hoped that writing this email would give me a bit more insight into the problem, but for now I suspect that something overwrites either the stack or the code of the function. On the same platform, the compiled version prints: acquiring lock to add a GtkButton object at 1b05820 value of lock function is 7f7adcabd3c0 within mutex: adding finalizer to a GtkButton object! On Mac OS or i386, using ghci or ghc, version 6.10.4, it works as well. Now for the fun bit: on i386 using ghci version 6.12.1 it works too. So it's an x86-64 and ghc 6.12.1 bug. According to Christian Maeder who submitted the ticket, the problem persists in 6.12.3. Any hints and help appreciated, Cheers, Axel ___ Glasgow-haskell-users mailing list
Re: [Gtk2hs-devel] behaviour of ghci on .c modules that are part of a library
On 16/07/2010 12:36, Axel Simon wrote: Dear Haskell maintainers, I've progressed a little and found that the problem is down to accessing global variables that are declared in dynamic libraries. In a nutshell, this doesn't as the addresses of these global variables are all wrong when ghci is executing the code. So, I think I hit: http://hackage.haskell.org/trac/ghc/ticket/781 I was able to work around this problem by compiling the C modules with -fPIC. This bug is pretty bad, I'd say. I've added myself to its CC list. Urgh. It's a nasty bug, but not one that we can fix, because it's an artifact of the small memory model used on x86_64. The only fix is to use -fPIC. It might be possible to use -fPIC either by default, or perhaps just for .c files and when compiling data references from FFI declarations in Haskell code, that's something we could look into. We might want -fPIC on by default anyway if we switch to using dynamic linking by default (but we're not yet sure what ramifications that will have). Cheers, Simon Cheers, Axel On 14.07.2010, at 16:51, Axel Simon wrote: Hi all, I'm trying to debug a segfault relating to the memory management in Gtk2Hs. Rather than make you read the ticket http://hackage.haskell.org/trac/gtk2hs/ticket/1183 , I'll describe the problem: - compiler 6.12.1 or 6.12.3 - darcs head of Gtk2Hs with #define DEBUG instead of #undef DEBUG in gtk/Graphics/UI/Gtk/General/hsthread.c - platform Ubuntu Linux, x86-64 - to reproduce: cd gtk2hs/gtk/demo/hello and run ghci World.hs and type 'main' A window with the Hello World button appears. After a few seconds, the GC runs and the finaliser of the GtkButton is run since the Haskell program no longer holds a reference to that object (only the GtkWindow in C land has). Thus, the GC calls a C function gtk2hs_g_object_unref_from_mainloop which is supposed to enqueue the object into a global data structure from which objects are later taken and g_object_unref is called on them. This global data structure is protected by a mutex, which is acquired using g_static_mutex_lock: void gtk2hs_g_object_unref_from_mainloop(gpointer object) { int mutex_locked = 0; if (threads_initialised) { #ifdef DEBUG printf(acquiring lock to add a %s object at %lx\n, g_type_name(G_OBJECT_TYPE(object)), (unsigned long) object); printf(value of lock function is %lx\n, (unsigned long) g_thread_functions_for_glib_use.mutex_lock); #endif g_rand_new(); #if defined( WIN32 ) EnterCriticalSection(gtk2hs_finalizer_mutex); #else g_static_mutex_lock(gtk2hs_finalizer_mutex); #endif mutex_locked = 1; } [..] The program prints: acquiring lock to add a GtkButton object at 22d8020 value of lock function is 0 zsh: segmentation fault ghci World Now the debugging weirdness starts. Whatever I do, I cannot get gdb to find the symbol gtk2hs_g_object_unref_from_mainloop. Since the function above is contained in a C file that comes with our Haskell library, I tried to add cc-options: -g and cc- options: -ggdb -O0, but maybe somewhere symbols are stripped. So I added the bogus function call to g_rand_new() which is not called anywhere else and gdb stops as follows: acquiring lock to add a GtkButton object at 2105020 value of lock function is 0 [Switching to Thread 0x741ff710 (LWP 15735)] Breakpoint 12, 0x7115bfa0 in g_rand_new () from /usr/lib/ libglib-2.0.so This all seems reasonable, but: (gdb) bt #0 0x7115bfa0 in g_rand_new () from /usr/lib/libglib-2.0.so #1 0x419b3792 in ?? () #2 0x7678f078 in ?? () i.e. the calling context is broken. I'm very, very sure that the caller is indeed the above mentioned function and since g_rand_new isn't called anywhere in my Haskell program (and otherwise the calling context would be sane). I'm also passing the address of gtk2hs_g_object_unref_from_mainloop as FinalizerPtr to all my ForeignPtrs, so there is no inlining going on. Back to the culprit, the call to g_static_mutex_lock. This is a macro that expands to *g_thread_functions_for_glib_use.mutex_lock where g_thread_functions_for_glib is a global variable that contains a lot of function pointers. At the break point, it contains this: (gdb) print g_thread_functions_for_glib_use $33 = {mutex_new = 0x70cd9820g_mutex_new_posix_impl, mutex_lock = 0x76c8b3c0__pthread_mutex_lock, mutex_trylock = 0x70cd97b0g_mutex_trylock_posix_impl, mutex_unlock = 0x76c8ca00__pthread_mutex_unlock, mutex_free = 0x70cd9740g_mutex_free_posix_impl, [..] So the call to g_mutex_lock should call the function __pthread_mutex_lock but it calls NULL. I hoped that writing this email would give me a bit more insight into the problem, but for now I suspect that something overwrites either the stack or the code of the function. On the same platform, the compiled version prints: acquiring lock to add a GtkButton object at 1b05820 value of lock function is
Re: [Gtk2hs-devel] behaviour of ghci on .c modules that are part of a library
Hi Simon, On 16.07.2010, at 14:29, Simon Marlow wrote: On 16/07/2010 12:36, Axel Simon wrote: Dear Haskell maintainers, I've progressed a little and found that the problem is down to accessing global variables that are declared in dynamic libraries. In a nutshell, this doesn't as the addresses of these global variables are all wrong when ghci is executing the code. So, I think I hit: http://hackage.haskell.org/trac/ghc/ticket/781 I was able to work around this problem by compiling the C modules with -fPIC. This bug is pretty bad, I'd say. I've added myself to its CC list. Urgh. It's a nasty bug, but not one that we can fix, because it's an artifact of the small memory model used on x86_64. The only fix is to use -fPIC. It might be possible to use -fPIC either by default, or perhaps just for .c files and when compiling data references from FFI declarations in Haskell code, that's something we could look into. We might want -fPIC on by default anyway if we switch to using dynamic linking by default (but we're not yet sure what ramifications that will have). Well, my fix is: if arch(x86_64) cc-options: -fPIC This only affects the C files we compile of which there are only two at the moment. I am happy with this solution since I know which files are affected. But basically this bug will hit me whenever I use a global C variable from within Haskell? I hope there are none that we use, they should all be accessed using functions, so we should be safe. Cheers, Axel Cheers, Simon Cheers, Axel On 14.07.2010, at 16:51, Axel Simon wrote: Hi all, I'm trying to debug a segfault relating to the memory management in Gtk2Hs. Rather than make you read the ticket http://hackage.haskell.org/trac/gtk2hs/ticket/1183 , I'll describe the problem: - compiler 6.12.1 or 6.12.3 - darcs head of Gtk2Hs with #define DEBUG instead of #undef DEBUG in gtk/Graphics/UI/Gtk/General/hsthread.c - platform Ubuntu Linux, x86-64 - to reproduce: cd gtk2hs/gtk/demo/hello and run ghci World.hs and type 'main' A window with the Hello World button appears. After a few seconds, the GC runs and the finaliser of the GtkButton is run since the Haskell program no longer holds a reference to that object (only the GtkWindow in C land has). Thus, the GC calls a C function gtk2hs_g_object_unref_from_mainloop which is supposed to enqueue the object into a global data structure from which objects are later taken and g_object_unref is called on them. This global data structure is protected by a mutex, which is acquired using g_static_mutex_lock: void gtk2hs_g_object_unref_from_mainloop(gpointer object) { int mutex_locked = 0; if (threads_initialised) { #ifdef DEBUG printf(acquiring lock to add a %s object at %lx\n, g_type_name(G_OBJECT_TYPE(object)), (unsigned long) object); printf(value of lock function is %lx\n, (unsigned long) g_thread_functions_for_glib_use.mutex_lock); #endif g_rand_new(); #if defined( WIN32 ) EnterCriticalSection(gtk2hs_finalizer_mutex); #else g_static_mutex_lock(gtk2hs_finalizer_mutex); #endif mutex_locked = 1; } [..] The program prints: acquiring lock to add a GtkButton object at 22d8020 value of lock function is 0 zsh: segmentation fault ghci World Now the debugging weirdness starts. Whatever I do, I cannot get gdb to find the symbol gtk2hs_g_object_unref_from_mainloop. Since the function above is contained in a C file that comes with our Haskell library, I tried to add cc-options: -g and cc- options: -ggdb -O0, but maybe somewhere symbols are stripped. So I added the bogus function call to g_rand_new() which is not called anywhere else and gdb stops as follows: acquiring lock to add a GtkButton object at 2105020 value of lock function is 0 [Switching to Thread 0x741ff710 (LWP 15735)] Breakpoint 12, 0x7115bfa0 in g_rand_new () from /usr/lib/ libglib-2.0.so This all seems reasonable, but: (gdb) bt #0 0x7115bfa0 in g_rand_new () from /usr/lib/libglib-2.0.so #1 0x419b3792 in ?? () #2 0x7678f078 in ?? () i.e. the calling context is broken. I'm very, very sure that the caller is indeed the above mentioned function and since g_rand_new isn't called anywhere in my Haskell program (and otherwise the calling context would be sane). I'm also passing the address of gtk2hs_g_object_unref_from_mainloop as FinalizerPtr to all my ForeignPtrs, so there is no inlining going on. Back to the culprit, the call to g_static_mutex_lock. This is a macro that expands to *g_thread_functions_for_glib_use.mutex_lock where g_thread_functions_for_glib is a global variable that contains a lot of function pointers. At the break point, it contains this: (gdb) print g_thread_functions_for_glib_use $33 = {mutex_new = 0x70cd9820g_mutex_new_posix_impl, mutex_lock = 0x76c8b3c0__pthread_mutex_lock, mutex_trylock = 0x70cd97b0g_mutex_trylock_posix_impl,
Re: [Gtk2hs-devel] behaviour of ghci on .c modules that are part of a library
On 16/07/2010 14:04, Axel Simon wrote: Hi Simon, On 16.07.2010, at 14:29, Simon Marlow wrote: On 16/07/2010 12:36, Axel Simon wrote: Dear Haskell maintainers, I've progressed a little and found that the problem is down to accessing global variables that are declared in dynamic libraries. In a nutshell, this doesn't as the addresses of these global variables are all wrong when ghci is executing the code. So, I think I hit: http://hackage.haskell.org/trac/ghc/ticket/781 I was able to work around this problem by compiling the C modules with -fPIC. This bug is pretty bad, I'd say. I've added myself to its CC list. Urgh. It's a nasty bug, but not one that we can fix, because it's an artifact of the small memory model used on x86_64. The only fix is to use -fPIC. It might be possible to use -fPIC either by default, or perhaps just for .c files and when compiling data references from FFI declarations in Haskell code, that's something we could look into. We might want -fPIC on by default anyway if we switch to using dynamic linking by default (but we're not yet sure what ramifications that will have). Well, my fix is: if arch(x86_64) cc-options: -fPIC This only affects the C files we compile of which there are only two at the moment. I am happy with this solution since I know which files are affected. But basically this bug will hit me whenever I use a global C variable from within Haskell? I hope there are none that we use, they should all be accessed using functions, so we should be safe. A reference to data that resides in a shared library, yes. It's surprising how rarely this happens in fact. Cheers, Simon Cheers, Axel Cheers, Simon Cheers, Axel On 14.07.2010, at 16:51, Axel Simon wrote: Hi all, I'm trying to debug a segfault relating to the memory management in Gtk2Hs. Rather than make you read the ticket http://hackage.haskell.org/trac/gtk2hs/ticket/1183 , I'll describe the problem: - compiler 6.12.1 or 6.12.3 - darcs head of Gtk2Hs with #define DEBUG instead of #undef DEBUG in gtk/Graphics/UI/Gtk/General/hsthread.c - platform Ubuntu Linux, x86-64 - to reproduce: cd gtk2hs/gtk/demo/hello and run ghci World.hs and type 'main' A window with the Hello World button appears. After a few seconds, the GC runs and the finaliser of the GtkButton is run since the Haskell program no longer holds a reference to that object (only the GtkWindow in C land has). Thus, the GC calls a C function gtk2hs_g_object_unref_from_mainloop which is supposed to enqueue the object into a global data structure from which objects are later taken and g_object_unref is called on them. This global data structure is protected by a mutex, which is acquired using g_static_mutex_lock: void gtk2hs_g_object_unref_from_mainloop(gpointer object) { int mutex_locked = 0; if (threads_initialised) { #ifdef DEBUG printf(acquiring lock to add a %s object at %lx\n, g_type_name(G_OBJECT_TYPE(object)), (unsigned long) object); printf(value of lock function is %lx\n, (unsigned long) g_thread_functions_for_glib_use.mutex_lock); #endif g_rand_new(); #if defined( WIN32 ) EnterCriticalSection(gtk2hs_finalizer_mutex); #else g_static_mutex_lock(gtk2hs_finalizer_mutex); #endif mutex_locked = 1; } [..] The program prints: acquiring lock to add a GtkButton object at 22d8020 value of lock function is 0 zsh: segmentation fault ghci World Now the debugging weirdness starts. Whatever I do, I cannot get gdb to find the symbol gtk2hs_g_object_unref_from_mainloop. Since the function above is contained in a C file that comes with our Haskell library, I tried to add cc-options: -g and cc- options: -ggdb -O0, but maybe somewhere symbols are stripped. So I added the bogus function call to g_rand_new() which is not called anywhere else and gdb stops as follows: acquiring lock to add a GtkButton object at 2105020 value of lock function is 0 [Switching to Thread 0x741ff710 (LWP 15735)] Breakpoint 12, 0x7115bfa0 in g_rand_new () from /usr/lib/ libglib-2.0.so This all seems reasonable, but: (gdb) bt #0 0x7115bfa0 in g_rand_new () from /usr/lib/libglib-2.0.so #1 0x419b3792 in ?? () #2 0x7678f078 in ?? () i.e. the calling context is broken. I'm very, very sure that the caller is indeed the above mentioned function and since g_rand_new isn't called anywhere in my Haskell program (and otherwise the calling context would be sane). I'm also passing the address of gtk2hs_g_object_unref_from_mainloop as FinalizerPtr to all my ForeignPtrs, so there is no inlining going on. Back to the culprit, the call to g_static_mutex_lock. This is a macro that expands to *g_thread_functions_for_glib_use.mutex_lock where g_thread_functions_for_glib is a global variable that contains a lot of function pointers. At the break point, it contains this: (gdb) print g_thread_functions_for_glib_use $33 = {mutex_new = 0x70cd9820g_mutex_new_posix_impl, mutex_lock = 0x76c8b3c0__pthread_mutex_lock,
Re: new qualified operators
On 15/07/2010 13:46, Christian Maeder wrote: Hi, seeing http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/syntax-extns.html#new-qualified-operators Could you add: Spaces are not allowed in new qualified operators! For {-# LANGUAGE NewQualifiedOperators #-} f1 = (+) f2 = ( +) f3 = (+ ) f4 = Prelude.(+) f5 = Prelude.( +) f6 = Prelude.(+ ) f1 - f4 are ok, but f5 and f6 are rejected by ghc-6.12.3 with: Not in scope: data constructor `Prelude' Yes, it's really a bug, but it was difficult to make this consistent while retaining support for the old syntax. I expect that we'll deprecate this extension anyway, since the Haskell 2010 committee rejected it as a proposal. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
[Haskell] ANNOUNCE: highlighting-kate 0.2.7
I'm pleased to announce a new release of highlighting-kate [1], a syntax highlighting library based on syntax definitions from the kate editor. !! Important note !! The new release uses new, two-letter class names in its HTML output. If you use highlighting-kate, you will need to update your css files. Three sample css files can be found in the css directory of the source. This release also incorporates improvements to the kate syntax definition for Haskell by Nicolas Wu. There are two minor API changes: 1. A new function, languagesByFilename, has been added. This will give better results than languagesByExtension for things like Makefile or CMake.txt. 2. A new formatting option, OptDetailed, has been added. Use this only if you need access to detailed, language-specific lexical information, and not generic styles. [1]: http://hackage.haskell.org/package/highlighting-kate ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] VSTTE 2010: Second Call for Participation -- Early Registration ends in 2 weeks
(Apologies if you receive multiple copies of this announcement) * *** Second Call for Participation -- Early Registration ends in 2 weeks *** Third International Conference on Verified Software: Theories, Tools, and Experiments Edinburgh, Scotland August 16th-19th, 2010 http://www.macs.hw.ac.uk/vstte10 SPONSORS: NSF, EPSRC, Microsoft Research, SICSA, Altran Praxis, SSEI, FME, Contemplate, Heriot-Watt University ** The Third International Conference on Verified Software: Theories, Tools, and Experiments follows a successful inaugural working conference at Zurich (2005) and a successful conference in Toronto (2008). This conference is part of the Verified Software Initiative (VSI), a fifteen-year, cooperative, international project directed at the scientific challenges of large-scale software verification. VSI also includes UKCRC's Grand Challenge 6, i.e. Dependable Systems Evolution. PROGRAMME The programme includes - Keynote presentations by Tom Ball (Microsoft), Gerwin Klein (National ICT Australia), and Matthew Parkinson (University of Cambridge); - Invited Tool Demo Presentations by Colin O’Halloran (ClawZ/Circus) , Bart Jacobs (VeriFast), Michael Jastram (ProB) and Joe Kinry (BONc/Beetlz); - A Verification Competition; - Industrial Tool Vendors; - Two workshops: Theory WS and Tools Experiments WS; - A Summer School -- lectures given by Robert Atkey/Ewen Maclean, Alan Bundy/Lucas Dixon, Jane Hillston, Cliff Jones, Gerwin Klein, J Strother Moore, Natarajan Shankar and Graham Steel; A provisional programme is available at: http://www.macs.hw.ac.uk/vstte10/Programme.html VENUE VSTTE 2010 is being hosted by Heriot-Watt University in Edinburgh. The conference dates coincide with the 2010 Edinburgh International Festival and the Edinburgh Festival Fringe -- collectively the largest annual arts festival on the planet! The technical programme will take place in the Edinburgh Conference Centre (Heriot-Watt University campus), where accommodation will be available at very competitive rates for festival time. Social events will be arranged within the city centre, making VSTTE an unique cultural and scholarly event for 2010! SOCIAL EVENTS As well as a welcome reception and conference banquet, SICSA are sponsoring a special drinks reception in the Informatics Forum at the heart of the Festival on August 17th. STUDENT SUPPORT Support for students wishing to attend VSTTE 2010 is available. Please contact vstt...@macs.hw.ac.uk for more details. REGISTRATION Online registration is available from http://www.macs.hw.ac.uk/vstte10_reg/Registration.php Early registration ends on July 31st. -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell-cafe] ANNOUNCE: highlighting-kate 0.2.7
I'm pleased to announce a new release of highlighting-kate [1], a syntax highlighting library based on syntax definitions from the kate editor. !! Important note !! The new release uses new, two-letter class names in its HTML output. If you use highlighting-kate, you will need to update your css files. Three sample css files can be found in the css directory of the source. This release also incorporates improvements to the kate syntax definition for Haskell by Nicolas Wu. There are two minor API changes: 1. A new function, languagesByFilename, has been added. This will give better results than languagesByExtension for things like Makefile or CMake.txt. 2. A new formatting option, OptDetailed, has been added. Use this only if you need access to detailed, language-specific lexical information, and not generic styles. [1]: http://hackage.haskell.org/package/highlighting-kate ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A question about State Monad and Monad in general
Thanks Wren, Thanks Dave ... a quick question though could you point me to an example where I could build up my own in place modifiable data structure in Haskell without using any standard library stuff? For example, if I wanted an image representation such as this [[(Int,Int.Int)]] - basically a list of lists of 3 tuples (rgb) and wanted to do in place replacement to set the pixel values, how could I go about it. On Fri, Jul 16, 2010 at 9:47 AM, wren ng thornton w...@freegeek.org wrote: C K Kashyap wrote: Thanks Daniel, Better refactorability. If you're using monadic style, changing from, say, State Thing to StateT Thing OtherMonad or from StateT Thing FirstMonad to StateT Thing SecondMonad typically requires only few changes. Explicit state-passing usually requires more changes. So, performance gain (runtime/memory) is not a side effect of Monadic style right? Generally speaking, right: monadic style won't improve performance. However, using monadic notation may allow you to change the backing monad to a different representation of the same computation, thereby giving asymptotic improvements[1]. However, the improvements themselves are coming from the different representation; the use of monadic notation just allows you to switch the representation without altering the code. [1] http://www.iai.uni-bonn.de/~jv/mpc08.pdfhttp://www.iai.uni-bonn.de/%7Ejv/mpc08.pdf -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Hot-Swap with Haskell
hi, if been thinking about an haskell interpreter to, because of erlang's otp. its syntax is a mess, but its scalability is win. since erlang runs in its vm (interpreted) is there a need for a real haskell interpreter, or can there be a compiled haskell/otp with hotswapping, scaling and stuff? now back on topic, i wrote real haskell interpreter because there is the hint[1] package, which wrappes the ghc api. now i dont know what more the plugin package provides, but i thought hint is like is successor (since lambdabot used plugins and now uses mueval, which in turn uses hint ;). please correct me. have fun martin [1]: http://hackage.haskell.org/package/hint On 16.07.2010 06:06, Andy Stewart wrote: Don Stewartd...@galois.com writes: lazycat.manatee: Hi all, I'm research to build a hot-swap Haskell program to developing itself in Runtime, like Emacs. Essentially, Yi/Xmonad/dyre solution is replace currently executing technology: re-compile new code with new binary entry when re-compile success $ do save state before re-launch new entry replace current entry with new binary entry (executeFile) store state after re-launch new entry There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. 2) Sometimes re-execute is un-acceptable, example, you running some command in temrinal before you re-compile, you need re-execute command to restore state after re-launch, in this situation re-execute command is un-acceptable. I wonder have a better way that hot-swapping new code without re-compile/reboot. Well, the other approach to reloadable modules, using either object code plugins, or bytecode plugins, giving you module-level granularity. Thanks for your reply. I have read your papers : Dynamic Application From the Group Up and Plugging Haskell In In Dynamic Application From the Group Up, you introduction how to use re-compile technology implement source-code level hot-swapping. In Plugging Haskell In, you introduction to how to buld hot-swapping with object-code level. Yes, Dynamic linking can add new code to a running program, but how to replace existing binding with new ones? Looks you still need some reboot when you do *replace* and not just *add*. Infact, reboot is okay, only problem is *keep state*, some *static state* is easier to re-build, example, if you want restore editor buffer state, you just need save (filepath, cursorPosition), you can re-open file and restore cursor position after reboot process. Difficult is *Stream State*, such as: delete operation in file-manager command running in temrinal network communications in browser It's really difficult to restore those state, and re-execute is un-acceptable sometimes. You can found the screenshot of my project at http://www.flickr.com/photos/48809...@n02/ Currently, the closest library to implement dynamic linking is your plugins package (http://hackage.haskell.org/package/plugins-1.4.1), i really want to write some code to test it, unfortunately, it's broken with Cabal-1.8.0.4 that can't compile with ghc-6.12.x/ghc-6.12.3, can you fix it if you have time? It's so great package... I'm looking for some paper about Haskell and hot-swapping. Any paper or suggestion are welcome! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] trees and pointers
Hello Jake, Friday, July 16, 2010, 7:26:22 AM, you wrote: Excluding DiffArray under certain usage patterns of course, but DiffArray is slow for unknown reasons besides algorithmic complexity. unknown reason = MVar usage ArrayRef library contains parameterized DiffArray implementation that may be specialized either to MVar or IORef usage -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A question about State Monad and Monad in general
Hi, On 16/07/10 07:35, C K Kashyap wrote: Haskell without using any standard library stuff? For example, if I wanted an image representation such as this [[(Int,Int.Int)]] - basically a list of lists of 3 tuples (rgb) and wanted to do in place replacement to set the pixel values, how could I go about it. Break the problem down into parts: 1. replace a single pixel 2. modify an element in a list at a given index using a given modification function 3. modify an element in a list of lists at a pair of given indices using a given replacement function I had a stab at it. Without any standard library stuff I couldn't figure out how to print any output, though - so who knows if the code I wrote does what I intended. The point is, it's libraries all the way down - so use them, study them where necessary for understanding, and write them and share them when you find something missing. Claude -- http://claudiusmaximus.goto10.org {-# LANGUAGE NoImplicitPrelude #-} module CKKashyap where -- numbers are in the standard library data Nat = Zero | Succ Nat (+) :: Nat - Nat - Nat Zero + y = y (Succ x) + y = x + Succ y zero = Zero one = Succ zero two = one + one four = two + two eight = four + four sixteen = eight + eight thirtytwo = sixteen + sixteen sixtyfour = thirtytwo + thirtytwo onehundredandtwentyeight = sixtyfour + sixtyfour twohundredandfiftysix = onehundredandtwentyeight + onehundredandtwentyeight Succ twohundredandfiftyfive = twohundredandfiftysix -- booleans are in the standard library data Bool = False | True gt :: Nat - Nat - Bool Zero `gt` x = False Succ x `gt` Zero = True Succ x `gt` Succ y = x `gt` y eq :: Nat - Nat - Bool Zero `eq` Zero = True Succ x `eq` Succ y = x `eq` y x `eq` y = False -- lists are in the standard library data List a = Nil | Cons a (List a) map :: (a - b) - List a - List b map f Nil = Nil map f (Cons x xs) = Cons (f x) (map f xs) repeat :: a - List a repeat x = Cons x (repeat x) take :: Nat - List a - List a take Zero ys = Nil take (Succ x) Nil = Nil take (Succ x) (Cons y ys) = Cons y (take x ys) foldr :: (a - b - b) - b - List a - b foldr op e Nil = e foldr op e (Cons x xs) = op x (foldr op e xs) nats :: List Nat nats = Cons Zero (map Succ nats) -- tuples are in the standard library data Tuple2 a b = Tuple2 a b data Tuple3 a b c = Tuple3 a b c zip :: List a - List b - List (Tuple2 a b) zip Nil _ = Nil zip _ Nil = Nil zip (Cons a as) (Cons b bs) = Cons (Tuple2 a b) (zip as bs) -- modify list elements modifyAtIndex :: (a - a) - Nat - List a - List a modifyAtIndex f i as = let ias = zip nats as g (Tuple2 j a) = case i `eq` j of False - a True - f a in map g ias modifyAtIndex2 :: (a - a) - Nat - Nat - List (List a) - List (List a) modifyAtIndex2 f i j = modifyAtIndex (modifyAtIndex f i) j -- images as lists of lists of tuple3 of nat type Pixel = Tuple3 Nat Nat Nat black :: Pixel black = Tuple3 Zero Zero Zero white :: Pixel white = Tuple3 twohundredandfiftyfive twohundredandfiftyfive twohundredandfiftyfive type Scanline = List Pixel type Image = List Scanline blank :: Image blank = take thirtytwo (repeat (take thirtytwo (repeat black))) plotPixel :: Nat - Nat - Image - Image plotPixel x y img = modifyAtIndex2 (\_ - white) x y img diagonal :: Image diagonal = let is = take thirtytwo nats ijs = map (\i - Tuple2 i i) is in foldr (\(Tuple2 i j) img - plotPixel i j img) blank ijs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Finding zipper for custom tree
Sergey Mironov wrote: Sorry for late answer. Luke, Heinrich - thank you very much for explanations. I feel that I need more reading to get familiar with differentiation of functors and chain rule. Could you suggest some books or papers? For differentiation of data types, there is for example Conor McBride The Derivative of a Regular Type is its Type of One-Hole Contexts. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.8611 but I'm not sure whether it's easier to understand than the wikibook. For more on using functors to model algebraic data types, see also R Backhouse, P Jansson, J Jeuring, L Meertens Generic Programming - An Introduction - http://www.cse.chalmers.se/~patrikj/poly/afp98/ A corresponding chapter in the wikibook (Datatype algebra) has not been written, so far. Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Hot-Swap with Haskell
Martin Hilbig mar...@mhilbig.de writes: hi, if been thinking about an haskell interpreter to, because of erlang's otp. its syntax is a mess, but its scalability is win. since erlang runs in its vm (interpreted) is there a need for a real haskell interpreter, or can there be a compiled haskell/otp with hotswapping, scaling and stuff? now back on topic, i wrote real haskell interpreter because there is the hint[1] package, which wrappes the ghc api. now i dont know what more the plugin package provides, but i thought hint is like is successor (since lambdabot used plugins and now uses mueval, which in turn uses hint ;). please correct me. Yes, haskell interpreter maybe is solution, because Emacs is use this solution: Static C core ++ elisp interpreter, then all elisp hot-swapping is base on elisp interpreter. IMO, haskell interpreter is perfect solution for samll script job. But i'm afraid haskell interpreter is slow for *large code*, i don't know, i haven't try this way... Thanks for your suggestion, i will consider it. -- Andy have fun martin [1]: http://hackage.haskell.org/package/hint On 16.07.2010 06:06, Andy Stewart wrote: Don Stewartd...@galois.com writes: lazycat.manatee: Hi all, I'm research to build a hot-swap Haskell program to developing itself in Runtime, like Emacs. Essentially, Yi/Xmonad/dyre solution is replace currently executing technology: re-compile new code with new binary entry when re-compile success $ do save state before re-launch new entry replace current entry with new binary entry (executeFile) store state after re-launch new entry There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. 2) Sometimes re-execute is un-acceptable, example, you running some command in temrinal before you re-compile, you need re-execute command to restore state after re-launch, in this situation re-execute command is un-acceptable. I wonder have a better way that hot-swapping new code without re-compile/reboot. Well, the other approach to reloadable modules, using either object code plugins, or bytecode plugins, giving you module-level granularity. Thanks for your reply. I have read your papers : Dynamic Application From the Group Up and Plugging Haskell In In Dynamic Application From the Group Up, you introduction how to use re-compile technology implement source-code level hot-swapping. In Plugging Haskell In, you introduction to how to buld hot-swapping with object-code level. Yes, Dynamic linking can add new code to a running program, but how to replace existing binding with new ones? Looks you still need some reboot when you do *replace* and not just *add*. Infact, reboot is okay, only problem is *keep state*, some *static state* is easier to re-build, example, if you want restore editor buffer state, you just need save (filepath, cursorPosition), you can re-open file and restore cursor position after reboot process. Difficult is *Stream State*, such as: delete operation in file-manager command running in temrinal network communications in browser It's really difficult to restore those state, and re-execute is un-acceptable sometimes. You can found the screenshot of my project at http://www.flickr.com/photos/48809...@n02/ Currently, the closest library to implement dynamic linking is your plugins package (http://hackage.haskell.org/package/plugins-1.4.1), i really want to write some code to test it, unfortunately, it's broken with Cabal-1.8.0.4 that can't compile with ghc-6.12.x/ghc-6.12.3, can you fix it if you have time? It's so great package... I'm looking for some paper about Haskell and hot-swapping. Any paper or suggestion are welcome! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
What would be the semantics of hot-swapping? For, example, somewhere in memory you have a thunk of expression e. Now the user wants to upgrade e to e'. Would you require all thunks to be modified? A similar problem occurs with stack frames. You'd also have to make sure that e and e' have the same (or compatible types). e' most likely has different free variables than e, how can you translate thunk one to the other? Now assuming you don't try to do this, how would you handle the case when something goes wrong? On 16 July 2010 04:05, Andy Stewart lazycat.mana...@gmail.com wrote: Hi all, I'm research to build a hot-swap Haskell program to developing itself in Runtime, like Emacs. Essentially, Yi/Xmonad/dyre solution is replace currently executing technology: re-compile new code with new binary entry when re-compile success $ do save state before re-launch new entry replace current entry with new binary entry (executeFile) store state after re-launch new entry There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. 2) Sometimes re-execute is un-acceptable, example, you running some command in temrinal before you re-compile, you need re-execute command to restore state after re-launch, in this situation re-execute command is un-acceptable. I wonder have a better way that hot-swapping new code without re-compile/reboot. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family Anatidae on our hands. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A question about State Monad and Monad in general
Hi Claude, Thanks a lot for the example. Btw, is this where you are trying in-place replacement? modifyAtIndex :: (a - a) - Nat - List a - List a modifyAtIndex f i as = let ias = zip nats as g (Tuple2 j a) = case i `eq` j of False - a True - f a in map g ias modifyAtIndex2 :: (a - a) - Nat - Nat - List (List a) - List (List a) modifyAtIndex2 f i j = modifyAtIndex (modifyAtIndex f i) j Doesn't modfiyAtIndex return a new list? On Fri, Jul 16, 2010 at 2:28 PM, Claude Heiland-Allen claudiusmaxi...@goto10.org wrote: Hi, On 16/07/10 07:35, C K Kashyap wrote: Haskell without using any standard library stuff? For example, if I wanted an image representation such as this [[(Int,Int.Int)]] - basically a list of lists of 3 tuples (rgb) and wanted to do in place replacement to set the pixel values, how could I go about it. Break the problem down into parts: 1. replace a single pixel 2. modify an element in a list at a given index using a given modification function 3. modify an element in a list of lists at a pair of given indices using a given replacement function I had a stab at it. Without any standard library stuff I couldn't figure out how to print any output, though - so who knows if the code I wrote does what I intended. The point is, it's libraries all the way down - so use them, study them where necessary for understanding, and write them and share them when you find something missing. Claude -- http://claudiusmaximus.goto10.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
Thomas Schilling nomin...@googlemail.com writes: What would be the semantics of hot-swapping? For, example, somewhere in memory you have a thunk of expression e. Now the user wants to upgrade e to e'. Would you require all thunks to be modified? A similar problem occurs with stack frames. You'd also have to make sure that e and e' have the same (or compatible types). e' most likely has different free variables than e, how can you translate thunk one to the other? Now assuming you don't try to do this, how would you handle the case when something goes wrong? Good question. Infact, currently, i just use same technology with Yi/XMonad. Re-compile modules, and save some initial state before re-launch, and do re-execute some command to re-store those state after re-launch. Re-compile will drop old code, and restore state in new code. But re-compile solution not neat way since some state will lost. About your upgrade expression question, i haven no answer, that's why i post this topic to looking for a better solution. I know Emacs use some indirection symbol table for hot-swapping, but it's not safe since it not do type-check. Maybe we can wrap 'Dynamic' check type for safe re-load in runtime, if type match then upgrade, otherwise stop upgrade and keep old state. I just test re-compile technology, not try dynamic linking/load technology that Dons introduce in Plugging Haskell In.pdf since 'plugins' package is broken at the moment. Anyway, i believe this have a neat way to make static typing language can extension dynamic. Now, i'm reading Dons' new paper Dynamic Extension of Typed Functional Languages (http://www.cse.unsw.edu.au/~dons/papers/dons-phd-thesis.pdf) I hope i can find answer after read this paper... Any discuss are welcome! -- Andy On 16 July 2010 04:05, Andy Stewart lazycat.mana...@gmail.com wrote: Hi all, I'm research to build a hot-swap Haskell program to developing itself in Runtime, like Emacs. Essentially, Yi/Xmonad/dyre solution is replace currently executing technology: re-compile new code with new binary entry when re-compile success $ do save state before re-launch new entry replace current entry with new binary entry (executeFile) store state after re-launch new entry There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. 2) Sometimes re-execute is un-acceptable, example, you running some command in temrinal before you re-compile, you need re-execute command to restore state after re-launch, in this situation re-execute command is un-acceptable. I wonder have a better way that hot-swapping new code without re-compile/reboot. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambda calculus and equational logic
Patrick Browne wrote: Hi, In Haskell what roles are played by 1)lambda calculus and 2) equational logic? Are these roles related? I think this thread is getting a bit too theoretical, so I moved it to http://lambda-the-ultimate.org/node/4014 Thanks for putting the time and effort into your really helpful replies. Pat This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Platform dependency hell
I have Haskell Platform 2010.1.0.0 installed under Windows and I often find that Haskell breaks if I try upgrading some of the current modules. For example, after using cabal to upgrade to the latest version of Network.CGI, I can no longer compile any code and instead get this message: cabal.exe: dependencies conflict: ghc-6.12.1 requires array ==0.3.0.1 however array-0.3.0.1 was excluded because ghc-6.12.1 requires array ==0.3.0.0 The only way I have found to fix this problem in the past has been to uninstall the Haskell Platform and start over. Can anyone tell me: a. why does this occur, and b. what can I do to stop it from occurring again? Is it the case that the Haskell Platform is simply not upgradable and that I need to wait for the next release? Kevin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] trees and pointers
2010/7/16 wren ng thornton w...@freegeek.org: Jake McArthur wrote: On 07/15/2010 05:33 PM, Victor Gorokhov wrote: From the docs, lookup is O(min(n,W)) Actually worse than O(log n). Perhaps I am misunderstanding you, but O(min(n,W)) is either better than or the same as O(log n), depending on how you look at things, but I don't see any way that the former could be *worse* than the latter. For n W: min(n,W) log n So, when you can guarantee that n W ---which is almost always the case for IntMap---, then O(min(n,W)) is linear and therefore worse than O(log n). Indeed---though you see worst-case behavior only for carefully-chosen key sets (eg successive powers of 2). If the n values in an IntMap are, say, consecutive or nearly-consecutive, we obtain a log n bound. I suspect in practice most programmers will see logarithmic behavior. But even so, if your constant factors are k c, then k*n c*log n is perfectly possible for all n W, and therefore what matters in the real world here is the constant factors. The reason why is that for asymptotic purposes O(min(n,W)) and O(log n) belong to the same class of functions between constant and linear, so they're effectively the same (in asymptotic-land). The argument for constant-time IntMap performance is essentially similar to the following argument: There are balanced trees that provide an O(lg n) bound on tree depth for a tree containing n elements. Our computer has only k bits of address space and therefore the number of elements in any in-memory tree is O(k). Thus there is a constant (and smallish) upper bound on tree depth, O(lg k). Therefore every balanced tree implementation offers constant-time access. As you observe, it's really down to constant factors. The reason IntMap (or any digital trie) is so interesting is that it is simple enough that the constant factors are quite good---in particular we don't waste a lot of time figuring out if we're going to need to rearrange the tree structure on the fly. That turns out to amortize quite a few extra level traversals in a lot of settings. It also offers really elegant implementations of union and unions. Whether that means they're quickish I leave to the benchmarkers. -Jan-Willem Maessen -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Platform dependency hell
Kevin Jardine kevinjard...@yahoo.com writes: I have Haskell Platform 2010.1.0.0 installed under Windows and I often find that Haskell breaks if I try upgrading some of the current modules. For example, after using cabal to upgrade to the latest version of Network.CGI, I can no longer compile any code and instead get this message: cabal.exe: dependencies conflict: ghc-6.12.1 requires array ==0.3.0.1 however array-0.3.0.1 was excluded because ghc-6.12.1 requires array ==0.3.0.0 The only way I have found to fix this problem in the past has been to uninstall the Haskell Platform and start over. Can anyone tell me: a. why does this occur, and There are some packages that should not be upgraded; these are the libraries that come with GHC (with the exception of Cabal). These are commonly referred to as the _boot libraries_. b. what can I do to stop it from occurring again? Stop doing cabal upgrade foo, and instead do cabal install foo to upgrade individual packages (assuming foo isn't one of the boot libraries). Once you have done that, do ghc-pkg check to see which libraries are broken and then re-install them. Is it the case that the Haskell Platform is simply not upgradable and that I need to wait for the next release? I think there will be less breakage (or at least more manageable breakage) if you install/upgrade extra package in a user DB rather than the global DB. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hackage survey
Hello dear haskellers, I am working on OASIS-DB, a tool similar to Hackage and would like to have more information on how Haskellers use Hackage. I have setup a small poll (10 questions only) with the help of John Goerzen and Don Stewart. I will be very thankful that you answer this poll: http://polldaddy.com/s/2C49D15023CB88C6 I will share the data with the Haskell community, so that we will be able to make progress on Hackage and OASIS-DB. Cheers Sylvain Le Gall ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
Hello Andy, 2010/7/16 Andy Stewart lazycat.mana...@gmail.com: There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. For my 2008 GSOC application I wrote a demo app that used hot code reloading and it maintained gtk state just fine. The code (and video) is available at http://paczesiowa.dw.pl/ , it worked in ghc 6.8 and needed hs-plugins, so it won't work now, but the approach should work. regards, Bartek Ćwikłowski ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage survey
I'd like to request some clarification of some of the questions: 1. By all projects, are you including one-use only scripts? How about university assessments (when it isn't Haskell-oriented, just have to write a program to do some simulation or something) and thus it isn't meant to be something used by other people or used after a certain date, etc.? 3. I use cabal-install only in testing my own packages (as it's easier to do cabal foo than runhaskell Setup.hs foo). I also use cabal-install to test which packages I have installed have newer versions available (cabal update cabal upgrade --dry-run) so that I can update the Gentoo packages for them. As such, which option should I choose from the ones offered (as none of them match my case)? Should the question be clarified and be made more explicit? 9. I wouldn't classify Hackage as a tool, but even still, what happens if we think Hackage is very important but still should be replaced? (Playing devil's advocate here: I think it could do with some upgrades but there's no need to completely throw out what's already there). Sylvain Le Gall sylv...@le-gall.net writes: Hello dear haskellers, I am working on OASIS-DB, a tool similar to Hackage and would like to have more information on how Haskellers use Hackage. I have setup a small poll (10 questions only) with the help of John Goerzen and Don Stewart. I will be very thankful that you answer this poll: http://polldaddy.com/s/2C49D15023CB88C6 I will share the data with the Haskell community, so that we will be able to make progress on Hackage and OASIS-DB. Cheers Sylvain Le Gall ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
Bartek Ćwikłowski paczesi...@gmail.com writes: Hello Andy, 2010/7/16 Andy Stewart lazycat.mana...@gmail.com: There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. For my 2008 GSOC application I wrote a demo app that used hot code reloading and it maintained gtk state just fine. The code (and video) is available at http://paczesiowa.dw.pl/ , it worked in ghc 6.8 and needed hs-plugins, so it won't work now, but the approach should work. Wow, thanks for your hint, i will wait dons fix hs-plugins then try this cool feature.. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
Sorry Andy! CC'ing to the rest of -cafe in case anybody notices (I need to stop haskelling so early in the morning...) On Fri, Jul 16, 2010 at 8:59 AM, austin seipp a...@0xff.ath.cx wrote: You also may like one project I wrote, an IRC bot that used hs-plugins to do hot code reloading (only works on GHC 6.8.) Inspired by lambdabot, it could swap the entire running program as well as its own plugins, on the fly and maintain state pretty successfully. I haven't touched the source code in a long time - it was one of my first bigger Haskell projects after reading Dons paper about yi. I tried a bunch of things with various versions of it. If I wrote the code again today (providing plugins worked) it would likely be 1/10th the size and more manageable as I have become much better at Haskell, but oh well. Looking over it now though, most of the code is pretty simple. :) http://code.haskell.org/infinity/src/ On Fri, Jul 16, 2010 at 8:04 AM, Andy Stewart lazycat.mana...@gmail.com wrote: Bartek Ćwikłowski paczesi...@gmail.com writes: Hello Andy, 2010/7/16 Andy Stewart lazycat.mana...@gmail.com: There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. For my 2008 GSOC application I wrote a demo app that used hot code reloading and it maintained gtk state just fine. The code (and video) is available at http://paczesiowa.dw.pl/ , it worked in ghc 6.8 and needed hs-plugins, so it won't work now, but the approach should work. Wow, thanks for your hint, i will wait dons fix hs-plugins then try this cool feature.. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- - Austin -- - Austin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] trees and pointers
Jan-Willem Maessen wrote: As you observe, it's really down to constant factors. The reason IntMap (or any digital trie) is so interesting is that it is simple enough that the constant factors are quite good---in particular we don't waste a lot of time figuring out if we're going to need to rearrange the tree structure on the fly. That turns out to amortize quite a few extra level traversals in a lot of settings. This simplicity of not rebalancing also allows for more sharing in a persistent setting, which can be a big gain for programs with the right kinds of data distributions. It also offers really elegant implementations of union and unions. Whether that means they're quickish I leave to the benchmarkers. In my experience (NLP work), the performance of unions for tries is one of their major selling points. In Okasaki's venerable benchmarks[1], they vastly outperform all competitors for merging. Even in imperative-land, that's one of the reasons tries are so common in NLP and are often chosen over hashmaps for certain tasks. [1] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.37.5452 -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Hackage survey
Hello, On 16-07-2010, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: I'd like to request some clarification of some of the questions: 1. By all projects, are you including one-use only scripts? How about university assessments (when it isn't Haskell-oriented, just have to write a program to do some simulation or something) and thus it isn't meant to be something used by other people or used after a certain date, etc.? You can use cabal as a standalone build system generator. So you can use it also for unreleased projects. Using it this way shows that the tool cabal itself is useful. But you need to draw a line, so if you don't use it for one-use only scripts, I think you should still answer for all projects. But if you only use it for project that you intend to publish, you should answer Only for projects released on Hackage. 3. I use cabal-install only in testing my own packages (as it's easier to do cabal foo than runhaskell Setup.hs foo). I also use cabal-install to test which packages I have installed have newer versions available (cabal update cabal upgrade --dry-run) so that I can update the Gentoo packages for them. As such, which option should I choose from the ones offered (as none of them match my case)? Should the question be clarified and be made more explicit? Depending if you only use Gentoo Haskell package or not: - if you use only Gentoo packages: No, I only use packages from my Linux/Mac/Windows distribution - if you still have some packages installed from Cabal: I use cabal-install when my Linux/Mac/Windows distribution doesn't provide the package 9. I wouldn't classify Hackage as a tool, but even still, what happens if we think Hackage is very important but still should be replaced? (Playing devil's advocate here: I think it could do with some upgrades but there's no need to completely throw out what's already there). It depends how strong your feeling about Hackage is: - if you say damn it misses this or that each time you use Hackage: Hackage should be replaced by a better tool - if you only have minor problems and think it is an important tool: Hackage is a very important tool for the Haskell community Regards, Sylvain Le Gall ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lists of arbitrary depth
Chaddaï and Richard, Both your reply's helped me alot! It is so much different then imperative programming, and i say it as a good thing. I still have lots to learn, but its just like math, it looks so obvious when you see the solution, but entirely different when you have to face it yourself, another point of similarity with math, the more you practice, the better you get :) Richard, your definition of List_Or t made the coin drop in my head (since i knew almost nothing about datatypes), and I has managed to write a little flatten function for these nested lists. I am now trying to think how to make my solution nicer (hehe dont spoil it yet by showing me yours yet! :) ) You all have a great weekend, Vadali On Wed, Jul 14, 2010 at 12:09 PM, Chaddaï Fouché chaddai.fou...@gmail.comwrote: On Tue, Jul 13, 2010 at 11:28 AM, Shlomi Vaknin shlomivak...@gmail.com wrote: Thank you Bob, your example clarified how actually using such data type would appear in haskell. I naively thought it would be as simple as defining a regular list, but i see it is slightly more strict than that. I appreciate your help! Vadali Well it _is_ as simple as defining a regular list, which would be (fictionally since (:) and [] are reserved identifiers) : data [] a = [] | a : [a] Which is the same as : data List a = Empty | Cons a (List a) You can then handle lists with pattern matching : map f [] = [] map f (x:xs) = f x : map f xs Or for our List type : map f Empty = Empty map f (Cons x xs) = Cons (f x) (map f xs) His definition of a tree : data Tree a = Leaf | Branch a [Tree a] follows the same idea and is as easy to handle with pattern matching : treeMap f Leaf = Leaf treeMap f (Branch x xs) = Branch (f x) (map (treeMap f) xs) As you see, an user defined type is manipulated with the same mechanism as a primitive type, this uniformity is part of the power of Haskell in that it encourages users to create their types and allows seamless integration of external library types with primitive types. -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Docs on the current and future constraint solver?
On Thu, Jul 15, 2010 at 12:57 AM, Simon Peyton-Jones simo...@microsoft.com wrote: Corey | On 14 July 2010 18:39, Corey O'Connor coreyocon...@gmail.com wrote: | I believe I have run headlong into issue #3064 in ghc | (http://hackage.haskell.org/trac/ghc/ticket/3064). All I think I know | is this: | * this is a performance issue with the system used to solve type | constraints. | * the solver is undergoing an overhaul to resolve performance issues | in addition to other issues. | * An efficient constraint solver is difficult. NP-Complete in the general | case? It would be very helpful to have your code as a test case. Can you boil out a concrete program that demonstrates very poor performance of the type checker, and submit a Trac report? That way we'll test the new type inference engine against it. Lacking the example, we won't. Which is isn't a promise that we'll solve your problem -- but it's much easier to solve if we have a concrete example. Many thanks! Understood. I'll work on getting a nice, self-contained example. Cheers, Corey O'Connor ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Docs on the current and future constraint solver?
On Wed, Jul 14, 2010 at 4:42 PM, Thomas Schilling nomin...@googlemail.com wrote: This solver is currently being implemented in GHC (there's a branch on darcs.h.o), but correctness comes first. It'll probably take a while until this new solver becomes efficient. Is this the URL of the branch? http://darcs.haskell.org/ghc-new-tc/ghc/ Cheers, Corey O'Connor ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage survey
On Fri, Jul 16, 2010 at 5:51 AM, Sylvain Le Gall sylv...@le-gall.netwrote: Hello dear haskellers, I am working on OASIS-DB, a tool similar to Hackage and would like to have more information on how Haskellers use Hackage. I have setup a small poll (10 questions only) with the help of John Goerzen and Don Stewart. I'd like to suggest that OASIS-DB is not the best name for your project :) If I didn't know anything about it, I would assume it's a database engine or some sort of open access information system. Hackage works pretty well as a name because it sounds like package but has the h that comes across as implying some sort of hacking or haskell. I googled for oasis db and found lots of other things. So it seems to be a common name to pick. Here is a (non-exhaustive) set of criteria I would recommend trying to satisfy with a name for a project like this: * Not in common use already * Single word, easy to say, probably made up. * Implies something about packaging, distribution, programming * Optional: Implies harmony, community, activism, unity * Optional: Uses Camel in the name This wouldn't be very helpful as criticism if I didn't try to make some suggestions. So...here goes nothing :) * Camedly -- Camel + Medly * Cammunity -- Camel + Community (my google search showed this one might be a trademark) * Camlhood * Camlhub -- obviously stealing from github I'll stop there as I think you get my drift and my suggestions don't see so great so far :) It's a hard task, but one I would urge you to revisit. I hope you find my feedback useful. I think project names are important. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Design for 2010.2.x series Haskell Platform site
Hey all, As you might know, the next major release of the Haskell Platform is coming up next week. We've had the current download site design for a while now: http://haskell.org/platform/ However, I'm thinking it would be nice to have themed release designs. Examples: http://www.gnome.org/ GNOME 2.30 Ubuntu, http://www.ubuntu.com/ and so on. If anyone is interested in a 2010.2 series design for the HP site, the repository containing the stylesheet is here: http://code.haskell.org/haskell-platform/ And you can find the index.html and style.css in the download-website/ directory. We worked faily hard on the content, but feel free to play with the style. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
Generally, in Erlang or Haskell, the semantics we use is to keep all the old code in memory, for the case of closures and thunks that point back into that code. You can imagine a fine-grained semantics where as each top level function is no longer referenced, the *code* for that is swapped. I believe there have been versions of Erlang bytecode hotswapping that supported that. In GHC Haskell, we have component-level hotswapping -- only whole-modules may be swapped out at the moment. As we can't unload code based on the GC dropping references, we just keep it all in memory, migrating to new code as *new* (dynamic) bindings are introduced. The type migration issue is yet another problem. There are several approaches to migrating state types, including serialization (as xmonad et al do), or using open data types. -- Don nominolo: What would be the semantics of hot-swapping? For, example, somewhere in memory you have a thunk of expression e. Now the user wants to upgrade e to e'. Would you require all thunks to be modified? A similar problem occurs with stack frames. You'd also have to make sure that e and e' have the same (or compatible types). e' most likely has different free variables than e, how can you translate thunk one to the other? Now assuming you don't try to do this, how would you handle the case when something goes wrong? On 16 July 2010 04:05, Andy Stewart lazycat.mana...@gmail.com wrote: Hi all, I'm research to build a hot-swap Haskell program to developing itself in Runtime, like Emacs. Essentially, Yi/Xmonad/dyre solution is replace currently executing technology: re-compile new code with new binary entry when re-compile success $ do save state before re-launch new entry replace current entry with new binary entry (executeFile) store state after re-launch new entry There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. 2) Sometimes re-execute is un-acceptable, example, you running some command in temrinal before you re-compile, you need re-execute command to restore state after re-launch, in this situation re-execute command is un-acceptable. I wonder have a better way that hot-swapping new code without re-compile/reboot. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family Anatidae on our hands. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site
Hi Don, What's the ETA on getting the site wiki upgraded and to what version will it be? If we're looking at another couple of weeks I'll come up with a new wiki template this weekend to replace the current one. Regarding the Haskell Platform, maybe a summer theme is in order? Sunrise, here's a whole platform upgrade. Get it while it's hot, etc. Regarding the home page, I think we should involve more piccies of people active in the community at conferences and hackathons, etc. Seeing pictures of Haskellers is great. It tells everyone this language is busy and active, it motivates existing or budding Haskellers to contribute and get active, and it's easy to slap a picture up on the home page. code.haskell.org's going a bit slow -- hope we're not facing another weekend meltdown! Ciao! On 16 July 2010 20:09, Don Stewart d...@galois.com wrote: Hey all, As you might know, the next major release of the Haskell Platform is coming up next week. We've had the current download site design for a while now: http://haskell.org/platform/ However, I'm thinking it would be nice to have themed release designs. Examples: http://www.gnome.org/ GNOME 2.30 Ubuntu, http://www.ubuntu.com/ and so on. If anyone is interested in a 2010.2 series design for the HP site, the repository containing the stylesheet is here: http://code.haskell.org/haskell-platform/ And you can find the index.html and style.css in the download-website/ directory. We worked faily hard on the content, but feel free to play with the style. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Deprecated gtk2hs functions
I recently started playing around with gtk2hs. I noticed that `onClicked`, `afterClicked`, etc. functions have been deprecated, presumably in favor of the `on` and `after` functions in the Glib signals module, but I couldn't find a collection of the appropriate signals to replace the functionality. Am I simply being blind? -- Alex R ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site
chrisdone: Hi Don, What's the ETA on getting the site wiki upgraded and to what version will it be? If we're looking at another couple of weeks I'll come up with a new wiki template this weekend to replace the current one. For haskell.org? Thomas Schilling and Ian Lynagh are working on that (CC'd). Regarding the Haskell Platform, maybe a summer theme is in order? Sunrise, here's a whole platform upgrade. Get it while it's hot, etc. That's a great idea! :-) Regarding the home page, I think we should involve more piccies of people active in the community at conferences and hackathons, etc. Seeing pictures of Haskellers is great. It tells everyone this language is busy and active, it motivates existing or budding Haskellers to contribute and get active, and it's easy to slap a picture up on the home page. http://cufp.org is a bit like that now. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
On Fri, Jul 16, 2010 at 11:21 AM, Don Stewart d...@galois.com wrote: Generally, in Erlang or Haskell, the semantics we use is to keep all the old code in memory, for the case of closures and thunks that point back into that code. You can imagine a fine-grained semantics where as each top level function is no longer referenced, the *code* for that is swapped. I believe there have been versions of Erlang bytecode hotswapping that supported that. In GHC Haskell, we have component-level hotswapping -- only whole-modules may be swapped out at the moment. As we can't unload code based on the GC dropping references, we just keep it all in memory, migrating to new code as *new* (dynamic) bindings are introduced. The type migration issue is yet another problem. There are several approaches to migrating state types, including serialization (as xmonad et al do), or using open data types. Is hs-plugins working? I thought it was bit-rotted and needed reworking to function with modern ghc? I'm using the xmonad style static config, but I don't think it's very practical for a reason Andy didn't mention: linking is slow when a program gets big, so every little change takes a long time. xmonad gets away with it because it's tiny. I use hint to interpret code dynamically, but that makes the program even bigger and linking even longer, so it seems like to have my cake and eat it too I would need to be able to recompile a single module, and then dynamically link it into the running application. In my case, I don't think I need to worry about old closures or code migration because I would just be loading new functions to splice into an event loop that can only return data types defined in the main app. So it would be acceptable to swap a module by removing all the functions loaded from it, unloading and reloading the module, and splicing in the new list of functions it exports. I'm not sure how I could prove to a dynamic loading system that I'm holding no references to its code anymore and it can just unload it, but I suppose it would be the same as a C plugin system: if you return pointers to plugin code and stash them in the host, you will be in trouble when the module gets unloaded. I suppose that just means you have to rnf all the data coming out of the plugin before you unload it, right? Is this the sort of thing hs-plugins can do? The other thing I thought of was to use xmonad-style static config, but speed up the link by linking the larger parts dynamically. Isn't ghc supposed to support dynamic linking now? Or would it be just as slow because the time subtracted from the link phase would simply be added to the load phase? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deprecated gtk2hs functions
You mean something like buttonPressEvent [1]? on button buttonPressEvent You can define signals, the constructor is exposed. [1] http://www.haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Abstract-Widget.html#v%3AexposeEvent On Fri, Jul 16, 2010 at 11:36 AM, Alex Rozenshteyn rpglove...@gmail.com wrote: I recently started playing around with gtk2hs. I noticed that `onClicked`, `afterClicked`, etc. functions have been deprecated, presumably in favor of the `on` and `after` functions in the Glib signals module, but I couldn't find a collection of the appropriate signals to replace the functionality. Am I simply being blind? -- Alex R ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site
On 16 July 2010 20:37, Don Stewart d...@galois.com wrote: chrisdone: Regarding the Haskell Platform, maybe a summer theme is in order? Sunrise, here's a whole platform upgrade. Get it while it's hot, etc. That's a great idea! :-) Maybe you could work on a theme like this. Probably OTT. http://imgur.com/NjiVh Just an idea. My Inkscape-fu is weak. Here's one for a laugh: http://imgur.com/PQAgC I have ideas, I'm just not very good at executing them, haha. Probably a blue summer sky thing would fit better with the Haskell theme. Can someone with Photoshop make a shiny Haskell logo? I mean, literally shiny. Like the OS X logo. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site
chrisdone: On 16 July 2010 20:37, Don Stewart d...@galois.com wrote: chrisdone: Regarding the Haskell Platform, maybe a summer theme is in order? Sunrise, here's a whole platform upgrade. Get it while it's hot, etc. That's a great idea! :-) Maybe you could work on a theme like this. Probably OTT. http://imgur.com/NjiVh That is really nice, and clearly themed! -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] passing a polymorphic function as a parameter vs using it directly in a function definition
Thanks you all, now it makes sense. titto On 15 July 2010 17:52, Brent Yorgey byor...@seas.upenn.edu wrote: On Thu, Jul 15, 2010 at 01:20:11PM +0100, Pasqualino Titto Assini wrote: Many thanks for the explanation. But I thought that GHC always derives the most generic type, why does it fix my 'a' to 'Int' ? Note that this type evalAST2 :: forall a. (Expr a - IO()) - AST - IO () means that the type a has to be chosen first, i.e. by the *caller* of evalAST2. So evalAST2 is not free to use its argument k at whatever type it wants, it will be given a function of type (Expr T - IO()) for some type T that it didn't get to choose. Forcing the caller to provide a polymorphic function, so that evalAST2 can choose at what type(s) to use it, is exactly what is expressed by the rank-2 type evalAST2 :: (forall a. Expr a - IO()) - AST - IO () -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Pasqualino Titto Assini, Ph.D. http://quicquid.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Design for 2010.2.x series Haskell Platform site
Wow. I would instantly download anything that page cared to offer. :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site
On Fri, Jul 16, 2010 at 3:00 PM, Christopher Done chrisd...@googlemail.com wrote: Maybe you could work on a theme like this. Probably OTT. http://imgur.com/NjiVh Just an idea. My Inkscape-fu is weak. That looks great to me! I like blue, but I'd be in favor of a different color, like what you did, because blue is too common. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deprecated gtk2hs functions
More like buttonActivated [1]. Has it been decided that button-specific events are going to be deprecated in favor of their general widget equivalents, with buttonActivated being an (IMO) awkward title for buttonClicked? [1] http://www.haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Buttons-Button.html#v%3AbuttonActivated On Fri, Jul 16, 2010 at 3:20 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: You mean something like buttonPressEvent [1]? on button buttonPressEvent You can define signals, the constructor is exposed. [1] http://www.haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Abstract-Widget.html#v%3AexposeEvent On Fri, Jul 16, 2010 at 11:36 AM, Alex Rozenshteyn rpglove...@gmail.com wrote: I recently started playing around with gtk2hs. I noticed that `onClicked`, `afterClicked`, etc. functions have been deprecated, presumably in favor of the `on` and `after` functions in the Glib signals module, but I couldn't find a collection of the appropriate signals to replace the functionality. Am I simply being blind? -- Alex R ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alex R ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site
It would be great if the new design were compatible with the new wiki design ( http://lambda-haskell.galois.com/haskellwiki/ ). It doesn't have to be *that* similar, just compatible. On 16 July 2010 19:37, Don Stewart d...@galois.com wrote: chrisdone: Hi Don, What's the ETA on getting the site wiki upgraded and to what version will it be? If we're looking at another couple of weeks I'll come up with a new wiki template this weekend to replace the current one. For haskell.org? Thomas Schilling and Ian Lynagh are working on that (CC'd). Regarding the Haskell Platform, maybe a summer theme is in order? Sunrise, here's a whole platform upgrade. Get it while it's hot, etc. That's a great idea! :-) Regarding the home page, I think we should involve more piccies of people active in the community at conferences and hackathons, etc. Seeing pictures of Haskellers is great. It tells everyone this language is busy and active, it motivates existing or budding Haskellers to contribute and get active, and it's easy to slap a picture up on the home page. http://cufp.org is a bit like that now. -- Don ___ Haskell-platform mailing list haskell-platf...@projects.haskell.org http://projects.haskell.org/cgi-bin/mailman/listinfo/haskell-platform -- If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family Anatidae on our hands. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] in-equality type constraint?
Does anybody know why the type families only supports equality test like a ~ b, but not its negation? -- Regards, Paul Liu Yale Haskell Group http://www.haskell.org/yale ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] in-equality type constraint?
I was wondering this. I was recently able to write some code for negation of type equality, using the encoding Not p == p - forall a. a But it doesn't generalize; you need to create a witness of inequality for every pair of types you care about. {-# LANGUAGE RankNTypes, TypeFamillies, ExistentialQuantification #-} module NotEq where data TypeEqual a b = (a ~ b) = Refl newtype Void = Void { voidElim :: forall a. a } type Not p = (p - Void) data family IntVsBool a newtype instance IntVsBool Int = OK () newtype instance IntVsBool Bool = NotOK Void liftEq :: TypeEqual a b - TypeEqual (f a) (f b) liftEq Refl = Refl cast :: TypeEqual a b - a - b cast Refl = id int_neq_bool :: Not (TypeEqual Int Bool) int_neq_bool = \int_eq_bool - case (cast (liftEq int_eq_bool) (OK ())) of (NotOK v) - v On Fri, Jul 16, 2010 at 4:08 PM, Paul L nine...@gmail.com wrote: Does anybody know why the type families only supports equality test like a ~ b, but not its negation? -- Regards, Paul Liu Yale Haskell Group http://www.haskell.org/yale ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site
chrisdone: On 16 July 2010 20:37, Don Stewart d...@galois.com wrote: chrisdone: Regarding the Haskell Platform, maybe a summer theme is in order? Sunrise, here's a whole platform upgrade. Get it while it's hot, etc. That's a great idea! :-) Maybe you could work on a theme like this. Probably OTT. http://imgur.com/NjiVh Just an idea. My Inkscape-fu is weak. Here's one for a laugh: http://imgur.com/PQAgC I have ideas, I'm just not very good at executing them, haha. Probably a blue summer sky thing would fit better with the Haskell theme. Can someone with Photoshop make a shiny Haskell logo? I mean, literally shiny. Like the OS X logo. Here's a first cut in the repo with the new design converted to CSS http://code.haskell.org/haskell-platform/download-website/ If anyone would like to clean it up further, please send me patches to the style.css file or index.html. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] in-equality type constraint?
Paul L nine...@gmail.com writes: Does anybody know why the type families only supports equality test like a ~ b, but not its negation? At a guess, solely because no-one has implemented such functionality. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] in-equality type constraint?
On 07/17/2010 01:08 AM, Paul L wrote: Does anybody know why the type families only supports equality test like a ~ b, but not its negation? This has annoyed me, too. However, HList provides something quite similar, namely the TypeEq[1] fundep-ed class which will answer type-equality with a type-level boolean. (this is actually more powerful than a simple constraint, because it allows us to introduce type-level conditionals) To turn it into a predicate, you can use something like (disclaimer: untested) class C a b c where -- ... -- for some reason, we can provide an instance C a b [c] *except* for -- a ~ c. instance (TypeEq a c x, x ~ HFalse) = a b [c] where -- ... Best regards, Steffen [1] http://hackage.haskell.org/packages/archive/HList/0.2.3/doc/html/Data-HList-FakePrelude.html#t%3ATypeEq (Note that for it to work over all types, you have to import one of the Data.HList.TypeEqGeneric{1,2} modules) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Hot-Swap with Haskell
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/16/10 05:21 , Andy Stewart wrote: IMO, haskell interpreter is perfect solution for samll script job. But i'm afraid haskell interpreter is slow for *large code*, i don't know, i haven't try this way... Hugs? - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxA+sUACgkQIn7hlCsL25UztACgolMnZrrmeLMBtWl2GfGzvFjQ nGgAn3sCm8r4AZo4Ntr+wrsWsVL1fqrt =AKzA -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] in-equality type constraint?
HList certainly provides an alternative. But given the use of UndecidableInstances and OverlappingInstances, I was hoping that type families could come a little cleaner. Or does it not matter? On Fri, Jul 16, 2010 at 8:32 PM, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: On 07/17/2010 01:08 AM, Paul L wrote: Does anybody know why the type families only supports equality test like a ~ b, but not its negation? This has annoyed me, too. However, HList provides something quite similar, namely the TypeEq[1] fundep-ed class which will answer type-equality with a type-level boolean. (this is actually more powerful than a simple constraint, because it allows us to introduce type-level conditionals) To turn it into a predicate, you can use something like (disclaimer: untested) class C a b c where -- ... -- for some reason, we can provide an instance C a b [c] *except* for -- a ~ c. instance (TypeEq a c x, x ~ HFalse) = a b [c] where -- ... Best regards, Steffen [1] http://hackage.haskell.org/packages/archive/HList/0.2.3/doc/html/Data-HList-FakePrelude.html#t%3ATypeEq (Note that for it to work over all types, you have to import one of the Data.HList.TypeEqGeneric{1,2} modules) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu Yale Haskell Group http://www.haskell.org/yale ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] in-equality type constraint?
Does TypeEq a c HFalse imply proof of inequality, or unprovability of equality? On Sat, Jul 17, 2010 at 2:32 AM, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: On 07/17/2010 01:08 AM, Paul L wrote: Does anybody know why the type families only supports equality test like a ~ b, but not its negation? This has annoyed me, too. However, HList provides something quite similar, namely the TypeEq[1] fundep-ed class which will answer type-equality with a type-level boolean. (this is actually more powerful than a simple constraint, because it allows us to introduce type-level conditionals) To turn it into a predicate, you can use something like (disclaimer: untested) class C a b c where -- ... -- for some reason, we can provide an instance C a b [c] *except* for -- a ~ c. instance (TypeEq a c x, x ~ HFalse) = a b [c] where -- ... Best regards, Steffen [1] http://hackage.haskell.org/packages/archive/HList/0.2.3/doc/html/Data-HList-FakePrelude.html#t%3ATypeEq (Note that for it to work over all types, you have to import one of the Data.HList.TypeEqGeneric{1,2} modules) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Work is punishment for failing to procrastinate effectively. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] is this a bug ?
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=27631 The comments in the code explain the problem. If .Lazy be removed from the code (occurs three times), i.e., the code is changed to strict byte strings, it works as expected. Michael Mounteney. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] in-equality type constraint?
On Fri, 16 Jul 2010, Paul L wrote: Does anybody know why the type families only supports equality test like a ~ b, but not its negation? I would suggest that type equality is actually used for type inference, whereas proof of type inequality would have no consequence (that I can think of) for the compiler. Friendly, --Lane ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
lazycat, You may find the following link useful, as it talks about much the same approach. http://nathanwiegand.com/wp/2010/02/hot-swapping-binaries/ Sadly, any hot-swap mechanism is going to suffer from the potential loss of state where that state is not controlled by your code. When that loss of state isn't acceptable you have a few mechanisms available. By far the easiest, I think, in the gtk2hs scenario you mention is that you could refactor all of the code that interoperated with gtk2hs into another process and spawn it, communicating with it over a pipe or other communication mechanism. That way hot-swapping the current process would leave your GUI (and the pipe/IPC mechanism) intact. You may then need to pass along whatever changes affect the gui over the pipe in a fairly manual fashion. -Edward Kmett On Thu, Jul 15, 2010 at 11:05 PM, Andy Stewart lazycat.mana...@gmail.comwrote: Hi all, I'm research to build a hot-swap Haskell program to developing itself in Runtime, like Emacs. Essentially, Yi/Xmonad/dyre solution is replace currently executing technology: re-compile new code with new binary entry when re-compile success $ do save state before re-launch new entry replace current entry with new binary entry (executeFile) store state after re-launch new entry There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. 2) Sometimes re-execute is un-acceptable, example, you running some command in temrinal before you re-compile, you need re-execute command to restore state after re-launch, in this situation re-execute command is un-acceptable. I wonder have a better way that hot-swapping new code without re-compile/reboot. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] unusual behavior from cabal
Not sure what the correct list is for this observation. I was trying to install gitit, and here is what happened. mich...@michael:~/haskell/blog-example$ cabal install gitit Resolving dependencies... cabal: dependencies conflict: happstack-server-0.5.1 requires time ==1.1.4 however time-1.1.4 was excluded because happstack-server-0.5.1 requires time ==1.2.0.3 huh? Cabal seems to think happstack-server-0.5.1 has two conflicting requirements. How do I suss this out? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: lambda calculus and equational logic
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/15/10 23:31 , wren ng thornton wrote: Issues of inconsistency also show up in reasoning about language-based security systems where sometimes we may wish to allow inconsistent states during computation so long as there is a formal guarantee that consistency is restored soon. But overall, the question of what it means to reason formally and correctly in the face of an inconsistent system is still an open question. Hm. Do databases provide any useful insights here? I'm thinking that the above sounds a lot like an uncommitted transaction. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxBH4QACgkQIn7hlCsL25V5mwCghnH2So1voCGAhnregwNb6hb/ wu8AoIMJpbFGAxtYD6hYFj5QVkli9/bs =x8pe -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] is this a bug ?
On Sat 17/07/10 04:17 , Alexander Solla a...@2piix.com sent: Why are you performing unsafe IO actions? They don't play nice with laziness. OK, fair cop, but without the unsafe IO action, it still misbehaves. http://hpaste.org/fastcgi/hpaste.fcgi/view?id=27650 Michael. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] is this a bug ?
You should probably CC the maintainer of the regex package. Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unusual behavior from cabal
Michael Litchard mich...@schmong.org writes: Not sure what the correct list is for this observation. I was trying to install gitit, and here is what happened. mich...@michael:~/haskell/blog-example$ cabal install gitit Resolving dependencies... cabal: dependencies conflict: happstack-server-0.5.1 requires time ==1.1.4 however time-1.1.4 was excluded because happstack-server-0.5.1 requires time ==1.2.0.3 huh? Cabal seems to think happstack-server-0.5.1 has two conflicting requirements. How do I suss this out? cabal install gitit --dry-run --verbose=3 I'm guessing that the problems is that you have two different dependencies of happstack-server installed with two different versions of time (or else two installs of happstack-server...). -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe