[Haskell-cafe] Question on concurrency

2010-09-13 Thread Arnaud Bailly
Hello Haskellers, Having been pretty much impressed by Don Stewart's "Practical Haskell" (http://donsbot.wordpress.com/2010/08/17/practical-haskell/), I started to write a Haskell script to run maven jobs (yes, I know...). In the course of undertaking this fantastic endeavour, I started to use the

[Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Paolo G. Giarrusso
On Sep 13, 12:22 pm, Michael Lazarev wrote: > Thanks for examples and pointers. > Since I came from Lisp, it never occurred to me that let and lambda > are different constructs in Haskell. You're not alone, I didn't believe my eyes when I first read about the difference (I learned Scheme, but th

[Haskell-cafe] Re: Full strict functor by abusing Haskell exceptions

2010-09-13 Thread Paolo G. Giarrusso
On Sep 13, 6:25 pm, Maciej Piechotka wrote: > I started experiment with strict functors. I come to: > > import Control.Exception > > import Foreign > > import Prelude hiding (catch) > > > data StrictMonad a = StrictMonad a deriving Show > > > instance Functor StrictMonad where > >     f `fmap` St

[Haskell-cafe] Re: Differences with Hayoo and Hoogle: Searching For Monoids

2010-09-13 Thread Paolo G. Giarrusso
On Sep 13, 6:27 pm, aditya siram wrote: > Hi all, > I was trying to read the documentation on monoids and the Sum type. > When I searched Hayoo for "Monoid" or "Data.Monoid", the Data.Monoid > module in "base" did not show up - Hoogle found it without a problem. > The same goes for the "Sum" type,

[Haskell-cafe] Re: A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-13 Thread Paolo G. Giarrusso
Hi all, I would like to share a new very cool result given by the current Cabal: if packages FOO, BAR and FOOBAR exist, such that FOO depends on BAR which depends on FOOBAR, and all three are installed, you just can't safely upgrade FOOBAR. When the same version of BAR is ever recompiled against t

Re: [Haskell-cafe] Haddock again

2010-09-13 Thread Andrew Coppin
Andrew Coppin wrote: Also, I commented that the links generated were broken, but it appears that if you have a sufficiently new version of Haddock, the links work just fine. (In other words, this particular bug is already fixed.) Heh, nope. The correct information is actually this: It *always*

[Haskell-cafe] Re: A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-13 Thread Paolo G. Giarrusso
On Sep 13, 1:52 pm, Ross Paterson wrote: > On Sat, Sep 11, 2010 at 12:17:27PM -0700, Jason Dagit wrote: > > "To avoid this problem in the future, avoid upgrading core packages. > > The latest version of cabal-install has disabled the upgrade command > > to make it a bit harder for people to break

Re: [Haskell-cafe] A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-13 Thread Paolo Giarrusso
On Sun, Sep 12, 2010 at 20:46, Tillmann Rendel wrote: > Paolo Giarrusso wrote: >> in a tracker entry you linked to, >> http://hackage.haskell.org/trac/hackage/ticket/704, duncan argues that >> "we also want to be able to do things like linking multiple versions >> of a Haskell package into a singl

Re: [Haskell-cafe] Fwd: Type families - how to resolve ambiguities?

2010-09-13 Thread Ryan Ingram
On Sun, Sep 12, 2010 at 9:24 AM, Dominique Devriese wrote: >> However, it would make more sense to have it be a type family, without >> the overhead of data (both in space and in typing). > > You can make Tensor a data family and use "newtype instances". As I > understand these, there should not b

Re: [Haskell-cafe] Data.Text performance problem

2010-09-13 Thread Bryan O'Sullivan
On Mon, Sep 13, 2010 at 3:26 AM, Petr Prokhorenkov wrote: > I really didn't expect mapAccumL to have quadratic complexity. Thank you a > lot for the fix! No problem. By the way, in my benchmarks, mapAccumL on Text is now faster than on ByteString :-) _

[Haskell-cafe] Differences with Hayoo and Hoogle: Searching For Monoids

2010-09-13 Thread aditya siram
Hi all, I was trying to read the documentation on monoids and the Sum type. When I searched Hayoo for "Monoid" or "Data.Monoid", the Data.Monoid module in "base" did not show up - Hoogle found it without a problem. The same goes for the "Sum" type, Hayoo does not seem to find it but Hoogle does. -

[Haskell-cafe] Full strict functor by abusing Haskell exceptions

2010-09-13 Thread Maciej Piechotka
I started experiment with strict functors. I come to: > import Control.Exception > import Foreign > import Prelude hiding (catch) > > data StrictMonad a = StrictMonad a deriving Show > > instance Functor StrictMonad where > f `fmap` StrictMonad v = return $ f v > > instance Applicative Stri

[Haskell-cafe] Re: Interruptable event loop

2010-09-13 Thread Mitar
Hi! OK, System.Timeout's timeout does not have this problem. ;-) Mitar ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] record update

2010-09-13 Thread Chris Eidhof
For completeness, using fclabels (yet another record package) you can write it like this: > {-# LANGUAGE TemplateHaskell #-} > module Records where > > import Data.Record.Label > > data MyRecord = MyRecord { _field1 :: String, _field2 :: Int, _field3 :: Bool > } > > $(mkLabels [''MyRecord])

Re: [Haskell-cafe] record update

2010-09-13 Thread Wolfgang Jeltsch
Am Samstag, den 11.09.2010, 11:21 -0600 schrieb Jonathan Geddes: > I know that record updates is a topic that has become a bit of a dead > horse, but here I go anyway: > > I find that most of the record updates I read and write take the form > > >someUpdate :: MyRecord -> MyRecord > >someUpdate m

Re: [Haskell-cafe] Do expression definition

2010-09-13 Thread Ben Millwood
On Mon, Sep 13, 2010 at 8:21 AM, Alexander Kotelnikov wrote: > And, also, would it make any difference if > > > do {p <- e; stmts}      =       let ok p = do {stmts} >    ok _ = fail "..." >  in e >>= ok > > is redefined as "e >>= (\p -> do {stmts})"? This is the magic that allows pattern-match f

Re: [Haskell-cafe] A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-13 Thread Ross Paterson
On Sat, Sep 11, 2010 at 12:17:27PM -0700, Jason Dagit wrote: > From the FAQ linked by Paolo: > > http://www.haskell.org/cabal/FAQ.html#dependencies-conflict > > "To avoid this problem in the future, avoid upgrading core packages. > The latest version of cabal-install has disabled the upgrade comm

Re: [Haskell-cafe] benchmarking c/c++ and haskell

2010-09-13 Thread Vo Minh Thu
2010/9/13 Daniel Fischer : > On Monday 13 September 2010 11:50:14, Vo Minh Thu wrote: >> 2010/9/13 David Virebayre : >> > Does it help to compile with ghc --make -O2 -funbox-strict-fields  ?? >> >> No, it doesn't. Can I assume you don't have the problem I described? > > Currently, GHC's native code

Re: [Haskell-cafe] benchmarking c/c++ and haskell

2010-09-13 Thread Daniel Fischer
On Monday 13 September 2010 11:50:14, Vo Minh Thu wrote: > 2010/9/13 David Virebayre : > > Does it help to compile with ghc --make -O2 -funbox-strict-fields  ?? > > No, it doesn't. Can I assume you don't have the problem I described? Currently, GHC's native code generator is not too good at optimi

Re: [Haskell-cafe] Data.Text performance problem

2010-09-13 Thread Petr Prokhorenkov
I really didn't expect mapAccumL to have quadratic complexity. Thank you a lot for the fix! On Mon, Sep 13, 2010 at 5:06 AM, Bryan O'Sullivan wrote: > On Sun, Sep 12, 2010 at 12:23 PM, Petr Prokhorenkov < > prokhoren...@gmail.com> wrote: > >> I experienced a following problem while dealing with

Re: [Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Michael Lazarev
Thanks for examples and pointers. Since I came from Lisp, it never occurred to me that let and lambda are different constructs in Haskell. I thought that let x = y in f is really (\x -> f) y It turns out that let is about declarations which are not the same as function applications above.

[Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Gleb Alexeyev
On 09/13/2010 12:45 PM, Gleb Alexeyev wrote: is, pardon my pun, not ok, because f is let-bound and, therefore, monomorphic This line doesn't make sense, I was too hasty to hit the 'Send' button, I meant to write 'lambda-bound', of course, apologies for that. _

Re: [Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Henning Thielemann
On Mon, 13 Sep 2010, Gleb Alexeyev wrote: On 09/13/2010 12:38 PM, Thomas Davie wrote: There's no "later" here at all. Two seperate definitions in a Haskell program act as if they have always been defined, are defined, and always will be defined, they are not dealt with in sequence (except

Re: [Haskell-cafe] benchmarking c/c++ and haskell

2010-09-13 Thread Vo Minh Thu
2010/9/13 David Virebayre : > Does it help to compile with ghc --make -O2 -funbox-strict-fields  ?? No, it doesn't. Can I assume you don't have the problem I described? Thanks, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskel

[Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Gleb Alexeyev
On 09/13/2010 12:38 PM, Thomas Davie wrote: On 13 Sep 2010, at 10:28, Gleb Alexeyev wrote: On 09/13/2010 12:23 PM, Michael Lazarev wrote: 2010/9/13 Henning Thielemann: It means that variables bound by let, may be instantiated to different types later. Can you give an example, please? tes

Re: [Haskell-cafe] benchmarking c/c++ and haskell

2010-09-13 Thread David Virebayre
Does it help to compile with ghc --make -O2 -funbox-strict-fields ?? David. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Thomas Davie
On 13 Sep 2010, at 10:28, Gleb Alexeyev wrote: > On 09/13/2010 12:23 PM, Michael Lazarev wrote: >> 2010/9/13 Henning Thielemann: >>> It means that variables bound by let, may be instantiated to different types >>> later. >> >> Can you give an example, please? > > testOk = let f = id in (f 42, f

[Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Gleb Alexeyev
On 09/13/2010 12:23 PM, Michael Lazarev wrote: 2010/9/13 Henning Thielemann: It means that variables bound by let, may be instantiated to different types later. Can you give an example, please? testOk = let f = id in (f 42, f True) --testNotOk :: Monad m => m (Int, Bool) --testNotOk = do f

Re: [Haskell-cafe] Do expression definition

2010-09-13 Thread Michael Lazarev
2010/9/13 Henning Thielemann : > It means that variables bound by let, may be instantiated to different types > later. Can you give an example, please? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

[Haskell-cafe] Interruptable event loop

2010-09-13 Thread Mitar
Hi! I have X11 code which looks something like the following. The problem is that TimerInterrupt gets sometimes thrown in a way that it kills the whole main thread. Probably it gets thrown in the middle of some nested function which unblocked exceptions. I found: http://hackage.haskell.org/trac/g

Re: [Haskell-cafe] Do expression definition

2010-09-13 Thread Henning Thielemann
On Mon, 13 Sep 2010, Alexander Kotelnikov wrote: Hello. http://www.haskell.org/onlinereport/exps.html#sect3.14 a obscure (to me) note which says "As indicated by the translation of do, variables bound by let have fully polymorphic types while those defined by <- are lambda bound and are thu

Re: [Haskell-cafe] ANN: ecu-0.0.0

2010-09-13 Thread Henning Thielemann
Brandon S Allbery KF8NH schrieb: > On 9/11/10 13:46 , Henning Thielemann wrote: >> Would it be better to write canlib in a way that works on both Windows >> and Unix? Otherwise all packages that import canlib have to add this switch. > > The phrasing of the original request leads me to believe tha

Re: [Haskell-cafe] Disable LINE Pragma handling in GHC

2010-09-13 Thread Henning Thielemann
JP Moresmau schrieb: > Users may not want to edit the files directly, but they'll be happy to > be able to open them with proper syntax highlighting, for example. Sure, but is showing the line numbers of the original file a bug or a feature? ___ Haskell

[Haskell-cafe] Do expression definition

2010-09-13 Thread Alexander Kotelnikov
Hello. http://www.haskell.org/onlinereport/exps.html#sect3.14 a obscure (to me) note which says "As indicated by the translation of do, variables bound by let have fully polymorphic types while those defined by <- are lambda bound and are thus monomorphic." What actually does it mean? And, a

[Haskell-cafe] Re: Cleaning up threads

2010-09-13 Thread Ertugrul Soeylemez
Mitar wrote: > I run multiple threads where I would like that exception from any of > them (and main) propagate to others but at the same time that they can > gracefully cleanup after themselves (even if this means not exiting). > I have this code to try, but cleanup functions (stop) are interrup