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
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 <*>
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'
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
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
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/*_
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
"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
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
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
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
>
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.
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
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
>>
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
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
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
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
"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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
"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
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) =>
(
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
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.
--
"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'
"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
"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
"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
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
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
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'
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
(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
"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'
"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
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
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
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
"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
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) }
>>
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
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
71 matches
Mail list logo