Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 14:10, Bas van Dijk v.dijk@gmail.com wrote: I haven't implemented asynchronous transfers yet that actually transfer user data... And now I have: asynchronously implemented readControl and writeControl: https://github.com/basvandijk/usb/blob/async/System/USB/Internal.hs

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 17:04, Johan Tibell johan.tib...@gmail.com wrote: On Tue, Apr 19, 2011 at 10:36 PM, Bas van Dijk v.dijk@gmail.com wrote: On 19 April 2011 15:06, John Obbele john.obb...@gmail.com wrote:        -- Step 3 is the most important step. Submitting the transfer

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 17:55, Johan Tibell johan.tib...@gmail.com wrote: On Wed, Apr 20, 2011 at 5:22 PM, Bas van Dijk v.dijk@gmail.com wrote: On 20 April 2011 17:04, Johan Tibell johan.tib...@gmail.com wrote: Not that evtRead and evtWrite maps to different things on different platforms. Do

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 18:34, Johan Tibell johan.tib...@gmail.com wrote: On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk v.dijk@gmail.com wrote: I still need to add appropriate conditions for checking whether the program is using the threaded RTS. What is the recommended approach for this? I see

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 20:27, Bas van Dijk v.dijk@gmail.com wrote: On 20 April 2011 18:34, Johan Tibell johan.tib...@gmail.com wrote: On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk v.dijk@gmail.com wrote: I still need to add appropriate conditions for checking whether the program is using

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-19 Thread Bas van Dijk
On 19 April 2011 15:06, John Obbele john.obb...@gmail.com wrote: I'm trying to implement an asynchronous interface to libusb, re-using the raw bindings-usb (by Maurício C. Antunes) and partially copying what can be found in the (great but synchronous-only) usb package (from Bas van Dijk

Re: C-- source highlighting using source-highlight

2011-04-15 Thread Bas van Dijk
On 14 April 2011 17:04, Johan Tibell johan.tib...@gmail.com wrote: I've thrown together a small source-highlight language file for C--. You can use it to e.g. highlight C-- code when piped through less. Nice! It would also be nice to have highlighted C-- output in ghc-core[1] too! Bas [1]

Re: [Haskell-cafe] erratic behavior for System.Time.diffClockTimes

2011-04-08 Thread Bas van Dijk
On 8 April 2011 22:48, Warren Harris warrensomeb...@gmail.com wrote: I'm trying out GHC-7.0.3-x86_64 for Mac OS X and see what seems to be a bug in System.Time.diffClockTimes. The TimeDiff tdPicosec field returns values that seem to jump around erratically Strange. This doesn't happen on my

Re: [Colin Paul Adams] Re: Proposal: Define UTF-8 to be the encoding of Haskell source files

2011-04-06 Thread Bas van Dijk
On 6 April 2011 17:34, Colin Paul Adams co...@colina.demon.co.uk wrote: I forgot to CC the list: Roel == Roel van Dijk vandijk.r...@gmail.com writes:    Roel I propose to make UTF-8 the only allowed encoding for Haskell    Roel source files. Implementations must discard an initial Byte    

[Haskell-cafe] Fast conversion between Vector Double and Vector CDouble

2011-04-04 Thread Bas van Dijk
Hello, I just rewrote my levmar library[1] to use Vectors (from the vector package[2]) instead of lists. I was expecting to see a significant performance improvement. Unfortunately I only saw a 10% improvement. However, I noticed I had a lot of conversions from Vector Double to Vector CDouble and

Re: [Haskell-cafe] Fast conversion between Vector Double and Vector CDouble

2011-04-04 Thread Bas van Dijk
On 4 April 2011 14:41, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Monday 04 April 2011 13:54:39, Bas van Dijk wrote: Hello, I just rewrote my levmar library[1] to use Vectors (from the vector package[2]) instead of lists. I was expecting to see a significant performance

Re: [Haskell-cafe] Using _ on the RHS of an equation?

