Re: [Haskell-cafe] polyvariadic function for Applicative instances

2010-05-10 Thread Xiao-Yong Jin
Chris Eidhof wrote: > Maybe this is what you are looking for: > http://www.haskell.org/haskellwiki/Idiom_brackets > -chris > On 9 mei 2010, at 18:39, Xiao-Yong Jin wrote: >> Hi, >> >> Is it possible to have a function accept variable number of >> arguments, suc

[Haskell-cafe] polyvariadic function for Applicative instances

2010-05-09 Thread Xiao-Yong Jin
Hi, Is it possible to have a function accept variable number of arguments, such that 'f' can be instantiated to different concrete types as f :: Applicative a => (e1 -> f) -> a e1 -> A f f g a = pure g <*> a f :: Applicative a => (e1 -> e2 -> f) -> a e1 -> a e2 -> A f f g a b = pure g <*> a <*>

Re: [Haskell-cafe] Vector to Monadic Stream and back, how?

2010-04-14 Thread Xiao-Yong Jin
On Wed, 14 Apr 2010 19:37:22 +1000, Roman Leshchinskiy wrote: > On 14/04/2010, at 09:05, Xiao-Yong Jin wrote: >> I want to use 'mapM' on Data.Vector.Vector, but it looks >> like the only 'mapM' defined is in >> Data.Vector.Fusion.Stream.Monadic. I'

[Haskell-cafe] Vector to Monadic Stream and back, how?

2010-04-13 Thread Xiao-Yong Jin
Dear list, I'm trying to change my code from using Data.Array to Data.Vector. I have some question regarding the monadic use of 'Vector'. Searching through the list couldn't give me enough hints, so I guess I'd try my luck asking on the list. I want to use 'mapM' on Data.Vector.Vector, but it l

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Xiao-Yong Jin
On Fri, 26 Mar 2010 21:56:16 -0700, Thomas DuBuisson wrote: >> Using bang patterns didn't help almost anything here. Using rem >> instead of mod made the time go from 45s to 40s. Now, using -fvia-C >> really helped (when I used rem but not using mod). It went down to >> 10s. > Bang patterns shoul

Re: [Haskell-cafe] Re: Parallel Pi

