Re: [Haskell-cafe] Package documentation complaints -- and a suggestion

2011-10-10 Thread Max Rabkin
On Mon, Oct 10, 2011 at 03:17, John Millikin  wrote:
> The package summary is "Type-safe ADT-database mapping library.", which
> gives some idea about what it does.

Whence my suggestion to show this on the package's page. Perhaps I
shouldn't have hidden that at the bottom -- I meant this as my main
point, and I'm afraid I got a little side-tracked.

> In my experience, any package that starts its source files with
>
> {-# LANGUAGE GADTs, TypeFamilies, ExistentialQuantification,
> StandaloneDeriving, TypeSynonymInstances, MultiParamTypeClasses,
> FunctionalDependencies, FlexibleInstances, FlexibleContexts,
> OverlappingInstances, ScopedTypeVariables, GeneralizedNewtypeDeriving,
> UndecidableInstances, EmptyDataDecls #-}
>
> is probably an experiment in what is possible, rather than a
> production-friendly library.

An experiment that I was interested in, and hoped to find out more
about. But anyway, I see your point.

> Many people upload experimental packages to Hackage so that they can be used
> by other interested people, even though the packages are not ready/intended
> for mass consumption. A lack of documentation in such cases is
> understandable.

Some way of documenting this fact would, however, be helpful.

> I wonder if it would be worth giving package uploaders control over whether
> their packages are shown on the package list? Packages can be manually
> hidden by emailing an admin, but that's a lot of trouble.

In this case I followed an external link, so that would not have
helped me. There is the "stability" field, which has an "experimental"
value, but it's not at all clear what the different values mean other
than "stable".

It is fair that some packages on Hackage are not intended for human
consumption. Perhaps this is caused in part by having our package
installer and humans looking in the same place for information about
Haskell libraries. But I think we can do a better job of
distinguishing these packages. Perhaps a "visibility" or
"release-status" field?

--Max

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Package documentation complaints -- and a suggestion

2011-10-10 Thread Paterson, Ross
Max Rabkin writes:
> But I also have a concrete suggestion for Hackage: include the package
> synopsis on the package's page. The distinction between synopsis and
> description can be confusing, and sometimes it seems to violate DRY to
> have the same info in both.

You may have missed the header on the package page (dark line at the top).

The distinction between synopsis and description is borrowed from the
Debian package format:

http://www.debian.org/doc/debian-policy/ch-binary.html#s-descriptions

The two fields are aimed at different audiences.  A Synopsis trying to
do double duty as the beginning of a general package description won't
work as well as a stand-alone summary for package lists, etc.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Package documentation complaints -- and a suggestion

2011-10-10 Thread Max Rabkin
On Mon, Oct 10, 2011 at 10:06, Paterson, Ross  wrote:
> Max Rabkin writes:
>> But I also have a concrete suggestion for Hackage: include the package
>> synopsis on the package's page. The distinction between synopsis and
>> description can be confusing, and sometimes it seems to violate DRY to
>> have the same info in both.
>
> You may have missed the header on the package page (dark line at the top).

I did indeed. Perhaps it should be bigger? I've just opened up
Synaptic, and it is indeed separate from the description, but there
the synopsis is used as a heading for the description, and it's the
biggest thing on the screen (whereas Hackage uses package name).

> The distinction between synopsis and description is borrowed from the
> Debian package format:
>
> http://www.debian.org/doc/debian-policy/ch-binary.html#s-descriptions
>
> The two fields are aimed at different audiences.  A Synopsis trying to
> do double duty as the beginning of a general package description won't
> work as well as a stand-alone summary for package lists, etc.

Good point. On the other hand, nobody points package authors to the
Debian documentation (and Debian also has review for newly uploaded
packages, as far as I know).

--Max

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best bit LIST data structure

2011-10-10 Thread Ryan Newton
On Sun, Oct 9, 2011 at 12:11 PM, Roman Beslik  wrote:

> Yes, if you do not use high-level concepts and optimize everything by hand,
> it requires a lot of testing. :)
>

There are probably more constructive, jibe-free ways to frame this
suggestion...

Regarding testing:  my preference for using a preexisting solution is a
product of 18 years of programming in Scheme without a large base of shared
infrastructure -- I've seen way too much "roll your own X" leading to
trouble.

Regarding high-performance data-structures in Haskell: I wish high-level
concepts were sufficient for their optimization.  But if you look at all the
tricks played by, for example, Johan Tibell and Greg Collins in their
excellent hashmaps and hashtables libraries, that, alas, seems not to be the
case yet.  GHC is in a good position to do inlining and specialization
(making the world safe for type classes), but it can't add unpack and
strictness annotations, nor can it change data representations themselves.

For example, to answer Yves question:

I fail to understand. Why not just:
> > data BitList b = Nil | BitList Int b (BitList b)
> ??
>

That was a "data structure unrolling" to optimize the memory representation
in the common case (<64 bits).  Starting with:

 type I = Int64 -- or whatever
 data BitList = Nil | BL Int I BitList

The recursive datatype can be inlined (once):

 data BitList = Nil | BL  Int I (Nil | BL Int I BitList) *-- not real syntax
*
 data BitList = Nil | BL2 Int I Nil | BL3 Int I Int I BitList* -- distribute
*
 data BitList = Nil | BL2 Int I | BL3 Int I Int I BitList *-- prune Nil*

This unrolled data structure has two advantages.  It can directly represent
the common case <64 bits with one object, and it can use half the tail
pointers for longer lists.  GHC could conceivably transform code
automatically to enable this unrolling (but it can't now).

However, there are some further observations that really require a human.
Because we are using that extra Int to track the bit position inside the "I"
the Nil case is redundant -- "BL2 0 0" can represent empty.  Further one of
the Ints in the BL3 case is always 64 (sizeof I) and needn't be
represented.  That gives us:

 data BitList = BL2 Int I | BL3 Int I I BitList *-- prune Nil*

Which is pretty much what I used.  Actually, I skipped the "double wide"
second case because I was really only worried about simplifying the
representation for shorter lists and that would indeed complicate the code.

> data *(Bits b) =>* BitList b

FYI, in the bit of code I sent I didn't generalize over the Bits class
because it's really an implementation detail what size chunk is used (just
like in Lazy ByteStrings).  I didn't want to pollute the interface.  That
said, the code should certainly be "CSE"d to make the "64/Int64" choice
swappable.

Best regards,
  -Ryan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Trouble using State Monad.

2011-10-10 Thread Jake McArthur
On Oct 9, 2011 11:17 PM, "David Barbour"  wrote:
> If you really want the input type to be part of the Filter type
definition, you'll need to use arrows instead of monads.

I wouldn't say that. You just need an extra type parameter. That doesn't
mean it can't be a monad. In fact, wrapping ReaderT around the existing
representation gives us exactly the monad we probably want. That said, I
think it is likely to be more useful in this context either as it is or as
an arrow. I just want to point out that it can still be a monad even if it
is an arrow.