2011-04-04 Thread Bas van Dijk
On 4 April 2011 22:42, Jason Dagit dag...@gmail.com wrote: Is this something people would be interested in having as an extension in GHC?  Or is it just too fluffy for anyone to really care? I wish for having ⊥ available as 'undefined' without needing to write it between parenthesis (currently

Re: [Haskell-cafe] using IO monad in Iteratee

2011-04-02 Thread Bas van Dijk
On 1 April 2011 21:59, Dmitry Olshansky olshansk...@gmail.com wrote: Is it possible to change enumFile to using MonadIO class? No because it uses the control operation Control.Exception.finally :: IO a - IO b - IO a internally. You can't lift control operations with liftIO :: MonadIO m = IO a -

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Bas van Dijk
On 30 March 2011 18:07, Michael Snoyman mich...@snoyman.com wrote: On Wed, Mar 30, 2011 at 9:26 AM, Jason Dagit dag...@gmail.com wrote: On Tue, Mar 29, 2011 at 11:52 PM, Michael Snoyman mich...@snoyman.com wrote: Hi all, I think this is a well-known issue: it seems that there is no

Fix context reduction stack overflow in dimensional

2011-03-29 Thread Bas van Dijk
Dear Bjorn, Attached is a patch that fixes a context reduction stack overflow in your dimensional package. I noticed something weird though (that's why I'm CCing the ghc list). When I cabal build dimensional-0.8.2 I first get the context reduction stack overflow when I then build it again I get

Re: [Haskell-cafe] STM, newArray, and a stack overflow?

2011-03-23 Thread Bas van Dijk
On 23 March 2011 13:35, Ketil Malde ke...@malde.org wrote: I'm seeing some weirdness here.  My code does this:    omap - atomically $ (newArray_ (0,n-1) :: STM (TArray Int Int)) This gives a stack overflow when n is one million. I can't reproduce this with ghci-7.0.2 (base-4.3.1.0,

Re: [Haskell-cafe] STM, newArray, and a stack overflow?

2011-03-23 Thread Bas van Dijk
On 23 March 2011 17:19, Jake McArthur jake.mcart...@gmail.com wrote: On 03/23/2011 10:34 AM, Ketil Malde wrote: It works (calling the same function) from GHCi, but breaks when compiled.  Also when compiling with -O0. Confirmed for GHC 7.0.2. Works fine in GHCi, but compiling it (in my case,

Re: [Haskell-cafe] STM, newArray, and a stack overflow?

2011-03-23 Thread Bas van Dijk
On 23 March 2011 18:42, Bas van Dijk v.dijk@gmail.com wrote: On 23 March 2011 17:19, Jake McArthur jake.mcart...@gmail.com wrote: On 03/23/2011 10:34 AM, Ketil Malde wrote: It works (calling the same function) from GHCi, but breaks when compiled.  Also when compiling with -O0. Confirmed

Re: [Haskell-cafe] STM, newArray, and a stack overflow?

2011-03-23 Thread Bas van Dijk
I fixed the bug in the newArray method of a TArray: http://hackage.haskell.org/trac/ghc/ticket/5042 Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] STM, newArray, and a stack overflow?

2011-03-23 Thread Bas van Dijk
On 23 March 2011 21:07, Ketil Malde ke...@malde.org wrote: Shouldn't it be possible to create an array in a loop with only constant memory overhead? I think it should. Maybe we need something like this: unsafeArrayM :: Ix i = (i, i) - Int - IO e - IO (Array i e) unsafeArrayM (l,u) n@(I# n#)

Re: [Haskell-cafe] STM, newArray, and a stack overflow?

2011-03-23 Thread Bas van Dijk
On 24 March 2011 01:22, Bas van Dijk v.dijk@gmail.com wrote: The given IO computation can then be something like: unsafeIOToSTM $ newTVar e. Oops I meant: unsafeSTMToIO $ newTVar e where unsafeSTMToIO :: STM a - IO a unsafeSTMToIO (STM m) = IO m

Re: 7.0.3

2011-03-17 Thread Bas van Dijk
On 15 March 2011 18:04, Ian Lynagh ig...@earth.li wrote: We want to keep the changes in this release to a minimum, to minimise the chance of regressions, but if you think we've missed any critical issues please let us know. Absolutely not critical but it would be nice if you could merge my

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Bas van Dijk
On 16 March 2011 11:31, Andrew Coppin andrewcop...@btinternet.com wrote: The well-known ST monad uses an ingenious hack to make it impossible for distinct ST computations to interact with each other. Is there a way to do something similar so that I can create cursors that reference a

Re: [Haskell-cafe] ContT and ST stack

2011-03-11 Thread Bas van Dijk
On 11 March 2011 11:15, Max Bolingbroke batterseapo...@hotmail.com wrote: On 10 March 2011 17:55, Bas van Dijk v.dijk@gmail.com wrote: On 10 March 2011 18:24, Yves Parès limestr...@gmail.com wrote: Why has the operator (.) troubles with a type like (forall s. ST s a)? Why can't it match

Re: [Haskell-cafe] ContT and ST stack

2011-03-11 Thread Bas van Dijk
On 11 March 2011 12:04, Bas van Dijk v.dijk@gmail.com wrote: Unfortunately foo still doesn't type check in 7.0.2: foo :: (forall s. ST s a) - a foo st = ($) runST st Note that the following does type check with ImpredicativeTypes: bar = id runST Bas

Re: [Haskell] ANN: Updates in the monadic regions family

2011-03-10 Thread Bas van Dijk
In regions-0.9 I removed support for forking threads because it allowed you to use a closed handle in a forked thread. Unfortunately I just realized that it's still possible to fork threads in a region. The reason is that I've derived a MonadControlIO instance for RegionT which enables you to use

Re: [Haskell-cafe] Automated tests with cabal

2011-03-10 Thread Bas van Dijk
On 10 March 2011 08:12, Hauschild, Klaus (EXT) klaus.hauschild@siemens.com wrote: Hi Haskellers, I read about the cabal features for running test code from Setup.hs with defaultMainWithHooks. I'm looking for more generic code that allows me to place any haskell in a subdirectory test or

Re: [Haskell-cafe] ANN: Updates in the monadic regions family

2011-03-10 Thread Bas van Dijk
In regions-0.9 I removed support for forking threads because it allowed you to use a closed handle in a forked thread. Unfortunately I just realized that it's still possible to fork threads in a region. The reason is that I've derived a MonadControlIO instance for RegionT which enables you to use

Re: [Haskell-cafe] ContT and ST stack

2011-03-10 Thread Bas van Dijk
On 10 March 2011 14:47, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: If memory serves correctly, it's impredicative polymorphism. Indeed. For example the following also doesn't type check in GHC-7: foo :: (forall s. ST s a) - a foo st = ($) runST st Surprisingly the following does:

Re: [Haskell-cafe] ContT and ST stack

2011-03-10 Thread Bas van Dijk
On 10 March 2011 18:24, Yves Parès limestr...@gmail.com wrote: Why has the operator (.) troubles with a type like (forall s. ST s a)? Why can't it match the type 'b' in (.) definition? As explained by the email from SPJ that I linked to, instantiating a type variable (like 'b') with a

Re: [Haskell-cafe] Why don't my OS threads terminate?

2011-03-10 Thread Bas van Dijk
On 10 March 2011 18:11, Simon Marlow marlo...@gmail.com wrote: On 28/02/11 15:59, Bas van Dijk wrote: On 25 February 2011 19:10, Bas van Dijkv.dijk@gmail.com  wrote: On 25 February 2011 18:27, sclvs.clo...@gmail.com  wrote: Bas van Dijk-2 wrote: I believe the OS threads are created

[Haskell] ANN: Updates in the monadic regions family

2011-03-09 Thread Bas van Dijk
Dear all, I released new versions of some of my packages. Here are the changelogs: http://hackage.haskell.org/package/regions-0.9 http://hackage.haskell.org/package/regions-mtl-0.3.1.5 http://hackage.haskell.org/package/regions-monadstf-0.3.1.5 * Switch from monad-peel to monad-control. *

[Haskell-cafe] ANN: Updates in the monadic regions family

2011-03-09 Thread Bas van Dijk
Dear all, I released new versions of some of my packages. Here are the changelogs: http://hackage.haskell.org/package/regions-0.9 http://hackage.haskell.org/package/regions-mtl-0.3.1.5 http://hackage.haskell.org/package/regions-monadstf-0.3.1.5 * Switch from monad-peel to monad-control. *

Re: [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread Bas van Dijk
On 7 March 2011 02:28, Trystan Spangler trysta...@comcast.net wrote: Announcing Silently, a package with two simple functions to run an IO action while preventing it from writing to stdout (or the given handle) Useful package! I tiny remark about the code: -- | Run an IO action while ignoring

Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-07 Thread Bas van Dijk
Sterling, Gregory, Brandon and David thanks for your suggestions. On 6 March 2011 05:38, David Anderson d...@natulte.net wrote: I humbly recommend doing such daemonizations from outside your program. Programs that daemonize on startup make it very difficult to monitor them by direct means,

[Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-05 Thread Bas van Dijk
Hello, I like to turn my Haskell program into a unix daemon. One of the steps in daemonizing a process is to fork it then exit the parent and continue with the child. All this is nicely abstracted in hdaemonize[1] which internally calls forkProcess[2]. I would also like to use multiple

Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-05 Thread Bas van Dijk
On 5 March 2011 21:43, Donn Cave d...@avvanta.com wrote: Quoth Bas van Dijk v.dijk@gmail.com, ... I understand why it's problematic to fork a process which is in the middle of running multiple simultaneous threads. However, in the case of a daemon the fork happens in the beginning

Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-05 Thread Bas van Dijk
On 5 March 2011 21:51, Vincent Hanquez t...@snarc.org wrote: On Sat, Mar 05, 2011 at 08:51:59PM +0100, Bas van Dijk wrote: Hello, I like to turn my Haskell program into a unix daemon. One of the steps in daemonizing a process is to fork it then exit the parent and continue with the child

Re: [Haskell-cafe] Convert a function to a string of operators?

2011-03-04 Thread Bas van Dijk
On 4 March 2011 22:10, Job Vranish job.vran...@gmail.com wrote: Make your own expression type and make it an instance of the Num typeclass. This is also the approach I took in repr: http://hackage.haskell.org/package/repr For example: $ cabal install repr $ ghci import Text.Repr let r = 1.5

Re: [Haskell-cafe] Why don't my OS threads terminate?

2011-02-28 Thread Bas van Dijk
On 25 February 2011 19:10, Bas van Dijk v.dijk@gmail.com wrote: On 25 February 2011 18:27, sclv s.clo...@gmail.com wrote: Bas van Dijk-2 wrote: I believe the OS threads are created by my levmar library. This library uses bindings-levmar[4] which is a binding to a C library. bindings

Re: [Haskell-cafe] Rebindable 'let' for observable sharing?

2011-02-28 Thread Bas van Dijk
On 28 February 2011 10:38, Henning Thielemann lemm...@henning-thielemann.de wrote: Now that almost every syntax can be redirected to custom functions (RebindableSyntax, OverloadedStrings), would it make sense to map 'let' to 'fix' ? For the record: are you talking about rewriting: let f = e

[Haskell-cafe] Why don't my OS threads terminate?

2011-02-25 Thread Bas van Dijk
Dear all, At work, I'm developing a webapplication with happstack. When I let it run for some time ( 5min.) it crashes with the following message: failed to create OS thread: Resource temporarily unavailable This happens because the server continuously creates OS threads but never terminates

Re: [Haskell-cafe] Why don't my OS threads terminate?

2011-02-25 Thread Bas van Dijk
On 25 February 2011 18:27, sclv s.clo...@gmail.com wrote: Bas van Dijk-2 wrote: I believe the OS threads are created by my levmar library. This library uses bindings-levmar[4] which is a binding to a C library. bindings-levmar uses safe FFI calls because the levmar C procedures

Re: [Haskell-cafe] best way to deal with #defines when developing ffi's

2011-02-23 Thread Bas van Dijk
On 23 February 2011 06:47, bri...@aracnet.com wrote: Hi all, I'm working on an FFI and as usual there are lots of defines in the header files. What's the best way to make these available to the haskell code ? Ideally it could be done automagically, or at least pseudo-magically so that

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-22 Thread Bas van Dijk
On 22 February 2011 03:10, Johan Tibell johan.tib...@gmail.com wrote: On Mon, Feb 21, 2011 at 3:16 PM, Bas van Dijk v.dijk@gmail.com wrote: On 21 February 2011 21:55, Johan Tibell johan.tib...@gmail.com wrote: ...include TimeoutKey in the TimeoutCallback type. Done: http

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-22 Thread Bas van Dijk
On 22 February 2011 17:06, Johan Tibell johan.tib...@gmail.com wrote: On Tue, Feb 22, 2011 at 2:46 AM, Bas van Dijk v.dijk@gmail.com wrote: Ok, I will apply it this evening. Excellent. Thanks for working on this. Done: http://hackage.haskell.org/trac/ghc/attachment/ticket/4963

Re: ANNOUNCE: GHC 7.0.2 Release Candidate 2

2011-02-21 Thread Bas van Dijk
On 20 February 2011 22:16, Ian Lynagh ig...@earth.li wrote: We are pleased to announce the second release candidate for GHC 7.0.2 Congratulations! I may have found a bug (not sure if it's in ghc or cabal): $ cabal install unix-compat Resolving dependencies... Configuring unix-compat-0.2.1.1...

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-21 Thread Bas van Dijk
On 19 February 2011 00:04, Bas van Dijk v.dijk@gmail.com wrote: So, since the new implementation is not really faster in a representative benchmark and above all is buggy, I'm planning to ditch it in favour of the event-manager based timeout. The patch is ready for review: http

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-21 Thread Bas van Dijk
On 21 February 2011 21:55, Johan Tibell johan.tib...@gmail.com wrote: ...include TimeoutKey in the TimeoutCallback type. Done: http://hackage.haskell.org/trac/ghc/attachment/ticket/4963/faster_timeout.dpatch Thanks, Bas ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-21 Thread Bas van Dijk
On 21 February 2011 22:11, Job Vranish job.vran...@gmail.com wrote: I'm curious, is it possible that your new timeout implementation would fix this problem?: doesntWork :: Int - Int doesntWork x = last $ cycle [x] test :: IO (Maybe Bool) test = timeout 1 $ evaluate $ doesntWork 5 == 5 --

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-18 Thread Bas van Dijk
On 18 February 2011 01:05, Johan Tibell johan.tib...@gmail.com wrote: On Thu, Feb 17, 2011 at 5:01 PM, Bas van Dijk v.dijk@gmail.com wrote: willTimeout/old         24.34945 us    1.0 x willTimeout/new         26.91964 us    0.9 x (large std dev: 5 us) willTimeout/event       12.94273 us

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-18 Thread Bas van Dijk
I have some more results: The willTimeout and wontTimeout benchmarks are a bit unfair: willTimeout = shouldTimeout$ timeout 1 (threadDelay oneSec) wontTimeout = shouldNotTimeout $ timeout oneSec (return ()) Nobody ever writes code like this. So I wrote some benchmarks that hopefully

Re: [Haskell-cafe] linear and dependent types

2011-02-18 Thread Bas van Dijk
On 18 February 2011 20:04, Vasili I. Galchin vigalc...@gmail.com wrote:    Does Haskell currently have support for linear types and dependent types? If so, is it necessary to specify a pragma to use and if so, what is the pragma(s)? While Haskell doesn't have full dependent types, as found

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-17 Thread Bas van Dijk
On 17 February 2011 13:09, Simon Marlow marlo...@gmail.com wrote: uninterruptibleMask is quite unsavoury, Agreed, that's why I called this implementation fragile because it relies on the, not well known semantics, of interruptible operations. I don't think we should use it here. I agree that

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-17 Thread Bas van Dijk
On 17 February 2011 20:34, Bas van Dijk v.dijk@gmail.com wrote: Speaking of Uniques: what is the best way to create them? I see 3 options: There may be a 4th option but it requires changing the System.Event.Manager.registerTimeout function from: registerTimeout :: EventManager

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-17 Thread Bas van Dijk
On 18 February 2011 00:56, Johan Tibell johan.tib...@gmail.com wrote: On Thu, Feb 17, 2011 at 2:43 PM, Bryan O'Sullivan b...@serpentine.com wrote: On Thu, Feb 17, 2011 at 11:53 AM, Bas van Dijk v.dijk@gmail.com wrote: Then we can use the TimeoutKey as our Unique (Note that a TimeoutKey

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-17 Thread Bas van Dijk
On 18 February 2011 01:16, Johan Tibell johan.tib...@gmail.com wrote: On Thu, Feb 17, 2011 at 4:09 PM, Bas van Dijk v.dijk@gmail.com wrote: Currently I created a new function registerTimeoutWithKey and wrote registerTimeout in terms of it. I also exported registerTimeoutWithKey from

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-17 Thread Bas van Dijk
On 18 February 2011 01:28, Johan Tibell johan.tib...@gmail.com wrote: On Thu, Feb 17, 2011 at 4:19 PM, Bas van Dijk v.dijk@gmail.com wrote: Why is it not public? It is listed in the base API docs: http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-Event.html Because

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-17 Thread Bas van Dijk
On 18 February 2011 01:09, Bas van Dijk v.dijk@gmail.com wrote: Benchmarks are coming... Here are some preliminary benchmarks. I used the latest GHC HEAD (7.1.20110217) build for performance. Because I wanted to finish the build of ghc before I went to bed I used a faster machine than my

[Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
Dear all, I wrote a faster implementation for System.Timeout.timeout but wonder whether it's correct. It would be great if someone can review the code. The implementation comes with a tiny Criterion benchmark: darcs get http://bifunctor.homelinux.net/~bas/bench_timeouts/ On ghc-7.0.1 with -O2

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
I just submitted a patch for base: http://hackage.haskell.org/trac/ghc/ticket/4963 Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
I made a slight modification and now it runs 16 times faster than the original: timeout :: Int - IO a - IO (Maybe a) timeout n f | n 0= fmap Just f | n == 0= return Nothing | otherwise = do myTid - myThreadId timeoutEx - fmap Timeout newUnique

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
I realized that the previous timeout had problems when called in a masked thread. What happens is that the call to killThread will block because it can't throw the KillThread exception to the timeout thread because that thread is masked. I have to use unsafeUnmask to always unmask the timeout

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
On 16 February 2011 20:26, Bas van Dijk v.dijk@gmail.com wrote: The patch and benchmarks attached to the ticket are updated. Hopefully this is the last change I had to make so I can stop spamming. And the spamming continues... I started working on a hopefully even more efficient timeout

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
On 17 February 2011 00:46, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Wed, Feb 16, 2011 at 9:27 PM, Bas van Dijk v.dijk@gmail.com wrote: I started working on a hopefully even more efficient timeout that uses the new GHC event manager. The idea is that instead of forking

[Haskell] ANN: monad-control-0.2 a challenge

2011-02-09 Thread Bas van Dijk
Dear all, I just released control-monad-0.2 a library for lifting control operations, like exception catching, through monad transformers: http://hackage.haskell.org/package/monad-control-0.2 darcs get http://bifunctor.homelinux.net/~bas/monad-control/ To quote the NEWS file: * Use RunInBase

[Haskell-cafe] ANN: monad-control-0.2 a challenge

2011-02-09 Thread Bas van Dijk
Dear all, I just released control-monad-0.2 a library for lifting control operations, like exception catching, through monad transformers: http://hackage.haskell.org/package/monad-control-0.2 darcs get http://bifunctor.homelinux.net/~bas/monad-control/ To quote the NEWS file: * Use RunInBase

Re: [Haskell-cafe] Synthetic values?

2011-02-09 Thread Bas van Dijk
On 9 February 2011 19:33, Alexey Khudyakov alexey.sklad...@gmail.com wrote: On 09.02.2011 20:57, Chris Smith wrote: On Wed, 2011-02-09 at 18:15 +0100, Cristiano Paris wrote: I've a type problem that I cannot solve and, before I keep banging my head against an unbreakable wall, I'd like to

Re: [Haskell-cafe] [Haskell] ANN: case-insensitive-0.1

2011-02-07 Thread Bas van Dijk
On 7 February 2011 15:26, Max Rabkin max.rab...@gmail.com wrote: This could be a useful package but can you add a note that this does not do correct Unicode-aware comparison on String (though AFAICT it is correct for Text)? Good point! I just released version 0.2:

[Haskell] ANN: monad-control-0.1

2011-02-06 Thread Bas van Dijk
Dear all, Several attempts have been made to lift control operations (functions that use monadic actions as input instead of just output) through monad transformers: MonadCatchIO-transformers[1] provided a type class that allowed to overload some often used control operations (catch, block and

[Haskell] ANN: case-insensitive-0.1

2011-02-06 Thread Bas van Dijk
Dear all, I had this old module laying around that I wrote some time ago. I dusted it off and uploaded it to Hackage: http://hackage.haskell.org/package/case-insensitive-0.1 The package provides the module Data.CaseInsensitive which exports the CI type constructor which can be parameterised by

[Haskell-cafe] ANN: monad-control-0.1

2011-02-06 Thread Bas van Dijk
Dear all, Several attempts have been made to lift control operations (functions that use monadic actions as input instead of just output) through monad transformers: MonadCatchIO-transformers[1] provided a type class that allowed to overload some often used control operations (catch, block and

[Haskell-cafe] ANN: case-insensitive-0.1

2011-02-06 Thread Bas van Dijk
Dear all, I had this old module laying around that I wrote some time ago. I dusted it off and uploaded it to Hackage: http://hackage.haskell.org/package/case-insensitive-0.1 The package provides the module Data.CaseInsensitive which exports the CI type constructor which can be parameterised by

Re: [Haskell-cafe] 3GB allocation, 75% CPU usage from a callback function

2011-01-29 Thread Bas van Dijk
On 29 January 2011 18:22, Neil Brown nc...@kent.ac.uk wrote: ...you were also using an extra readIORef as part of the modifyIORef that you didn't need... Indeed and writing the t+1 strictly to the ioref also makes it slightly faster (~2%): writeIORef ioref $! t+1 Bas

Re: [Haskell-cafe] source line annotations

2011-01-20 Thread Bas van Dijk
On 20 January 2011 10:48, Evan Laforge qdun...@gmail.com wrote: I still like the pragma... Maybe Template Haskell can help: module Location where import Language.Haskell.TH import Data.Functor (($)) loc :: Q Exp loc = LitE . StringL . show . loc_start $ location {-# LANGUAGE

Re: [Haskell-cafe] source line annotations

2011-01-20 Thread Bas van Dijk
On 20 January 2011 14:33, Bas van Dijk v.dijk@gmail.com wrote: On 20 January 2011 10:48, Evan Laforge qdun...@gmail.com wrote: I still like the pragma... Maybe Template Haskell can help: module Location where import Language.Haskell.TH import Data.Functor (($)) loc :: Q Exp loc

Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-19 Thread Bas van Dijk
On 17 January 2011 21:50, Jeremy Shaw jer...@n-heptane.com wrote: On Jan 17, 2011, at 2:19 PM, Corentin Dupont wrote: Indeed, I tried with META HTTP-EQUIV=Refresh CONTENT=n ? and it's unusable. It make blink the page, ungrey the stop button for a second and make the fields loose the focus

Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-19 Thread Bas van Dijk
On 19 January 2011 15:02, Corentin Dupont corentin.dup...@gmail.com wrote: Is what you explained feasible on the user's side of happstack-server (I mean, if I can do it myself)? Yes, you can do it yourself. If I take an empty MVar in my ServerPartTs, which are read over client's request, I

Re: Some patches for GHC

2011-01-05 Thread Bas van Dijk
On Fri, Dec 31, 2010 at 8:04 PM, Ian Lynagh ig...@earth.li wrote: On Wed, Dec 22, 2010 at 02:02:18PM +0100, Bas van Dijk wrote: I was just wondering if somebody could review (and hopefully apply) some of or all the patches in: http://hackage.haskell.org/trac/ghc/attachment/ticket/4834

Re: ANNOUNCE: GHC 7.0.2 Release Candidate 1

2010-12-26 Thread Bas van Dijk
On Thu, Dec 16, 2010 at 7:36 PM, Ian Lynagh ig...@earth.li wrote: We are pleased to announce the first release candidate for GHC 7.0.2:    http://www.haskell.org/ghc/dist/7.0.2-rc1/ This includes the source tarball, installers for OS X and Windows, and bindists for amd64/Linux, i386/Linux,

Some patches for GHC

2010-12-22 Thread Bas van Dijk
Hello, I was just wondering if somebody could review (and hopefully apply) some of or all the patches in: http://hackage.haskell.org/trac/ghc/attachment/ticket/4834/ghc_new_monad_hierarchy.dpatch Note that these patches are independent of the newly proposed monad hierarchy. Thanks, Bas

Re: ANNOUNCE: GHC 7.0.2 Release Candidate 1

2010-12-18 Thread Bas van Dijk
On Fri, Dec 17, 2010 at 7:58 PM, Ian Lynagh ig...@earth.li wrote: Can you tell me what these commands say, please?: Oops! The i386 version works so I guess I mistakenly assumed I was on a 64bit system. Sorry for the noise. In case you still want to know: uname -a Linux hfd

Re: [Haskell-cafe] DNS problems at haskell.org?

2010-12-18 Thread Bas van Dijk
See the thread on the Haskell reddit about it: http://www.reddit.com/r/haskell/comments/encrv/whats_happened_to_haskellorg_did_someone_forget/ I hope it is resolved soon. Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: ANNOUNCE: GHC 7.0.2 Release Candidate 1

2010-12-17 Thread Bas van Dijk
On Thu, Dec 16, 2010 at 7:36 PM, Ian Lynagh ig...@earth.li wrote: We are pleased to announce the first release candidate for GHC 7.0.2:    http://www.haskell.org/ghc/dist/7.0.2-rc1/ This includes the source tarball, installers for OS X and Windows, and bindists for amd64/Linux, i386/Linux,

Re: Functor = Applicative = Monad

2010-12-12 Thread Bas van Dijk
On Wed, Dec 1, 2010 at 10:02 AM, John Smith volderm...@hotmail.com wrote: Regarding recent concerns as to whether Pointed is actually useful (and if it is, is that Pointed Functors or pure Pointed?), how about a slightly more modest reform? class Functor f where    map :: (a - b) - f a - f b

Re: Functor = Applicative = Monad

2010-12-12 Thread Bas van Dijk
On Sun, Dec 12, 2010 at 12:48 PM, John Smith volderm...@hotmail.com wrote: There's a ticket at http://trac.haskell.org/haskell-platform/ticket/155, Thanks! But why create a ticket for the Haskell Platform? This is a change in the base library so we should follow the library submission process[1]

Re: [Haskell] haskell.org downtime: Tuesday Nov 30th

2010-11-29 Thread Bas van Dijk
On Mon, Nov 29, 2010 at 10:02 PM, Neil Mitchell ndmitch...@gmail.com wrote: Hi Bas, Neil will be working on developing Hoogle all this weekend, but without Internet access. He expects to get it set up on the new server sometime during next week, but probably not before Weds. Ok thanks for

Re: [Haskell-cafe] How to cabal fetch mtl==2.0.0.0?

2010-11-26 Thread Bas van Dijk
On Fri, Nov 26, 2010 at 12:48 AM, Ross Paterson r...@soi.city.ac.uk wrote: On Fri, Nov 26, 2010 at 12:24:26AM +0100, Bas van Dijk wrote: Maybe it helps if special-functors gets an upper bound on its mtl dependency: mtl 2. It should have mtl 1.1.1.0, because that version lacks one

Re: [Haskell] haskell.org downtime: Tuesday Nov 30th

2010-11-25 Thread Bas van Dijk
On Thu, Nov 25, 2010 at 2:59 PM, Ian Lynagh ig...@earth.li wrote: If you think something is missing from    http://new-www.haskell.org/ then please let us know as soon as possible! http://new-www.haskell.org/hoogle/ returns: This will become the development version of Hoogle shortly. Will

Re: [Haskell] haskell.org downtime: Tuesday Nov 30th

2010-11-25 Thread Bas van Dijk
On Fri, Nov 26, 2010 at 12:21 AM, Malcolm Wallace malcolm.wall...@me.com wrote: Neil will be working on developing Hoogle all this weekend, but without Internet access. He expects to get it set up on the new server sometime during next week, but probably not before Weds. Ok thanks for the

Re: [Haskell-cafe] How to cabal fetch mtl==2.0.0.0?

2010-11-25 Thread Bas van Dijk
On Thu, Nov 25, 2010 at 2:52 AM, Iain Alexander i...@stryx.demon.co.uk wrote: log F:\Util\Haskellcabal fetch mtl==2.0.0.0 Resolving dependencies... cabal: internal error: could not construct a valid install plan. The proposed (invalid) plan contained the following problems: The following

Re: [Haskell-cafe] Confused about missing data constructor

2010-11-24 Thread Bas van Dijk
On Wed, Nov 24, 2010 at 7:08 PM, Antoine Latter aslat...@gmail.com wrote: I meant that 'pop' and 'push' should have been written with 'modify', 'get', and 'set' instead of the raw constructor, not as a drop-in replacement. Indeed, you can also use the 'state' function instead of the 'State'

Re: [Haskell-cafe] Bracket around every IO computation monad

2010-11-15 Thread Bas van Dijk
On Mon, Nov 8, 2010 at 1:40 AM, Mitar mmi...@gmail.com wrote: Hi! I have a class Neuron which has (among others) two functions: attach and deattach. I would like to make a way to call a list/stack/bunch of attach functions in a way that if any of those fail (by exception), deattach for

Re: [Haskell-cafe] Making monadic code more concise

2010-11-15 Thread Bas van Dijk
On Mon, Nov 15, 2010 at 6:43 PM, Ling Yang ly...@cs.stanford.edu wrote: ... One alternate way of doing this, however, is instancing the typeclasses of the ordinary values with their monadic versions: instance (Num a) = Num (Prob a) where        (+) = liftM2 (+)        (*) = liftM2 (*)      

Re: [Haskell-cafe] Error handling with safer-file-handling

2010-11-15 Thread Bas van Dijk
On Sun, Nov 14, 2010 at 12:38 PM, Florian Weimer f...@deneb.enyo.de wrote: How am I supposed to write an exception handle for an invocation of System.IO.SaferFileHandles.openFile? Currently, I have got this:  case req of    Open path - do      handle -openFile (asAbsPath path) ReadMode    

Re: [Haskell-cafe] Bracket around every IO computation monad

2010-11-15 Thread Bas van Dijk
On Tue, Nov 16, 2010 at 12:50 AM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: That said, I don't know what 'regions' may do for you that the simple monad I presented doesn't.  Bas, what are the advantages? My suggestion to use regions is based on an assumption which I'm not sure is

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Bas van Dijk
On Wed, Nov 10, 2010 at 10:50 AM, Mitar mmi...@gmail.com wrote: Hi! On Wed, Nov 10, 2010 at 8:54 AM, Bas van Dijk v.dijk@gmail.com wrote: A ThreadKilled exception is not printed to stderr because it's not really an error and should not be reported as such. So, how to make custom

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Bas van Dijk
On Wed, Nov 10, 2010 at 2:39 PM, Mitar mmi...@gmail.com wrote: Strange. It would help if you could show more of of your code. I am attaching a sample program which shows this. I am using 6.12.3 on both Linux and Mac OS X. And I run this program with runhaskell Test.hs. Without throwIO

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Bas van Dijk
On Wed, Nov 10, 2010 at 10:50 AM, Mitar mmi...@gmail.com wrote: Hi! On Wed, Nov 10, 2010 at 8:54 AM, Bas van Dijk v.dijk@gmail.com wrote: A ThreadKilled exception is not printed to stderr because it's not really an error and should not be reported as such. So, how to make custom

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Bas van Dijk
On Wed, Nov 10, 2010 at 2:39 PM, Mitar mmi...@gmail.com wrote: Strange. It would help if you could show more of of your code. I am attaching a sample program which shows this. I am using 6.12.3 on both Linux and Mac OS X. And I run this program with runhaskell Test.hs. Without throwIO

<    1   2   3   4   5   6   >