2010-03-18 Thread Xiao-Yong Jin
On Fri, 19 Mar 2010 01:22:58 +0100, Daniel Fischer wrote: > core id : 0 > cpu cores : 1 It is one of those pathetic single core pentium4 with so called hyper-threading enabled. You should have checked the intel product spreadsheet before investing such an old cpu. -- Jc/*_

Re: Fwd: [Haskell-cafe] Haskell for Physicists

2009-10-13 Thread Xiao-Yong Jin
Don Stewart writes: > Hey all, > > Following up on this, I'm presenting a position paper tomorrow on the > use of EDSLs to improve productivity and lower cost when developing code > for new high performance architectures (like GPUs). > > > http://www.galois.com/blog/2009/10/13/domain-specifi

Re: [Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-14 Thread Xiao-Yong Jin
Maurí­cio CA writes: >> That's been said, it is still your package. And people can >> always change the build scripts for their own needs. > > Not actually! I didn't work on bindings-levmar. I'm just the guy > who started the idea of having low level bindings packages as > basis for higher level

Re: [Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-14 Thread Xiao-Yong Jin
Maurí­cio CA writes: >>> Yes. It works this way. Tested in debian and old fedora > >> Thank you for testing. I have just released bindings-levmar-0.1.0.1 on >> hackage. It simply replaces pkgconfig-depends with extra-libraries. I >> hope this solves the installation problems. > > Debian maintaine

Re: [Haskell-cafe] ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-12 Thread Xiao-Yong Jin
Khudyakov Alexey writes: > В сообщении от Четверг 10 сентября 2009 17:21:40 автор Bas van Dijk написал: >> We like to announce the release of a Haskell binding to Manolis >> Lourakis's C levmar library > > bindings-levmar fails to configure on debian testing with following message: > > $ cabal

Re: [Haskell-cafe] IO trouble

2009-05-13 Thread Xiao-Yong Jin
Lauri Alanko writes: > On Tue, May 12, 2009 at 04:59:36PM -0400, Xiao-Yong Jin wrote: >> > f :: a -> b >> > g :: (a -> b) -> c -> d > >> > gf :: c -> d >> > gf = g f >> >> Now I want to handle exceptions in f and redefine f

[Haskell-cafe] IO trouble

2009-05-12 Thread Xiao-Yong Jin
Hi, I can't really describe it in the subject. So let me try to do it here. I have two functions > f :: a -> b > g :: (a -> b) -> c -> d and I use them as > gf :: c -> d > gf = g f Now I want to handle exceptions in f and redefine f as in f' > f' :: a -> IO (Either e b) So my question is h

[Haskell-cafe] unsafeSTToIO and stToIO

2009-04-29 Thread Xiao-Yong Jin
Hi, Between the following two functions stToIO:: ST RealWorld a -> IO a stToIO (ST m) = IO m unsafeSTToIO :: ST s a -> IO a unsafeSTToIO (ST m) = IO (unsafeCoerce# m) All I can see is that the safe one uses RealWorld instead of an arbitrary thread s used in the unsafe one. I really don

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-25 Thread Xiao-Yong Jin
Miguel Mitrofanov writes: > On 24 Apr 2009, at 16:37, Loup Vaillant wrote: > >> 2009/4/23 Miguel Mitrofanov : >>> On 23 Apr 2009, at 12:17, Thomas Davie wrote: >>> Haskell is a very horizontal language, and to limit our horizontal space seems pretty weird. >>> >>> +1. I sometimes u

Re: [Haskell-cafe] Re: Is 78 characters still a good option? Was: breaking too long lines

2009-04-23 Thread Xiao-Yong Jin
Gwern Branwen writes: > I was cabalizing a package once, and I chucked into the build-depends > 'ghc' and made it build. About 30 seconds later, it occurred to me > that this was a geometry library and what the heck was it doing with > the GHC API? So I go looking, and I find a module of utility

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-21 Thread Xiao-Yong Jin
Robert Greayer writes: > Xiao-Yong Jin wrote: >> Edward Kmett writes: >> >> > I find a hard 80 character line length limit to be >> > somewhat ridiculous in this >> > day and age. I've long since revised my personal >> > rule of thumb up

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-21 Thread Xiao-Yong Jin
Edward Kmett writes: > I find a hard 80 character line length limit to be somewhat ridiculous in this > day and age. I've long since revised my personal rule of thumb upwards towards > 132, if only because I can still show two windows of that side by side with no > worries, along with all the IDE

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-21 Thread Xiao-Yong Jin
Dusan Kolar writes: > Dear all, > > reading that > >> according the several style guides, lines shouldn't be too long >> (longer than 78 characters). >> >> http://www.cs.caltech.edu/courses/cs11/material/haskell/misc/haskell_style_guide.html >> http://www.haskell.org/haskellwiki/Programming_guid

Re: [Haskell-cafe] Re: Cabal's default install location

2009-04-21 Thread Xiao-Yong Jin
Achim Schneider writes: > Thomas Davie wrote: > >> There seems to be an assumption amongst the community that a user's >> home directory is the most useful place for cabal to install to by >> default. A few people have challenged that. I wanted to find out >> which one most people do act

Re: [Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Xiao-Yong Jin
Achim Schneider writes: > "Richard O'Keefe" wrote: > >> > This is good advice (/usr/local is fine though). >> >> Actually, no, it isn't. >> To start with, these days it's chock full of stuff >> which is hardly less critical for system operation >> than anything you'll find in /bin. >> > More

Re: [Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-20 Thread Xiao-Yong Jin
Edward Middleton writes: > Richard O'Keefe wrote: >> On 20 Apr 2009, at 10:27 pm, Jules Bean wrote: >>> However, the point here is surely that the de-facto default for all >>> other downloaded programs - standard makefile setups, automake, >>> autoconf, perl package, python packages, graphic inst

Re: [Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-20 Thread Xiao-Yong Jin
"Brandon S. Allbery KF8NH" writes: > On Apr 20, 2009, at 10:46 , David Leimbach wrote: > > Just refuse to use UHC until it conforms. One can refuse to use GHC > libraries that use extensions as well for similar reasons. I always think > twice when I see something that isn't Haskell

Re: [Haskell-cafe] Re: Best text editor

2009-04-14 Thread Xiao-Yong Jin
Stefan Monnier writes: >> I'm a beginner, but I'll chime in and say I use Emacs with >> haskell-mode. It's auto-indentation is a bit complex in behavior which is >> unappealing (I feel like I never know what it's going to do when I hit tab), >> but I would be curious what someone with more experi

Re: [Haskell-cafe] Best text editor

2009-04-13 Thread Xiao-Yong Jin
Michael P Mossey writes: > Ketil Malde wrote: >> Michael Mossey writes: >> >>> I'm a beginner, but I'll chime in and say I use Emacs with >>> haskell-mode. It's auto-indentation is a bit complex in behavior which >>> is unappealing (I feel like I never know what it's going to do when I >>> hit t

Re: [Haskell-cafe] ANN: hmatrix-static: statically-sized linear algebra

2009-04-11 Thread Xiao-Yong Jin
Reiner Pope writes: > Hi everyone, > > I am pleased to announce hmatrix-static[1], a thin wrapper over > Alberto Ruiz's excellent hmatrix library[2] for linear algebra. > > The main additions of hmatrix-static over hmatrix are: > - vectors and matrices have their length encoded in their types >

[Haskell-cafe] Volunteer

2009-04-06 Thread Xiao-Yong Jin
Hi, I learned that no one is doing generic unix source tarball, right now, and thought I might help to get it start. I have decent skills on Makefile, but knows very little about auto-tools. I can only spent a few hours every week on it, because I don't have too much spare time as a PhD student.

Re: [Haskell-cafe] Re: Darcs - dependencies between repositories (aka forests)

2009-03-29 Thread Xiao-Yong Jin
Peter Verswyvelen writes: > Mmm, my email was indeed very unclear about my question. > > A very simple example: suppose a development team is working on a program. > This program consist of modules A and B. Each module has it's own Darcs > repository. > > Module A requires B. When a new developer

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-26 Thread Xiao-Yong Jin
Henning Thielemann writes: > On Thu, 26 Mar 2009, Xiao-Yong Jin wrote: > >> So I have another question. Is the following function safe >> and legitimate? >> >>> safeDiv :: (Exception e, Integral a) => >>>a -> a -> Either e a >>

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-26 Thread Xiao-Yong Jin
John Lato writes: > Even in Haskell this separation isn't absolute. Programmer errors, > such as dividing by 0, can and do lead to exceptional conditions. The > proper way to handle dividing by 0 is to not do it in the first place, > but if it happens because of a programming error, you've got

[Haskell-cafe] Re: Exception handling in numeric computations

2009-03-25 Thread Xiao-Yong Jin
John Lato writes: >> Yes, I know, it's not really complicate to rewrite the above >> code.  But, what do I really gain from this rewrite? > > Apologies if this discussion has moved on, but I wanted to comment on this. > Thanks for elaborating it more. > > You gain correctness. Any functions th

Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-25 Thread Xiao-Yong Jin
Jonathan Cast writes: > On Tue, 2009-03-24 at 23:13 -0700, Donn Cave wrote: >> Quoth Duncan Coutts : >> >> > You must not do this. It breaks the semantics of the language. >> > >> > Other people have given practical reasons why you should not but a >> > theoretical reason is that you've defined

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-24 Thread Xiao-Yong Jin
Jake McArthur writes: > Xiao-Yong Jin wrote: > | Then, why is 'div' not of type 'a -> a -> ArithExceptionMonad a' ? > | Why does it throws this /ugly/ /error/ when it is applied to > | 0? Why is it not using some beautiful > | 'ArithExceptinoMonad

Re: [Haskell-cafe] Are there performant mutable Arrays in Haskell?

2009-03-24 Thread Xiao-Yong Jin
"Brettschneider, Matthias" writes: > Thx for your hints, I played around with them and the performance gets > slightly better. > But the major boost is still missing :) > > I noticed, that one real bottleneck seems to be the conversion of the array > back into a list. > The interesting part

[Haskell-cafe] Re: Exception handling in numeric computations

2009-03-24 Thread Xiao-Yong Jin
Daniel Yokomizo writes: > On Tue, Mar 24, 2009 at 1:27 PM, Xiao-Yong Jin wrote: >> Henning Thielemann writes: >> >>> Try to never use exception handling for catching programming errors! >>> Division by zero is undefined, thus a programming error when it >&g

[Haskell-cafe] Re: Exception handling in numeric computations

2009-03-24 Thread Xiao-Yong Jin
Jake McArthur writes: > Xiao-Yong Jin wrote: > | The problem is that there will be many functions using such > | a function to invert a matrix, making this inversion > | function return Either/Maybe or packing it in a monad is > | just a big headache. > > I disagree. I

Exception handling in numeric computations (was Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?)

2009-03-24 Thread Xiao-Yong Jin
Henning Thielemann writes: > Try to never use exception handling for catching programming errors! > Division by zero is undefined, thus a programming error when it > occurs. > http://www.haskell.org/haskellwiki/Error > http://www.haskell.org/haskellwiki/Exception > I'm afraid, a Maybe or Eith

Re: [Haskell-cafe] Re: Use unsafePerformIO to catch Exception?

2009-03-23 Thread Xiao-Yong Jin
ChrisK writes: > You should ensure that the result of "evaluate" is in normal form, not > just weak head normal form. You can do this with the > Control.Parallel.Strategies module: > >> import Control.Exception(ArithException(..),try,evaluate) >> import Control.Parallel.Strategies(NFData,using,r

[Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-23 Thread Xiao-Yong Jin
Hi, I just feel it is not comfortable to deal with exceptions only within IO monad, so I defined > tryArith :: a -> Either ArithException a > tryArith = unsafePerformIO . try . evaluate and it works quite good as > map (tryArith . (div 5)) [2,1,0,5] evaluates to > [Right 2,Right 5,Left divide

Re: [Haskell-cafe] Re: Why do functions not inherit class when renamed?

2009-03-19 Thread Xiao-Yong Jin
Tomáš Janoušek writes: > Hello, > > On Thu, Mar 19, 2009 at 05:49:34PM -0600, Duane Johnson wrote: >> I'm not sure I understand what is going on here, but it seems to me that >> the following assignment of "mult = (*)" causes "mult" to lose out on some >> of the polymorphic behavior of (*). Is

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Xiao-Yong Jin
Hi, thanks for the hint. I'll see what I can do with it. Xiao-Yong Bulat Ziganshin writes: > Hello Xiao-Yong, > > Wednesday, March 11, 2009, 12:28:45 AM, you wrote: > >> It goes beyond my current knowledge, now. How do you define >> a custom data type as an instance of UA or Storable? > > jus

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Xiao-Yong Jin
Don Stewart writes: >> instance UA UserDefinedDataType >> >> I'm not sure how to do that. Can you give me some >> clarification? > > Yes, you can do that. This is the case for most of the new array > libraries. It goes beyond my current knowledge, now. How do you define a custom data type as

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Xiao-Yong Jin
Don Stewart writes: > And what is Storable limited to? > > Ultimately they're all limited to the primops for reading and writing, > and to what types we can encode in those. So: > > primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp > ... > {- > instance Storable Double > instance Sto

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-09 Thread Xiao-Yong Jin
Alexander Dunlap writes: > - uvector, storablevector and vector are all designed for dealing with > arrays. They *can* be used for characters/word8s but are not > specialized for that purpose, do not deal with Unicode at all, and are > probably worse at it. They are better for dealing with things

[Haskell-cafe] Optimizing array operation?

2009-03-04 Thread Xiao-Yong Jin
Dear list, I decided to extract some common code I use in my data analysis code and end up with some interesting pattern. > -- | Confined array operation. The type Arr here is actually used as > -- a C-like array with index runs from 0 to n-1. > type Arr = Array Int > > -- | Element fetching fu

[Haskell-cafe] emacs cedet support for haskell?

2009-02-24 Thread Xiao-Yong Jin
Hi, I've googled around for possible haskell support in emacs cedet, but couldn't find any. From cedet's website, it claims to support the following Language Parsers Parsers that have already been implemented: Emacs Lisp, Java, C/C++, C#, Python, Erlang, awk, Makefile, Scheme, HTML, Texi

Re: [Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Xiao-Yong Jin
Peter Verswyvelen writes: > you could even pass it in a test data set to which it must be optimized; > after the program is compiled, > the compiler runs and profiles it, measures the results, and does another > pass to make it faster. > > some C++ compilers can already do this (profile based o

[Haskell-cafe] Re: [hmatrix] build error

2008-10-08 Thread Xiao-Yong Jin
Alberto Ruiz <[EMAIL PROTECTED]> writes: > Hi Xiao-Yong, > > In i686 Arch linux, with the normal blas and lapack, I need: > > extra-libraries: gsl lapack blas gslcblas gfortran > > But using atlas-lapack: > > extra-libraries: gsl lapack f77blas gslcblas atlas gcc_s I guess you want cb

Re: [Haskell-cafe] [hmatrix] build error

2008-10-08 Thread Xiao-Yong Jin
Xiao-Yong Jin <[EMAIL PROTECTED]> writes: > Hi, looks like I hit a bug, but I'm not sure which software > it belongs to, gcc, ghc or atlas? > > -- error doing "runhaskell Setup build" -- > Preprocessing library hmatrix-0.4.1.0... > /usr

[Haskell-cafe] [hmatrix] build error

2008-10-08 Thread Xiao-Yong Jin
Hi, looks like I hit a bug, but I'm not sure which software it belongs to, gcc, ghc or atlas? -- error doing "runhaskell Setup build" -- Preprocessing library hmatrix-0.4.1.0... /usr/bin/ld: dist/build/Numeric/GSL/Special/Internal_hsc_make: hidden symbol `__powidf2' in /usr/lib/gc

Re: [Haskell-cafe] What is a rigid type variable?

2008-06-23 Thread Xiao-Yong Jin
"Luke Palmer" <[EMAIL PROTECTED]> writes: > On Mon, Jun 23, 2008 at 5:58 AM, Luke Palmer <[EMAIL PROTECTED]> wrote: >> On Mon, Jun 23, 2008 at 3:26 AM, Xiao-Yong Jin <[EMAIL PROTECTED]> wrote: >>> Hi all, >>> >>> I'm writing

[Haskell-cafe] What is a rigid type variable?

2008-06-22 Thread Xiao-Yong Jin
Hi all, I'm writing a short function as follows, but I'm not able to find a suitable type signature for `go'. It uses Numeric.LinearAlgebra from hmatrix. -- | Map each element in a vector to vectors and thus form a matrix -- | row by row mapVecToMat :: (Element a, Element b) => (

Re: [Haskell-cafe] Safe way to parse arguments?

2008-06-21 Thread Xiao-Yong Jin
Don Stewart <[EMAIL PROTECTED]> writes: > The main thing is to define a safe read. This will be in the base > library soon, > > maybeRead :: Read a => String -> Maybe a > maybeRead s = case reads s of > [(x, "")] -> Just x > _ -> Nothing > > Then you can pat

[Haskell-cafe] Safe way to parse arguments?

2008-06-21 Thread Xiao-Yong Jin
Hi, I'm wondering how usually you parse command line arguments list safely. If the given argument is wrong, the program can still print out some error information instead of giving something like Prelude.read: no parse Let's make the discussion concrete. Suppose we have the following code. --

Haskell on ARM (was Re: [Haskell-cafe] ANN: Topkata)

2008-06-17 Thread Xiao-Yong Jin
"Ariel J. Birnbaum" <[EMAIL PROTECTED]> writes: >> In the mean time -- who knows enough to make ghc target >> ARM, and get this to link against the iPhone libraries? >> This would be quite a coup if it could be made to run >> there! > For that matter, there's another ARM-based target in which > I'

Re: [Haskell-cafe] 1/0

2008-06-16 Thread Xiao-Yong Jin
"Evan Laforge" <[EMAIL PROTECTED]> writes: > So, I know this has been discussed before, but: > >> 1/0 > Infinity >> 0/0 > NaN > > ... so I see from the archives that Infinity is mandated by ieee754 > even though my intuition says both should be NaN. > > Every other language throws an exception, ev

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-09 Thread Xiao-Yong Jin
"Johan Tibell" <[EMAIL PROTECTED]> writes: > Duncan's recommendation of just taking the part after the last dot > seems like a good rule of thumb. Doing > > import qualified Data.Map as M > > does gain you much in my opinion. Compare M.empty to emptyM. No > difference, you still can't deduce the m

Re: [Haskell-cafe] Re: Patrick Perry's BLAS package

2008-06-08 Thread Xiao-Yong Jin
"Bryan O'Sullivan" <[EMAIL PROTECTED]> writes: > Judah Jacobson wrote: > >> My preference is to use an autoconf script to solve that problem. >> ("build-type: Configure" in the cabal file.) > > That approach would not work well for BLAS. The various BLAS libraries > have profoundly different perf

Re: [Haskell-cafe] "sum" in hmatrix and blas?

2008-06-08 Thread Xiao-Yong Jin
Alberto Ruiz <[EMAIL PROTECTED]> writes: > My experience is that Haskell allocation time is very fast and usually > negligible in most non trivial matrix computations. > > A good thing about > > sum v = constant 1 (dim v) <.> v > > is that a constant vector is efficiently created internally (not f

Re: [Haskell-cafe] "sum" in hmatrix and blas?

2008-06-08 Thread Xiao-Yong Jin
Tomas Andersson <[EMAIL PROTECTED]> writes: > You can never go wrong with a good old fashioned hand written tail recursion > when you're in doubt, they are pretty much the closest thing to for-loops > there is in haskell and should be easy to grok for Imperative programmers and > usually produ

[Haskell-cafe] "sum" in hmatrix and blas?

2008-06-07 Thread Xiao-Yong Jin
Hi, probably I am just being dumb, but what is the most efficient way to do a sum of every elements in a Vector of either hmatrix or blas? I know there is sum of absolute values from BLAS. So what about I want a plain "sum"? I can only think of the following two ways. 1. Using Data.List.foldl'

[Haskell-cafe] Issues of the "mailto" link on the list archive page

2008-06-07 Thread Xiao-Yong Jin
Hi, I had private conversation with Andrzej Jaworski about the fact that his reply to Alberto Ruiz's post is off thread. What he did was clicking on the "mailto" link beside the author's name on the list archive web page [1]. [1] http://www.haskell.org/pipermail/haskell-cafe/2008-June/044023.html

Re: [Haskell-cafe] Re: Patrick Perry's BLAS package

2008-06-06 Thread Xiao-Yong Jin
(Sorry, Patrick. I forgot to CC haskell-cafe.) Salute! Excellent! Patrick Perry <[EMAIL PROTECTED]> writes: > Wow, thanks for noticing, Alberto! For anyone interested, I put up a > formal announcement describing the bindings a little bit here: > > http://quantile95.com/ > > I just registered

Re: [Haskell-cafe] Exception handling when using STUArray

2008-03-08 Thread Xiao-Yong Jin
"Denis Bueno" <[EMAIL PROTECTED]> writes: > On Sat, Mar 8, 2008 at 9:54 AM, Xiao-Yong Jin <[EMAIL PROTECTED]> wrote: >> > ArrayException? If it is out-of-bounds reading or writing, surely >> > that indicates a bug in your program that you'

Re: [Haskell-cafe] Exception handling when using STUArray

2008-03-08 Thread Xiao-Yong Jin
"Denis Bueno" <[EMAIL PROTECTED]> writes: > On Sat, Mar 8, 2008 at 12:29 AM, Xiao-Yong Jin <[EMAIL PROTECTED]> wrote: >> I'm using STUArray in some of my time critical number >> crunching code. I would like to know some way to catch the >> excep

[Haskell-cafe] Exception handling when using STUArray

2008-03-07 Thread Xiao-Yong Jin
Dear list, I'm using STUArray in some of my time critical number crunching code. I would like to know some way to catch the exceptions raised in the ST monad, ie. ArrayException. Looking through the Control.Exception module, I understand that those functions can only be used within IO monad. So

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Don Stewart <[EMAIL PROTECTED]> writes: > xj2106: >> I used `unsafePerformIO' with `INLINE', because I don't know >> where `inlinePerformIO' is now. And also the `-optc-march' >> is changed to `nocona'. > > Using unsafePerformIO here would break some crucial inlining. > (the same trick is used in

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Don Stewart <[EMAIL PROTECTED]> writes: > Can you start by retrying with flags from the spectral-norm benchmark: > > > http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=ghc&id=0 > > The interaction with gcc here is quite important, so forcing -fvia-C > will matter. C

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
"Dan Piponi" <[EMAIL PROTECTED]> writes: > My wasn't intended to represent the problem that I'm trying to solve, > but the approach I want to take. The problems that I do want to solve > don't lend themselves to this kind of approach. > > My real situation is that I want to write code that has bot

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Bulat Ziganshin <[EMAIL PROTECTED]> writes: > Hello Dan, > > Thursday, November 8, 2007, 9:33:12 PM, you wrote: > >> main = do >>a <- newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) >>forM_ [0..n-2] $ \i -> do { x <- readArray a i; y <- readArray a >> (i+1); writeArray a (i+1) (x+y) } >>

Re: [Haskell-cafe] freebsd-7.0BETA1 and ghc

2007-10-24 Thread Xiao-Yong Jin
brad clawsie <[EMAIL PROTECTED]> writes: > a note recently went out regarding the first beta release of freebsd7 > > note that ghc is still marked as broken in the 7-branch ports tree due > to issues regarding the move from gcc3x to gcc4x. if you rely on ghc, > you may want to hold off on an upgra

[Haskell-cafe] Re: [Haskell] Linear Equation Solver Using Arrays

2007-09-16 Thread Xiao-Yong Jin
gt;http://blogs.nubgames.com/code/?p=22 > Thanks for the link. > > Sorry, I don't have more specific suggestions, but I >suspect this is what most people thought when they read >your code: it's hard to make specific suggestions, when >you're really approaching the pr