- Jake
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Question on definition of `parse' function in Parsec library.

2011-10-10 Thread Christian Maeder

Am 08.10.2011 16:04, schrieb Captain Freako:

Hi all,

In this definition from the Parsec library:

parse  ::  (Stream  s  Identity  t)
   =>  Parsec  s  ()  a  ->  SourceName  ->  s  ->  Either  ParseError  a
parse  p  =  runP  p  ()


what's the significance of `Identity t'?
(`t' isn't used anywhere.)


http://hackage.haskell.org/packages/archive/parsec/3.1.2/doc/html/Text-Parsec-Prim.html#t:Stream

Text.Parsec.Prim contains

 class Monad m => Stream s m t | s -> t where

saying that the type s determines t (that is a functional dependency).
The instances are:

 Monad m => Stream ByteString m Char 
 Monad m => Stream ByteString m Char 
 Monad m => Stream Text m Char   
 Monad m => Stream Text m Char   
 Monad m => Stream [tok] m tok   

so usually you have a character stream. (There are lazy and strict 
version of Text and ByteString.) The last instance also works for plain 
strings (String = [Char]).


Using "Identity" for the monad m just means, that you actually do not 
need a monad (but need to supply a dummy one).


If you want to keep thinks simpler you could use packages parsec1 or parsec2

Cheers Christian

http://hackage.haskell.org/package/parsec2
http://hackage.haskell.org/package/parsec1



Thanks,
-db


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] wxhaskell : how to generate an event?

2011-10-10 Thread Johannes Waldmann
Dear all,

in wxHaskell (core) I can set and get event handlers
http://hackage.haskell.org/packages/archive/wxcore/0.12.1.7/doc/html/Graphics-UI-WXCore-Events.html
but how is it possible to create events (programmatically)
and somehow feed them into the "main event handling loop"?

I think I need this in an application that needs to handle
concurrently events that arrive via the GUI (like mouse clicks)
and events from an external source (specifically, alsa-midi input).

Of course I could handle those "extra events" separately from wxcore,
but they should ultimately result in changes to the GUI state,
and it feels dangerous to do this without synchronisation.

Any hints welcome. Thanks - J.W.



signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is there a DFA library?

2011-10-10 Thread Johannes Waldmann
> ... things like minimization, completion, etc.

http://autolat.imn.htwk-leipzig.de/haddock/autolib-fa-1.1/

git clone git://autolat.imn.htwk-leipzig.de/git/autolib

Enjoy - J.W.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] SMP parallelism increasing GC time dramatically

2011-10-10 Thread Tom Thorne
Yes I will try to run threadscope on it, I tried it before and the event log
output produced about 1.8GB, and then crashed.

Is there any way to tell the RTS to perform GC less often? My code doesn't
use too much memory and I'm using fairly hefty machines (e.g one with 48
cores and 128GB of RAM) and so perhaps the default/heuristic settings aren't
optimal.
On Sun, Oct 9, 2011 at 4:16 PM, Thomas Schilling wrote:

> It would be really useful to see the threadscope output for this.
> Apart from cache effects (which may well be significant at 12 cores),
> the usual problems with parallel GHC are synchronisation.
>
> When GHC wants to perform a parallel GC it needs to stop all Haskell
> threads.  These are lightweight threads and are scheduled
> cooperatively, i.e., there's no way to interrupt them from the outside
> (except for the OS, but that doesn't help with GC).  Usually, a thread
> is able to yield whenever it tries to do an allocation which is common
> enough in normal Haskell.  However, your work contains lots of matrix
> computation which likely don't do allocations in the inner loop or
> call C to do their work, which isn't interruptible, either.  My guess
> would be that (at least part of) the reason for your slowdown is that
> the parallel GC spends a lot of time waiting for threads to stop.
> This would be apparent in Threadscope.  (I may be wrong, because even
> the single-threaded GC needs to stop all threads)
>
> On 7 October 2011 18:21, Tom Thorne  wrote:
> > I have made a dummy program that seems to exhibit the same GC
> > slowdown behavior, minus the segmentation faults. Compiling with
> -threaded
> > and running with -N12 I get very bad performance (3x slower than -N1),
> > running with -N12 -qg it runs approximately 3 times faster than -N1. I
> don't
> > know if I should submit this as a bug or not? I'd certainly like to know
> why
> > this is happening!
> > import Numeric.LinearAlgebra
> > import Numeric.GSL.Special.Gamma
> > import Control.Parallel.Strategies
> > import Control.Monad
> > import Data.IORef
> > import Data.Random
> > import Data.Random.Source.PureMT
> > import Debug.Trace
> > --
> > subsets s n = (subsets_stream s) !! n
> > subsets_stream [] = [[]] : repeat []
> > subsets_stream (x:xs) =
> > let r = subsets_stream xs
> >s = map (map (x:)) r
> > in [[]] : zipWith (++) s (tail r)
> > testfun :: Matrix Double -> Int -> [Int] -> Double
> > testfun x k cs = lngamma (det (c+u))
> > where
> > (m,c) = meanCov xx
> > m' = fromRows [m]
> > u = (trans m') <> m'
> > xx = fromColumns ( [(toColumns x)!!i] ++ [(toColumns x)!!j] ++
> [(toColumns
> > x)!!k] )
> > i = cs !! 0
> > j = cs !! 1
> >
> > test :: Matrix Double -> Int -> Double
> > test x i = sum p
> > where
> > p = parMap (rdeepseq) (testfun x (i+1)) (subsets [0..i] 2)
> >
> >
> > ranMatrix :: Int -> RVar (Matrix Double)
> > ranMatrix n = do
> > xs <- mapM (\_ -> mapM (\_ -> uniform 0 1.0) [1..n]) [1..n]
> > return (fromLists xs)
> >
> > loop :: Int -> Double -> Int -> RVar Double
> > loop n s i = traceShow i $ do
> > x <- ranMatrix n
> > let r = sum $ parMap (rdeepseq) (test x) [2..(n-2)]
> > return (r+s)
> > main = do
> > let n = 100
> > let iter = 5
> > rng <- newPureMT
> > rngr <- newIORef rng
> > p <- runRVar (foldM (loop n) 0.0 [1..iter]) rngr
> > print p
> > I have also found that the segmentation faults in my code disappear if I
> > switch from Control.Parallel to Control.Monad.Par, which is quite
> strange. I
> > get slightly better performance with Control.Parallel when it completes
> > without a seg. fault, and the frequency with which it does so seems to
> > depend on the number of sparks that are being created.
> > On Thu, Oct 6, 2011 at 1:56 PM, Tom Thorne 
> > wrote:
> >>
> >> I'm trying to narrow it down so that I can submit a meaningful bug
> report,
> >> and it seems to be something to do with switching off parallel GC using
> -qg,
> >> whilst also passing -Nx.
> >> Are there any known issues with this that people are aware of? At the
> >> moment I am using the latest haskell platform release on arch.
> >> I'd like to give 7.2 a try in case that fixes it, but I'm using rather a
> >> lot of libraries (hmatrix, fclabels, random fu) and I don't know how to
> >> install them for multiple ghc versions
> >> On Wed, Oct 5, 2011 at 10:43 PM, Johan Tibell 
> >> wrote:
> >>>
> >>> On Wed, Oct 5, 2011 at 2:37 PM, Tom Thorne 
> >>> wrote:
> 
>  The only problem is that now I am getting random occasional
> segmentation
>  faults that I was not been getting before, and once got a message
> saying:
>  Main: schedule: re-entered unsafely
>  Perhaps a 'foreign import unsafe' should be 'safe'?
>  I think this may be something to do with creating a lot of sparks
>  though, since this occurs whether I have the parallel GC on or not.
> >>>
> >>> Unless you (or some library you're using) is doing what the error
> message
> >>> says then you should file a GHC bug here:
> >>>
> >>> http://hackage.haskell

Re: [Haskell-cafe] SMP parallelism increasing GC time dramatically

2011-10-10 Thread Gregory Collins
On Mon, Oct 10, 2011 at 3:55 PM, Tom Thorne  wrote:
>
> Yes I will try to run threadscope on it, I tried it before and the event log 
> output produced about 1.8GB, and then crashed.
> Is there any way to tell the RTS to perform GC less often? My code doesn't 
> use too much memory and I'm using fairly hefty machines (e.g one with 48 
> cores and 128GB of RAM) and so perhaps the default/heuristic settings aren't 
> optimal.

Increasing "-A" and "-H" in the RTS options should help with this.

G
--
Gregory Collins 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] SMP parallelism increasing GC time dramatically

2011-10-10 Thread Tom Thorne
thanks! I just tried setting -A32M and this seems to fix the parallel GC
problems, I now get a speedup with parallel GC on and performance is the
same as passing -qg. I had tried -H before and it only made things worse,
but -A seems to do the trick.

I'm still having problems with segmentation faults though. Depending on how
I apply parMap, and whether I use monad-par or control.parallel, they seem
to come and go arbitrarily. In a successful run that lasted about 30s in
total with control.parallel, +RTS -s reports:
SPARKS: 422712 (394377 converted, 0 pruned)

am I creating too many sparks?

On Mon, Oct 10, 2011 at 3:07 PM, Gregory Collins wrote:

> On Mon, Oct 10, 2011 at 3:55 PM, Tom Thorne 
> wrote:
> >
> > Yes I will try to run threadscope on it, I tried it before and the event
> log output produced about 1.8GB, and then crashed.
> > Is there any way to tell the RTS to perform GC less often? My code
> doesn't use too much memory and I'm using fairly hefty machines (e.g one
> with 48 cores and 128GB of RAM) and so perhaps the default/heuristic
> settings aren't optimal.
>
> Increasing "-A" and "-H" in the RTS options should help with this.
>
> G
> --
> Gregory Collins 
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] cabal license check?

2011-10-10 Thread Eric Y. Kow
Hi all,

I'd like a tool that takes a .cabal file as input and produces a list of
all dependencies (recursive, all the way to 'base') and some metadata
for each (most importantly, LICENSE)

Does this already exist, or will I to write it myself?

I notice that there's a patch by Trevor Elliot to either Cabal or
cabal-install that does something similar [1], and I know that Magnus
Therning wrote a little tool that creates a GraphViz graph [2]... so it
seems like all the pieces are there already.  But is there anything in
some sort of ready-to-go just-works state, doing everything including
interacting with hackage and sucking down the cabal files it needs, etc?

Thanks,

Eric

[1]: http://www.haskell.org/pipermail/cabal-devel/2010-October/006657.html
[2]: http://therning.org/magnus/archives/534

-- 
Eric Kow 


pgpZHM5wGwXPp.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal license check?

2011-10-10 Thread Felipe Almeida Lessa
On Mon, Oct 10, 2011 at 11:53 AM, Eric Y. Kow  wrote:
> I notice that there's a patch by Trevor Elliot to either Cabal or
> cabal-install that does something similar [1], and I know that Magnus
> Therning wrote a little tool that creates a GraphViz graph [2]... so it
> seems like all the pieces are there already.  But is there anything in
> some sort of ready-to-go just-works state, doing everything including
> interacting with hackage and sucking down the cabal files it needs, etc?

Talking about Hackage, in an ideal Hackage this information should be
displayed right into the package's front page as well.  One may have
wishes, right?  =)

Cheers,

-- 
Felipe.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] SMP parallelism increasing GC time dramatically

2011-10-10 Thread Simon Marlow

On 08/10/2011 01:47, austin seipp wrote:

It's GHC, and partly the OS scheduler in some sense. Oversaturating,
i.e. using an -N option>  your number of logical cores (including
hyperthreads) will slow down your program typically. This isn't
uncommon, and is well known - GHC's lightweight threads have an M:N
threading model, but for good performance, you typically want the OS
threads and cores to have a 1:1 correspondence. Creating a massive
amount of OS threads will cause much context switching between them,
which is going to slow things down. When GHC needs to synchronize OS
threads in order to do a GC, there are going to be a lot of threads
being context swapped in/out in order to achieve this (because the GC
must halt all mutator threads to do its thing.)

Furthermore, oversaturation isn't the only problem - having the same
number of threads as cores will mean *some* thread is going to get
de-scheduled. Many times this means that the thread in which GHC does
GC will get descheduled by the OS. A corollary of this descheduling
phenomenon is that even using the same # of OS threads as you have
cores could result in -worse- performance than N-1 OS threads. This
was mitigated a bit in 7.2.1 I think. Linux was affected much more
drastically than others (OS X and Solaris have vastly different
schedulers, and as a result the performance wouldn't just tank - it
would actually get better IIRC, it just wouldn't scale as well at that
point.) At the very least, on Linux, using an -N option equivalent to
your number of logical cores should not drastically slow things down
anymore - but it won't make them faster either. This is the "dreaded
last core slowdown" bug that's been known about for a while, and as a
result, you typically only see parallel speedup on Linux up to N-1
threads, where N = the number of cores you have.


Incidentally, I don't think that's true any more with recent versions of 
GHC and Linux, I typically see speedup increasing all the way to the 
total number of cores, although sometimes the speedup when adding the 
last core is less.  Take a look at the graphs in our recent papers for 
some concrete results.



As a result, with dual-core only (and no hyperthreading,) on Linux,
you're very unlikely to be able to get parallel speedup in any case.
There's work to fix this in the garbage collector among other things,
but it's not clear if it's going into GHC just yet.


It probably depends on how much other activity is happening on the 
system.  I get pretty good speedups for most benchmarks I try on my 
dual-core laptop running either Linux or Windows.  Typically with 
Windows I have to wait a while after booting for all the background 
activity to die down, before I can use both cores reliably.


Cheers,
Simon



On Fri, Oct 7, 2011 at 2:31 PM, Oliver Batchelor  wrote:

I'm not sure if this is at all related, but if I run a small Repa program
with more threads than I have cores/CPUs then it gets drastically slower, I
have a dual core laptop - and -N2 makes my small program take approximately
0.6 of the time. Increasing to -N4 and we're running about 2x the time, -N8
and it's taking 20x or more. I guess this is probably more down to the
design of Repa rather than GHC itself?
Oliver

On Sat, Oct 8, 2011 at 1:21 AM, Tom Thorne
wrote:


I have made a dummy program that seems to exhibit the same GC
slowdown behavior, minus the segmentation faults. Compiling with -threaded
and running with -N12 I get very bad performance (3x slower than -N1),
running with -N12 -qg it runs approximately 3 times faster than -N1. I don't
know if I should submit this as a bug or not? I'd certainly like to know why
this is happening!
import Numeric.LinearAlgebra
import Numeric.GSL.Special.Gamma
import Control.Parallel.Strategies
import Control.Monad
import Data.IORef
import Data.Random
import Data.Random.Source.PureMT
import Debug.Trace
--
subsets s n = (subsets_stream s) !! n
subsets_stream [] = [[]] : repeat []
subsets_stream (x:xs) =
let r = subsets_stream xs
s = map (map (x:)) r
in [[]] : zipWith (++) s (tail r)
testfun :: Matrix Double ->  Int ->  [Int] ->  Double
testfun x k cs = lngamma (det (c+u))
where
(m,c) = meanCov xx
m' = fromRows [m]
u = (trans m')<>  m'
xx = fromColumns ( [(toColumns x)!!i] ++ [(toColumns x)!!j] ++ [(toColumns
x)!!k] )
i = cs !! 0
j = cs !! 1

test :: Matrix Double ->  Int ->  Double
test x i = sum p
where
p = parMap (rdeepseq) (testfun x (i+1)) (subsets [0..i] 2)


ranMatrix :: Int ->  RVar (Matrix Double)
ranMatrix n = do
xs<- mapM (\_ ->  mapM (\_ ->  uniform 0 1.0) [1..n]) [1..n]
return (fromLists xs)

loop :: Int ->  Double ->  Int ->  RVar Double
loop n s i = traceShow i $ do
x<- ranMatrix n
let r = sum $ parMap (rdeepseq) (test x) [2..(n-2)]
return (r+s)
main = do
let n = 100
let iter = 5
rng<- newPureMT
rngr<- newIORef rng
p<- runRVar (foldM (loop n) 0.0 [1..iter]) rngr
print p
I have also found that the segmentation faults in my code disappear if I
switch from Control.Para

Re: [Haskell-cafe] SMP parallelism increasing GC time dramatically

2011-10-10 Thread Simon Marlow

On 10/10/2011 15:44, Tom Thorne wrote:

thanks! I just tried setting -A32M and this seems to fix the parallel GC
problems, I now get a speedup with parallel GC on and performance is the
same as passing -qg. I had tried -H before and it only made things
worse, but -A seems to do the trick.

I'm still having problems with segmentation faults though. Depending on
how I apply parMap, and whether I use monad-par or control.parallel,
they seem to come and go arbitrarily. In a successful run that lasted
about 30s in total with control.parallel, +RTS -s reports:
SPARKS: 422712 (394377 converted, 0 pruned)

am I creating too many sparks?


Please report the bug.  General rule: if in doubt, report it.  We'll 
decide whether it's a bug or not.  If it's a segfault, and you're not 
doing any FFI or unsafe stuff, and your hardware isn't faulty, then it's 
definitely a bug.


Cheers,
Simon



On Mon, Oct 10, 2011 at 3:07 PM, Gregory Collins
mailto:g...@gregorycollins.net>> wrote:

On Mon, Oct 10, 2011 at 3:55 PM, Tom Thorne
mailto:thomas.thorn...@gmail.com>> wrote:
 >
 > Yes I will try to run threadscope on it, I tried it before and
the event log output produced about 1.8GB, and then crashed.
 > Is there any way to tell the RTS to perform GC less often? My
code doesn't use too much memory and I'm using fairly hefty machines
(e.g one with 48 cores and 128GB of RAM) and so perhaps the
default/heuristic settings aren't optimal.

Increasing "-A" and "-H" in the RTS options should help with this.

G
--
Gregory Collins mailto:g...@gregorycollins.net>>




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal license check?

2011-10-10 Thread Henk-Jan van Tuyl

On Mon, 10 Oct 2011 16:53:29 +0200, Eric Y. Kow  wrote:


Hi all,

I'd like a tool that takes a .cabal file as input and produces a list of
all dependencies (recursive, all the way to 'base') and some metadata
for each (most importantly, LICENSE)

Does this already exist, or will I to write it myself?

I notice that there's a patch by Trevor Elliot to either Cabal or
cabal-install that does something similar [1], and I know that Magnus
Therning wrote a little tool that creates a GraphViz graph [2]... so it
seems like all the pieces are there already.  But is there anything in
some sort of ready-to-go just-works state, doing everything including
interacting with hackage and sucking down the cabal files it needs, etc?


cab[0] can do that, for installed packages:
  cab deps -i -r -a vector
will generate a list of licenses for vector and the packages it depends  
upon, like this:

base 4.3.1.0 BSD3 ""
ghc-prim 0.2.0.0 BSD3 ""
rts 1.0 BSD3 ""
ffi 1.0 BSD3 ""
integer-gmp 0.2.0.3 BSD3 ""
ghc-prim 0.2.0.0 BSD3 ""
rts 1.0 BSD3 ""
ffi 1.0 BSD3 ""
rts 1.0 BSD3 ""
ffi 1.0 BSD3 ""
primitive 0.4.0.1 BSD3 "Roman Leshchinskiy "
base 4.3.1.0 BSD3 ""
ghc-prim 0.2.0.0 BSD3 ""
rts 1.0 BSD3 ""
ffi 1.0 BSD3 ""
integer-gmp 0.2.0.3 BSD3 ""
ghc-prim 0.2.0.0 BSD3 ""
rts 1.0 BSD3 ""
ffi 1.0 BSD3 ""
rts 1.0 BSD3 ""
ffi 1.0 BSD3 ""
ghc-prim 0.2.0.0 BSD3 ""
rts 1.0 BSD3 ""
ffi 1.0 BSD3 ""


Regards,
Henk-Jan van Tuyl

[0] http://hackage.haskell.org/package/cab


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Question: Lazy Incremental Evaluation and Haskell?

2011-10-10 Thread Benjamin Redelings

On 10/08/2011 12:46 PM, Jan-Willem Maessen wrote:

On Fri, Oct 7, 2011 at 2:46 PM, Brandon Moore  wrote:

Margnus Carlsson did something monadic several years ago.

http://dl.acm.org/citation.cfm?doid=581478.581482

Perhaps there is an implementation on Hackage or on his website.

This stuff also goes by the moniker "adaptive computation". See the
references and citations of that paper for more on this.

Umut Acar now seems to refer to this as "self-adjusting computation",
and has some work here:

http://umut.mpi-sws.org/self-adjusting-computation

In particular, there seems to be a modified version of Mlton.

To tie things together a bit, Magnus Carlsson's paper was based on
Umut Acar's earlier work.  Note in particular that there's a lot of
emphasis placed on efficiently figuring out what computation needs to
be re-done (and some theory to support those efficiency claims).  FRP
frameworks, etc. naively re-do rather too much computation (all of it,
in particularly poor cases) compared to systems specifically tailored
to self-adjustment.

-Jan-Willem Maessen


1. Thank you!  This is the kind of thing I was looking for.  It
(a) uses compiler/interpreter infrastructure (not explicit programmer 
directives) to
(b) construct a dynamic dependency graph that reflects the structure of 
the computation.
I am curious if anyone has constructed a modified STG machine (which 
doesn't modify running code, I guess?) or alternatively a graph-based 
machine like Sestoft's mark 1 machine (that actually modifies running 
code) that would track dependencies.  That would be call-by-need instead 
of call-by-value.


(Just for clarification, I am interested in calculations where the 
individual operations (e.g. analogous to '+') are extremely slow and are 
currently written in C++.  Therefore, a certain amount of overhead seems 
tolerable.  )


2. Another question would be: most of the "self-adjusting computation" 
frameworks seem to assume that we always throw away the old 
computation.  For function optimization (or, alternatively, Markov chain 
Monte Carlo random walks) we keep either the old or the new computation 
based on the result of the new computation.  Thus, we would not like to 
simply over-write the old computation when we do the new computation.  
This could mean splitting (part of) the dynamic dependency graph, which 
might incur a lot of memory allocation overhead...


-BenRI

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Three questions to graphviz

2011-10-10 Thread kaffeepause73
First of all - thanks a lot for this package, graphviz is an awesome tool and
having this interface library is really convenient. There a three point
where I could use some help: 

1. when I try to create a label with e.g.: textLabelValue "Hallo"  -
the compiler complains he can't match string with data.text.lazy.internal 

-- I have idea how to create lazy internal text !

2. I know how to rotate the whole diagram (with landscape or rotate 90), but
not how to keep
all the text in unrotated position -- is there a command to do this ?

3. When I create a symmetric tree with two directions on the two sides. The
tree gets completely messed up when I enter the right directions. (left
graph ok but wrong edge dirs, right graph with correct dirs but gemetry
scambled). - It has todo with ranking order which is based on the direction
of the edges. I can fake it with reversing the arrows in the diagram, but my
original graph data is coming directed ...

Cheers Phil

http://haskell.1045720.n5.nabble.com/file/n418/GraphA.jpg 
http://haskell.1045720.n5.nabble.com/file/n418/GraphC.jpg


--
View this message in context: 
http://haskell.1045720.n5.nabble.com/Three-questions-to-graphviz-tp418p418.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Three questions to graphviz

2011-10-10 Thread David Barbour
On Mon, Oct 10, 2011 at 9:44 AM, kaffeepause73 wrote:

> First of all - thanks a lot for this package, graphviz is an awesome tool
> and
> having this interface library is really convenient. There a three point
> where I could use some help:
>
> 1. when I try to create a label with e.g.: textLabelValue "Hallo"  -
> the compiler complains he can't match string with data.text.lazy.internal
>
> -- I have idea how to create lazy internal text !
>

import qualified Data.Text.Lazy as L
textLabelValue $ L.pack "Hallo"

That's the only question I know how to answer.

Regards,

Dave
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] SMP parallelism increasing GC time dramatically

2011-10-10 Thread Erik Hesselink
On Mon, Oct 10, 2011 at 16:44, Tom Thorne  wrote:
> thanks! I just tried setting -A32M and this seems to fix the parallel GC
> problems, I now get a speedup with parallel GC on and performance is the
> same as passing -qg. I had tried -H before and it only made things worse,
> but -A seems to do the trick.

You might be able to use ghc-gc-tune [1] to find the right settings
for -A and -H.

Erik

[1] http://hackage.haskell.org/package/ghc-gc-tune

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Three questions to graphviz

2011-10-10 Thread kaffeepause73
Hi Dave,

Thanks for the quick reply - it works now. - I wasted quite a bit time on
this.
I guess the "internal" bit in the compiler message confused me.

Cheers Phil

--
View this message in context: 
http://haskell.1045720.n5.nabble.com/Three-questions-to-graphviz-tp418p4888946.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Three questions to graphviz

2011-10-10 Thread Ketil Malde
kaffeepause73  writes:

> Thanks for the quick reply - it works now. - I wasted quite a bit time on
> this.

Alternatively, you can turn on overloaded strings, which allows constructing
text values (along with other types that are instances of IsString) from
string constants.  Add 

{-# Language OverloadedStrings #-}

at the top of your source file to enable it.

> I guess the "internal" bit in the compiler message confused me.

It is a common idiom to put "internals" -- e.g. data type definitions --
in a module called "Internal".

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread dokondr
Hi,
I need to call Stanford NLP Parser from Haskell (unfortunately Haskell does
not have a similar one):
http://nlp.stanford.edu/software/lex-parser.shtml

What would be the most reliable framework for this?

Thanks!
Dmitri
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: ircbot 0.1.1

2011-10-10 Thread Jeremy Shaw

Hello,

I have just released a new library on hackage called ircbot. (Because  
that is what Haskell really needs -- another irc bot library).


http://hackage.haskell.org/package/ircbot

A demo app is here:

http://patch-tag.com/r/stepcut/ircbot/snapshot/current/content/pretty/demo.hs

The demo is pretty non-thrilling. 98% of it is parsing command-line  
arguments, and then it calls a simple bot with two parts:


 pingPart - part that handles server PING/PONG requests
 dicePart - a simple part that lets you roll dice

Here is an example session:

 synthea: dice 3d4+12
 You rolled 3 4-sided dice with a +12 modifier: [1,3,4] => 20

The primary reason this library exists is that a long time ago, I  
needed a way to log the #happs channel. So I coded up a little logging  
bot using the irc library from hackage.


Then later I decided to fork the irc logging out of the happstack.com  
server itself and into a resuable irc bot library.


The library has the following features:

 1. a reconnect loop that tries really hard to make sure the bot  
notices if it is disconnected and tries to reconnect.


 2. a channel logging facility that automatically rolls over to a new  
log file every day.


 3. a BotMonad class and BotPartT monad which make it easy to create  
handlers for incoming messages:


http://patch-tag.com/r/stepcut/ircbot/snapshot/current/content/pretty/Network/IRC/Bot/BotMonad.hs

Each bot part is run in its own thread. Incoming messages are  
delivered to all the parts. That is useful because some parts, like  
the seen command, need to see every incoming message, even if they do  
not actively respond to them. Because the parts are handled by  
different threads, they do not block each other.


By default, each part is single-threaded. That is because some parts  
may need to see multiple messages and see them in the order they  
originally arrived. However, a part can easily call forkIO to handle  
each incoming Message and avoid blocking when appropriate.


 4. a wrapper that let's you use Parsec to parse an incoming message.  
It is used by the dicePart:


http://patch-tag.com/r/stepcut/ircbot/snapshot/current/content/pretty/Network/IRC/Bot/Part/Dice.hs

Using parsec gives you an easy way to specify syntax errors:

  synthea: dice
 unexpected end of input; expecting dice dsides>[+]


Future work:

1. The library is based around the old String based irc library. Would  
be nice to upgrade to something that used ByteStrings+Text+Builder.  
Practically speaking.. it's IRC. The maximum line length is 510  
characters, and the bot typically needs to handle, at most, a few  
messages per second. So, space and time issues would only be a  
practical concern if your bot is joining hundreds of channels. But,  
that is no excused not to use Text :) Perhaps the fastirc library?


2. The channel logging feature needs some minor changes so that more  
than one channel at a time can be logged


3. the bot needs to do something sane if the nick it wants is already  
in use. It should also support nick registration.


4. needs automatic help text generation

5. documentation

6. It should be possible to support dynamically reloadable plugins.  
Most of the technology exists in happstack-plugins + plugins. We just  
need to finish splitting happstack-plugins into two packages.


7. clustering support. ircbot does not have any built-in persistent  
storage. It should work fine with acid-state, SQL, etc. When acid- 
state gets multimaster replication support, it would be nice if there  
was an automatic failover system. Basically, you could have two or  
more bots in the channel using acid-state replication. Queries would  
normally be answered by the primary bot, but if the primary bot goes  
offline, the secondary bot could answer the queries instead.


8. windows support - the channel logging feature uses the unix  
package, which is not supported on Windows. The rest of the code is  
already portable.


Anyway. Enjoy!

- Jeremy


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Three questions to graphviz

2011-10-10 Thread Ivan Lazar Miljenovic
On 11 October 2011 03:44, kaffeepause73  wrote:
> First of all - thanks a lot for this package, graphviz is an awesome tool and
> having this interface library is really convenient. There a three point
> where I could use some help:
>
> 2. I know how to rotate the whole diagram (with landscape or rotate 90), but
> not how to keep
> all the text in unrotated position -- is there a command to do this ?

I don't think this is possible: the rotation seems to be a
post-processing feature done by GraphViz.  If you just want the graph
laid out Left-to-Right rather than Top-to-Bottom, try setting the
RankDir attribute:
http://hackage.haskell.org/packages/archive/graphviz/2999.12.0.3/doc/html/Data-GraphViz-Attributes-Complete.html#v:RankDir

(though I've just noticed that the Ordering attribute should take in a
specific type rather than just Text... *goes off to fix*)

> 3. When I create a symmetric tree with two directions on the two sides. The
> tree gets completely messed up when I enter the right directions. (left
> graph ok but wrong edge dirs, right graph with correct dirs but gemetry
> scambled). - It has todo with ranking order which is based on the direction
> of the edges. I can fake it with reversing the arrows in the diagram, but my
> original graph data is coming directed ...

This means you need to tweak and play around with the settings more.

My approach (and I'm the maintainer of the graphviz library!) for
stuff like this is:

* Get some sample Dot code (either write it by hand or use graphviz to
generate it from your data).

* Look through all the available attributes for ones that might deal
with layout of nodes, edges, etc. at:
http://www.graphviz.org/doc/info/attrs.html

* Try setting them into your Dot code, then use the appropriate
Graphviz command (dot, neato, circo, etc. depending on which layout
you want); consider something like "dot -Txlib test.dot" to get a
preview window up, or "dot -Tpng test.dot > test.png" to get a png
image.

* Once you've found attributes that seem to do what you want, use the
graphviz versions of them in your Haskell code.

Note also that because Graphviz uses automatic layout algorithms, you
can't always get it to output in the way that would make sense if you
drew it by hand.  I've been told that things like phantom nodes
(invisible nodes that you insert with extra edges to force spaces,
alignment, etc.) can help, but I've never looked into using them
enough to work out approaches of how/when to do so.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Implementing a new primtype

2011-10-10 Thread Paul Monday
There seems to be plenty of documentation around on implementing a new primop, 
much of it needs some tweaking as files have moved and such.  I can't seem to 
find any documentation about how to implement primtypes though.

For example, I want to experiment with a new primtype "DV#", my assumption that 
the type was first declared in the primops.txt.pp seems incorrect.  So I'm 
trying to backtrack a bit and see where primtypes first appear, I'm hoping 
someone can at least give me a pointer :-)

For example:
./compiler/prelude/primops.txt.pp

Add the following:
primtype DoubleVec# a

Compiles fine

Add a primop on the type:
primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
   DoubleVec# -> Int# -> Double#

And suddenly it's not as friendly.  I expected a compile issue since I hadn't 
added it to CgPrimOps.hs yet, but this is not that compile problem:
make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
/usr/bin/gcc -E  -undef -traditional -P -Iincludes  -x c 
compiler/prelude/primops.txt.pp | grep -v '^#pragma GCC' > 
compiler/prelude/primops.txt
"inplace/bin/genprimopcode" --data-decl  < compiler/prelude/primops.txt 
> compiler/primop-data-decl.hs-incl
"inplace/bin/genprimopcode" --primop-tag < compiler/prelude/primops.txt 
> compiler/primop-tag.hs-incl
"inplace/bin/genprimopcode" --primop-list< compiler/prelude/primops.txt 
> compiler/primop-list.hs-incl
"inplace/bin/genprimopcode" --has-side-effects   < compiler/prelude/primops.txt 
> compiler/primop-has-side-effects.hs-incl
"inplace/bin/genprimopcode" --out-of-line< compiler/prelude/primops.txt 
> compiler/primop-out-of-line.hs-incl
"inplace/bin/genprimopcode" --commutable < compiler/prelude/primops.txt 
> compiler/primop-commutable.hs-incl
"inplace/bin/genprimopcode" --code-size  < compiler/prelude/primops.txt 
> compiler/primop-code-size.hs-incl
"inplace/bin/genprimopcode" --can-fail   < compiler/prelude/primops.txt 
> compiler/primop-can-fail.hs-incl
"inplace/bin/genprimopcode" --strictness < compiler/prelude/primops.txt 
> compiler/primop-strictness.hs-incl
"inplace/bin/genprimopcode" --primop-primop-info < compiler/prelude/primops.txt 
> compiler/primop-primop-info.hs-incl
genprimopcode: ppType: can't handle: TyApp "DoubleVec#" []

make[1]: *** [compiler/primop-primop-info.hs-incl] Error 1
make[1]: *** Deleting file `compiler/primop-primop-info.hs-incl'
make: *** [all] Error 2


So, I'm thinking the type needs to be better defined but I haven't tracked it 
down yet (I'm working on it though ;-)

Any clues?

Paul Monday
Parallel Scientific, LLC.
paul.mon...@parsci.com




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Implementing a new primtype

2011-10-10 Thread Daniel Fischer
On Tuesday 11 October 2011, 00:57:39, Paul Monday wrote:
> There seems to be plenty of documentation around on implementing a new
> primop, much of it needs some tweaking as files have moved and such.  I
> can't seem to find any documentation about how to implement primtypes
> though.
> 
> For example, I want to experiment with a new primtype "DV#", my
> assumption that the type was first declared in the primops.txt.pp seems
> incorrect.  So I'm trying to backtrack a bit and see where primtypes
> first appear, I'm hoping someone can at least give me a pointer :-)
> 
> For example:
> ./compiler/prelude/primops.txt.pp
> 
> Add the following:
> primtype DoubleVec# a

Has a type parameter

> 
> Compiles fine
> 
> Add a primop on the type:
> primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
>DoubleVec# -> Int# -> Double#

Used without type parameter

Might be as simple as that.

> genprimopcode: ppType: can't handle: TyApp "DoubleVec#" []


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Implementing a new primtype

2011-10-10 Thread Paul Monday
No, I've tried with and without the type parameter, it's the same "type" of 
error leading me to think there is something I'm missing about prim type 
declarations, here are the variations.


primtype DoubleVec#

primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
   DoubleVec# -> Int# -> Double#

make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
/usr/bin/gcc -E  -undef -traditional -P -Iincludes  -x c 
compiler/prelude/primops.txt.pp | grep -v '^#pragma GCC' > 
compiler/prelude/primops.txt
"inplace/bin/genprimopcode" --data-decl  < compiler/prelude/primops.txt 
> compiler/primop-data-decl.hs-incl
"inplace/bin/genprimopcode" --primop-tag < compiler/prelude/primops.txt 
> compiler/primop-tag.hs-incl
"inplace/bin/genprimopcode" --primop-list< compiler/prelude/primops.txt 
> compiler/primop-list.hs-incl
"inplace/bin/genprimopcode" --has-side-effects   < compiler/prelude/primops.txt 
> compiler/primop-has-side-effects.hs-incl
"inplace/bin/genprimopcode" --out-of-line< compiler/prelude/primops.txt 
> compiler/primop-out-of-line.hs-incl
"inplace/bin/genprimopcode" --commutable < compiler/prelude/primops.txt 
> compiler/primop-commutable.hs-incl
"inplace/bin/genprimopcode" --code-size  < compiler/prelude/primops.txt 
> compiler/primop-code-size.hs-incl
"inplace/bin/genprimopcode" --can-fail   < compiler/prelude/primops.txt 
> compiler/primop-can-fail.hs-incl
"inplace/bin/genprimopcode" --strictness < compiler/prelude/primops.txt 
> compiler/primop-strictness.hs-incl
"inplace/bin/genprimopcode" --primop-primop-info < compiler/prelude/primops.txt 
> compiler/primop-primop-info.hs-incl
genprimopcode: ppType: can't handle: TyApp "DoubleVec#" []

make[1]: *** [compiler/primop-primop-info.hs-incl] Error 1
make[1]: *** Deleting file `compiler/primop-primop-info.hs-incl'
make: *** [all] Error 2

And:
primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
   DoubleVec# a -> Int# -> Double#

make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
/usr/bin/gcc -E  -undef -traditional -P -Iincludes  -x c 
compiler/prelude/primops.txt.pp | grep -v '^#pragma GCC' > 
compiler/prelude/primops.txt
"inplace/bin/genprimopcode" --data-decl  < compiler/prelude/primops.txt 
> compiler/primop-data-decl.hs-incl
"inplace/bin/genprimopcode" --primop-tag < compiler/prelude/primops.txt 
> compiler/primop-tag.hs-incl
"inplace/bin/genprimopcode" --primop-list< compiler/prelude/primops.txt 
> compiler/primop-list.hs-incl
"inplace/bin/genprimopcode" --has-side-effects   < compiler/prelude/primops.txt 
> compiler/primop-has-side-effects.hs-incl
"inplace/bin/genprimopcode" --out-of-line< compiler/prelude/primops.txt 
> compiler/primop-out-of-line.hs-incl
"inplace/bin/genprimopcode" --commutable < compiler/prelude/primops.txt 
> compiler/primop-commutable.hs-incl
"inplace/bin/genprimopcode" --code-size  < compiler/prelude/primops.txt 
> compiler/primop-code-size.hs-incl
"inplace/bin/genprimopcode" --can-fail   < compiler/prelude/primops.txt 
> compiler/primop-can-fail.hs-incl
"inplace/bin/genprimopcode" --strictness < compiler/prelude/primops.txt 
> compiler/primop-strictness.hs-incl
"inplace/bin/genprimopcode" --primop-primop-info < compiler/prelude/primops.txt 
> compiler/primop-primop-info.hs-incl
genprimopcode: ppType: can't handle: TyApp "DoubleVec#" [TyVar "a"]

make[1]: *** [compiler/primop-primop-info.hs-incl] Error 1
make[1]: *** Deleting file `compiler/primop-primop-info.hs-incl'
make: *** [all] Error 2

Paul Monday
Parallel Scientific, LLC.
paul.mon...@parsci.com




On Oct 10, 2011, at 5:10 PM, Daniel Fischer wrote:

> On Tuesday 11 October 2011, 00:57:39, Paul Monday wrote:
>> There seems to be plenty of documentation around on implementing a new
>> primop, much of it needs some tweaking as files have moved and such.  I
>> can't seem to find any documentation about how to implement primtypes
>> though.
>> 
>> For example, I want to experiment with a new primtype "DV#", my
>> assumption that the type was first declared in the primops.txt.pp seems
>> incorrect.  So I'm trying to backtrack a bit and see where primtypes
>> first appear, I'm hoping someone can at least give me a pointer :-)
>> 
>> For example:
>> ./compiler/prelude/primops.txt.pp
>> 
>> Add the following:
>> primtype DoubleVec# a
> 
> Has a type parameter
> 
>> 
>> Compiles fine
>> 
>> Add a primop on the type:
>> primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
>>   DoubleVec# -> Int# -> Double#
> 
> Used without type parameter
> 
> Might be as simple as that.
> 
>> genprimopcode: ppType: can't handle: TyApp "DoubleVec#" []
> 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread Claude Lee
Hi,

vote+1.

Theoretically, you can bridge Haskell and Java with FFI. It applys to small
projects. Larger ones may need some build tools...

Claude

2011/10/11 dokondr 

> Hi,
> I need to call Stanford NLP Parser from Haskell (unfortunately Haskell does
> not have a similar one):
> http://nlp.stanford.edu/software/lex-parser.shtml
>
> What would be the most reliable framework for this?
>
> Thanks!
> Dmitri
>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread Aatch
There are some projects to try and provide a bridge between Haskell
and the JVM. Unfortunately none of the seem to have much development.
As it stands, there is GCJNI, which allows Haskell to invoke Java
code, seems like a Java version of hsc2hs, but the site is down, it
just 404s. There is also haskell-jvm-bridge, but that doesn't look
like it has any development for about 18 months, and there isn't much
about it. Then there is LambdaVM, which looks the most promising, as
it compiles GHC byte-code to JVM bytecode. However, it doesn't look it
has been updated in a few years.
You can try your luck with any of those, but currently, if you want a
decent FFI for Java, you're probably going to have to resurrect one of
those projects.

---
James Miller



On 11 October 2011 15:26, Claude Lee  wrote:
> Hi,
>
> vote+1.
>
> Theoretically, you can bridge Haskell and Java with FFI. It applys to small
> projects. Larger ones may need some build tools...
>
> Claude
>
> 2011/10/11 dokondr 
>>
>> Hi,
>> I need to call Stanford NLP Parser from Haskell (unfortunately Haskell
>> does not have a similar one):
>> http://nlp.stanford.edu/software/lex-parser.shtml
>>
>> What would be the most reliable framework for this?
>>
>> Thanks!
>> Dmitri
>>
>>
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Three questions to graphviz

2011-10-10 Thread kaffeepause73
Hi Ivan, 

I already played around a fair bit with options in both cases, but
there are quite a few so it gets quite worky with try and error. 

Going to graphviz directly doesn't seem a bad idea.

Thanks Phil

--
View this message in context: 
http://haskell.1045720.n5.nabble.com/Three-questions-to-graphviz-tp418p4890775.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread JP Moresmau
I had started a project to start a JVM and call Java code from
Haskell, but got sidetracked into EclipseFP, but I hope to go back to
it someday.
https://github.com/JPMoresmau/HJVM. Have a look at the test suite for
some examples.

Hope this helps

JP

On Tue, Oct 11, 2011 at 7:20 AM, Aatch  wrote:
> There are some projects to try and provide a bridge between Haskell
> and the JVM. Unfortunately none of the seem to have much development.
> As it stands, there is GCJNI, which allows Haskell to invoke Java
> code, seems like a Java version of hsc2hs, but the site is down, it
> just 404s. There is also haskell-jvm-bridge, but that doesn't look
> like it has any development for about 18 months, and there isn't much
> about it. Then there is LambdaVM, which looks the most promising, as
> it compiles GHC byte-code to JVM bytecode. However, it doesn't look it
> has been updated in a few years.
> You can try your luck with any of those, but currently, if you want a
> decent FFI for Java, you're probably going to have to resurrect one of
> those projects.
>
> ---
> James Miller
>
>
>
> On 11 October 2011 15:26, Claude Lee  wrote:
>> Hi,
>>
>> vote+1.
>>
>> Theoretically, you can bridge Haskell and Java with FFI. It applys to small
>> projects. Larger ones may need some build tools...
>>
>> Claude
>>
>> 2011/10/11 dokondr 
>>>
>>> Hi,
>>> I need to call Stanford NLP Parser from Haskell (unfortunately Haskell
>>> does not have a similar one):
>>> http://nlp.stanford.edu/software/lex-parser.shtml
>>>
>>> What would be the most reliable framework for this?
>>>
>>> Thanks!
>>> Dmitri
>>>
>>>
>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
JP Moresmau
http://jpmoresmau.blogspot.com/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread Michael Snoyman
Perhaps my needs are unique here, but I thought I'd mention them
anyway. The main tool we use at work is based on a hodge-podge of
Java, Ant and XSLT code[1]. This thing has to be constantly extended
to support new functionality (or fix one of its myriad bugs), and
there's no technical hurdle to using Haskell to that end. In fact, my
company has released a few packages[2][3][4] specifically in this
venture.

There are two problems, however:

* Some clients have an insistence that code run on the JVM.
* It's inconvenient having multiple executables. Additionally, I've
run into some problems in the past deploying to ancient Linux
servers[5].

So for my use case, I don't care at all about interacting with Java
code, I simply want to be able to turn my existing Haskell code into a
JAR file. This seems like a much simpler undertaking, but I'm still
not aware of any way to get this to happen right now either.

Michael

[1] http://dita-ot.sourceforge.net/
[2] http://hackage.haskell.org/package/xml-enumerator
[3] http://hackage.haskell.org/package/xml-hamlet
[4] http://hackage.haskell.org/package/uri-enumerator
[5] 
http://stackoverflow.com/questions/5953199/create-a-static-haskell-linux-executable

On Tue, Oct 11, 2011 at 8:15 AM, JP Moresmau  wrote:
> I had started a project to start a JVM and call Java code from
> Haskell, but got sidetracked into EclipseFP, but I hope to go back to
> it someday.
> https://github.com/JPMoresmau/HJVM. Have a look at the test suite for
> some examples.
>
> Hope this helps
>
> JP
>
> On Tue, Oct 11, 2011 at 7:20 AM, Aatch  wrote:
>> There are some projects to try and provide a bridge between Haskell
>> and the JVM. Unfortunately none of the seem to have much development.
>> As it stands, there is GCJNI, which allows Haskell to invoke Java
>> code, seems like a Java version of hsc2hs, but the site is down, it
>> just 404s. There is also haskell-jvm-bridge, but that doesn't look
>> like it has any development for about 18 months, and there isn't much
>> about it. Then there is LambdaVM, which looks the most promising, as
>> it compiles GHC byte-code to JVM bytecode. However, it doesn't look it
>> has been updated in a few years.
>> You can try your luck with any of those, but currently, if you want a
>> decent FFI for Java, you're probably going to have to resurrect one of
>> those projects.
>>
>> ---
>> James Miller
>>
>>
>>
>> On 11 October 2011 15:26, Claude Lee  wrote:
>>> Hi,
>>>
>>> vote+1.
>>>
>>> Theoretically, you can bridge Haskell and Java with FFI. It applys to small
>>> projects. Larger ones may need some build tools...
>>>
>>> Claude
>>>
>>> 2011/10/11 dokondr 

 Hi,
 I need to call Stanford NLP Parser from Haskell (unfortunately Haskell
 does not have a similar one):
 http://nlp.stanford.edu/software/lex-parser.shtml

 What would be the most reliable framework for this?

 Thanks!
 Dmitri



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

>>>
>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>>
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
>
> --
> JP Moresmau
> http://jpmoresmau.blogspot.com/
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Three questions to graphviz

2011-10-10 Thread Ivan Lazar Miljenovic
On 11 October 2011 17:00, kaffeepause73  wrote:
> Hi Ivan,
>
> I already played around a fair bit with options in both cases, but
> there are quite a few so it gets quite worky with try and error.

Definitely.  I've never bothered fully documenting
Data.GraphViz.Attributes.Complete fully solely because there are so
many attributes, and at best I'd just be copy/pasting stuff from the
upstream docs.

As I add more "user-friendly" options to Data.GraphViz.Attributes, I'm
starting to provide more specific comments regarding usage, etc.

Basically: if I find a specific attribute to be useful with some
corner cases or usage tricks where it's useful, I add documentation.
I welcome anyone sending me patches (or even a chunk of text via
email) about specific attributes to help flesh it out.

> Going to graphviz directly doesn't seem a bad idea.

Well, it just takes the middle-man out of the loop.  The upstream
documentation is sometimes a little scarce about what all the
attributes do, and playing around with them usually ends up being more
informative.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread JP Moresmau
Maybe your Haskell code could be compiled with only minor
modifications on something like CAL or Frege? There seems to be some
interest in them these days, so maybe a translator is on its way...

JP

On Tue, Oct 11, 2011 at 8:23 AM, Michael Snoyman  wrote:
> Perhaps my needs are unique here, but I thought I'd mention them
> anyway. The main tool we use at work is based on a hodge-podge of
> Java, Ant and XSLT code[1]. This thing has to be constantly extended
> to support new functionality (or fix one of its myriad bugs), and
> there's no technical hurdle to using Haskell to that end. In fact, my
> company has released a few packages[2][3][4] specifically in this
> venture.
>
> There are two problems, however:
>
> * Some clients have an insistence that code run on the JVM.
> * It's inconvenient having multiple executables. Additionally, I've
> run into some problems in the past deploying to ancient Linux
> servers[5].
>
> So for my use case, I don't care at all about interacting with Java
> code, I simply want to be able to turn my existing Haskell code into a
> JAR file. This seems like a much simpler undertaking, but I'm still
> not aware of any way to get this to happen right now either.
>
> Michael
>
> [1] http://dita-ot.sourceforge.net/
> [2] http://hackage.haskell.org/package/xml-enumerator
> [3] http://hackage.haskell.org/package/xml-hamlet
> [4] http://hackage.haskell.org/package/uri-enumerator
> [5] 
> http://stackoverflow.com/questions/5953199/create-a-static-haskell-linux-executable
>
> On Tue, Oct 11, 2011 at 8:15 AM, JP Moresmau  wrote:
>> I had started a project to start a JVM and call Java code from
>> Haskell, but got sidetracked into EclipseFP, but I hope to go back to
>> it someday.
>> https://github.com/JPMoresmau/HJVM. Have a look at the test suite for
>> some examples.
>>
>> Hope this helps
>>
>> JP
>>
>> On Tue, Oct 11, 2011 at 7:20 AM, Aatch  wrote:
>>> There are some projects to try and provide a bridge between Haskell
>>> and the JVM. Unfortunately none of the seem to have much development.
>>> As it stands, there is GCJNI, which allows Haskell to invoke Java
>>> code, seems like a Java version of hsc2hs, but the site is down, it
>>> just 404s. There is also haskell-jvm-bridge, but that doesn't look
>>> like it has any development for about 18 months, and there isn't much
>>> about it. Then there is LambdaVM, which looks the most promising, as
>>> it compiles GHC byte-code to JVM bytecode. However, it doesn't look it
>>> has been updated in a few years.
>>> You can try your luck with any of those, but currently, if you want a
>>> decent FFI for Java, you're probably going to have to resurrect one of
>>> those projects.
>>>
>>> ---
>>> James Miller
>>>
>>>
>>>
>>> On 11 October 2011 15:26, Claude Lee  wrote:
 Hi,

 vote+1.

 Theoretically, you can bridge Haskell and Java with FFI. It applys to small
 projects. Larger ones may need some build tools...

 Claude

 2011/10/11 dokondr 
>
> Hi,
> I need to call Stanford NLP Parser from Haskell (unfortunately Haskell
> does not have a similar one):
> http://nlp.stanford.edu/software/lex-parser.shtml
>
> What would be the most reliable framework for this?
>
> Thanks!
> Dmitri
>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>
>>
>>
>> --
>> JP Moresmau
>> http://jpmoresmau.blogspot.com/
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>



-- 
JP Moresmau
http://jpmoresmau.blogspot.com/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] wxhaskell : how to generate an event?

2011-10-10 Thread Dmitriy Nikitinskiy

10.10.2011 16:42, Johannes Waldmann пишет:

Dear all,

in wxHaskell (core) I can set and get event handlers
http://hackage.haskell.org/packages/archive/wxcore/0.12.1.7/doc/html/Graphics-UI-WXCore-Events.html
but how is it possible to create events (programmatically)
and somehow feed them into the "main event handling loop"?

I think I need this in an application that needs to handle
concurrently events that arrive via the GUI (like mouse clicks)
and events from an external source (specifically, alsa-midi input).

Of course I could handle those "extra events" separately from wxcore,
but they should ultimately result in changes to the GUI state,
and it feels dangerous to do this without synchronisation.

Any hints welcome. Thanks - J.W.


Hello, hope this helps:
http://snipplr.com/view/17538/

At least this is works for me.

Regards,
Dmitriy

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread Michael Snoyman
On Tue, Oct 11, 2011 at 8:34 AM, JP Moresmau  wrote:
> Maybe your Haskell code could be compiled with only minor
> modifications on something like CAL or Frege? There seems to be some
> interest in them these days, so maybe a translator is on its way...

Likely not. xml-enumerator relies on attoparsec-text and
blaze-builder, neither of which I'd imagine will work easily on either
CAL or Frege. And xml-hamlet uses quasi-quotation, which almost
certainly wouldn't work. I could likely change it from real QQ to some
kind of preprocessor without too much effort, but I think overall it's
a losing venture.

Michael

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The best way to call Java from Haskell?

2011-10-10 Thread Karel Gardas

On 10/11/11 08:23 AM, Michael Snoyman wrote:

So for my use case, I don't care at all about interacting with Java
code, I simply want to be able to turn my existing Haskell code into a
JAR file. This seems like a much simpler undertaking, but I'm still
not aware of any way to get this to happen right now either.


LambdaVM do exactly what you like, but is experimental and unfortunately 
out-dated. It's based on pre ghc 6.8:


$ ./compiler/stage1/ghc-inplace --version
The Glorious Glasgow Haskell Compilation System, version 6.7.20081028

anyway, for hello world like examples it's working well, although 
benchmarking shows that it's slower on the same code then frege for 
example (testing just naive fib to compare recursion speed)


I've contacted author several times and asked for updating or help with 
updating it to latest GHC HEAD but received no reply so far and 
unfortunately my Haskell knowledge is kind of enough to write just this 
hello world...


Karel

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe