Re: [Haskell-cafe] (weird stuff) Kernel Modules in Haskell ;-)

2009-09-16 Thread minh thu
2009/9/15 Matthias Kilian k...@outback.escape.de: A fellow openbsd developer told me the URL below... I hope this hasn't been posted on this list already (at least I didn't find it in my local archives): http://tommd.wordpress.com/2009/09/13/kernel-modules-in-haskell/ I don't think it was

[Haskell-cafe] Re: retrieving arguments for functions from a heterogenous list

2009-09-16 Thread oleg
Andrew U. Frank wrote: I have a number of functions which have some arguments and produce a single result. all the arguments are in a heterogenous list and the results should update the list. If I understand the problem correctly, you have a typed-indexed collection TIP and you would like to

Re: [Haskell-cafe] How to understand the 'forall' ?

2009-09-16 Thread Cristiano Paris
On Tue, Sep 15, 2009 at 11:38 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: ... foo :: forall a. a - a This is exactly the same type as foo :: a - a (unless you're using ScopedTypeVariables and there's a type variable a in scope), since type signatures are implicitly forall'd.

Re[2]: [Haskell-cafe] How to understand the 'forall' ?

2009-09-16 Thread Bulat Ziganshin
Hello Cristiano, Wednesday, September 16, 2009, 12:04:48 PM, you wrote: Yep, perhaps I used the wrong example. What about foo: (forall a. a) - Int? it's a function that convert anything to integer. for example: foo _ = 1 it's hard to find better examples, since haskell has very few functions

Re: Re[2]: [Haskell-cafe] How to understand the 'forall' ?

2009-09-16 Thread David Menendez
On Wed, Sep 16, 2009 at 4:18 AM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Cristiano, Wednesday, September 16, 2009, 12:04:48 PM, you wrote: Yep, perhaps I used the wrong example. What about foo: (forall a. a) - Int? it's a function that convert anything to integer. That would

[Haskell-cafe] ANNOUNCE: bindings-levmar-0.1.1

2009-09-16 Thread Roel van Dijk
I am pleased to announce the release of bindings-levmar-0.1.1: http://hackage.haskell.org/package/bindings-levmar The most important change compared to the previous version is a custom configure script (copied from hmatrix) that detects which libraries are needed. The cabal file also has some

[Haskell-cafe] ANNOUNCE: levmar-0.2

2009-09-16 Thread Bas van Dijk
Hello, We like to announce a new release of the high-level Levenberg-Marquardt library levmar: http://hackage.haskell.org/package/levmar-0.2 Changes: * There's one new major feature: automatic calculation of the Jacobian using automatic differentiation with Conal Elliott's vector-space

[Haskell-cafe] Hopefully simple monad question

2009-09-16 Thread Gregory Propf
I'm playing around with a little program that implements a simple virtual machine.  I want to use a monad to represent machine state.  I created a data type for the machine (VM) and a monadic type for the monadic computations using it.  I declared this an instance of MonadState and Monad and

Re: [Haskell-cafe] Hopefully simple monad question

2009-09-16 Thread Holger Siegel
Am Mittwoch, den 16.09.2009, 03:23 -0700 schrieb Gregory Propf: I'm playing around with a little program that implements a simple virtual machine. I want to use a monad to represent machine state. I created a data type for the machine (VM) and a monadic type for the monadic computations

Re: [Haskell-cafe] Hopefully simple monad question

2009-09-16 Thread Miguel Mitrofanov
Well, it's almost always better to reuse as much code as possible. But I don't think type is an answer here. I recommend using a newtype, enabling GeneralizedNewtypeDeriving and deriving as much as possible: {-# LANGUAGE GeneralizedNewtypeDeriving #-} ... newtype VM a = VM {runVM :: State

Re: [Haskell-cafe] Hopefully simple monad question

2009-09-16 Thread Tom Nielsen
newtype VMT m a =  VMT {runVMT :: StateT VMState m a}    deriving (Monad, MonadIO, MonadTrans, TransM, MonadState VMState) works here (ghc-6.10.3) On Wed, Sep 16, 2009 at 11:42 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: newtype VMT m a =  VMT {runVMT :: StateT VMState m a}    

Re: [Haskell-cafe] Hopefully simple monad question

2009-09-16 Thread Miguel Mitrofanov
O, great. I didn't know you can write it this way. Tom Nielsen wrote: newtype VMT m a = VMT {runVMT :: StateT VMState m a} deriving (Monad, MonadIO, MonadTrans, TransM, MonadState VMState) works here (ghc-6.10.3) On Wed, Sep 16, 2009 at 11:42 AM, Miguel Mitrofanov miguelim...@yandex.ru

Re: [Haskell-cafe] Building a monoid, continuation-passing style

2009-09-16 Thread Martijn van Steenbergen
David Menendez wrote: I'm reminded of the parameterized monad of continuations that Oleg mentioned a few years back. http://www.haskell.org/pipermail/haskell/2007-December/020034.html This is all very interesting, thank you both for the pointers! I was trying to get rid of the newtypes but

[Haskell-cafe] Re: A thought about liberating Haskell's syntax

2009-09-16 Thread George Pollard
Just occurred to me that you can actually do this with a preprocessor. If we extract the template declarations to a separate module, then it can happen something like this (I have corrected some errors in the above code): main.hs import Language.Haskell.TH import QList import

[Haskell-cafe] Re: A thought about liberating Haskell's syntax

2009-09-16 Thread George Pollard
Oh, and output is as expected: ./test (1,2,3) 1 (1,(2,3)) ((1,2),3) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: A thought about liberating Haskell's syntax

2009-09-16 Thread George Pollard
Also (sorry for the triple-post!) I noticed that in the TH documentation, it says: Type splices are not implemented, and neither are pattern splices This means, while we could write a preprocessor that would give us, e.g.: x :: Set Int x = {1,2,3,4} We cannot splice in the right

[Haskell-cafe] GHC threaded runtimes and pure functions

2009-09-16 Thread Gregory Propf
One of the things I liked about Haskell was the notion of pure functions and the fact that they can be, in theory, automatically parallelized on multicore hardware. I think this will become a huge deal in a few years as cores multiply.  My question is simply this: under GHC is this what really

Re: [Haskell-cafe] GHC threaded runtimes and pure functions

2009-09-16 Thread Bulat Ziganshin
Hello Gregory, Wednesday, September 16, 2009, 5:17:01 PM, you wrote: no. additional threads are launched for i/o system and, as you requested by -N2 for haskell workload. but ghc don't auto-parallelize your code. it's a bit too hard, since making too much threads (e.g. one for every addition)

Re: [Haskell-cafe] Building a monoid, continuation-passing style

2009-09-16 Thread Edward Kmett
For reference Oleg's indexed continuation monad is packaged on hackage in category-extras as: http://hackage.haskell.org/packages/archive/category-extras/latest/doc/html/Control-Monad-Indexed-Cont.html -Edward Kmett On Wed, Sep 16, 2009 at 7:07 AM, Martijn van Steenbergen

[Haskell-cafe] Haskell - .NET

2009-09-16 Thread Peter Verswyvelen
I heard that compiling Haskell to Java is not obvious since tail calls are not supported. .NET's intermediate language (IL) does support tail calls, however it is currently slower than regular calls, and is not always supported by all JITs. But given that F# will soon be officially released, I

Re: [Haskell-cafe] Haskell - .NET

2009-09-16 Thread Paul Sujkov
Hi Peter, it seems that this question has been already raised before: http://www.haskell.org/pipermail/haskell-cafe/2005-January/008244.html and there are some .Net interop implementations on the net (it is a question how mature they are, however):

Re: [Haskell-cafe] Haskell - .NET

2009-09-16 Thread Peter Verswyvelen
Yes, but interop only touches the surface of what is possible. When a Haskell compiler could create IL code, it would be possible to use the generated code inside a sandbox, e.g. to be used on the web as loadable Silverlight code. Of course the same could be said about other virtual machines,

Re: [Haskell-cafe] Haskell - .NET

2009-09-16 Thread Matthew Podwysocki
There was in fact another attempt as well, Salsa: http://haskell.org/haskellwiki/Salsa This showed quite a bit of promise but unfortunately was not more than just an experiment. Matt On Wed, Sep 16, 2009 at 10:21 AM, Peter Verswyvelen bugf...@gmail.comwrote: Yes, but interop only touches the

Re: [Haskell-cafe] GHC threaded runtimes and pure functions

2009-09-16 Thread Don Stewart
gregorypropf: One of the things I liked about Haskell was the notion of pure functions and the fact that they can be, in theory, automatically parallelized on multicore hardware. I think this will become a huge deal in a few years as cores multiply. My question is simply this: under GHC is

RE: [Haskell-cafe] Haskell - .NET

2009-09-16 Thread Sittampalam, Ganesh
I think Sigbjorn's binding (http://haskell.forkio.com/dotnet/ http://haskell.forkio.com/dotnet/ as linked below) is the most complete and likely to work, but it's still just a binding not a compiler backend. From: haskell-cafe-boun...@haskell.org

Re: [Haskell-cafe] GHC threaded runtimes and pure functions

2009-09-16 Thread Gregory Propf
That makes sense.  So maybe I should split my mapping into two parallel ones or however many CPUs there are using par. --- On Wed, 9/16/09, Bulat Ziganshin bulat.zigans...@gmail.com wrote: From: Bulat Ziganshin bulat.zigans...@gmail.com Subject: Re: [Haskell-cafe] GHC threaded runtimes and pure

[Haskell-cafe] Parallel lazy zip

2009-09-16 Thread Henning Thielemann
When reading http://www.macs.hw.ac.uk/~dsg/gph/papers/html/Strategies/strategies.html I got the impression, that when I want to compute in parallel I have to suppress laziness at all costs, otherwise only a neglible portion of the code is run in parallel. How can I parallelize the

[Haskell-cafe] Re: Using tiny (atomic) mutables between multiple threads

2009-09-16 Thread Simon Marlow
On 13/09/2009 07:45, Belka wrote: Hello, Haskell Cafe! I used an MVar to signalize to many threads, when it's time to finish their business (I called it a LoopBreaker). Recently I realized, that it might be too expensive (to use MVar) for cases when threads are many and all of them read my

[Haskell-cafe] Some question about c2hs.

2009-09-16 Thread Andy Stewart
Hi all, I try to binding Haskell to VTE library. Below are Vte.chs file i wrote. Vte.chs Description: Binary data I use c2hs with below command LANG=C c2hs -d trace -l $(pkg-config --cflags vte | sed 's/-I/-C-I/g') vte/vte.h Vte.chs generate Vte.hs file. When i compile Vte.hs

Re: [Haskell-cafe] Haskell - .NET

2009-09-16 Thread Paulo Tanimoto
Hello! On Wed, Sep 16, 2009 at 8:54 AM, Peter Verswyvelen bugf...@gmail.com wrote: I heard that compiling Haskell to Java is not obvious since tail calls are not supported. .NET's intermediate language (IL) does support tail calls, however it is currently slower than regular calls, and is

Re: [Haskell-cafe] Re: Using tiny (atomic) mutables between multiple threads

2009-09-16 Thread Bulat Ziganshin
Hello Simon, Wednesday, September 16, 2009, 7:05:04 PM, you wrote: 1. Might readMVar really be computationally expensive under heavy load, (with all it's wonderful blocking features)? How much (approximately) more expensive, comparing to a assembler's mov? Probably 10-100 times more

Re: [Haskell-cafe] How to understand the 'forall' ?

2009-09-16 Thread Ryan Ingram
Here's the difference between these two types: test1 :: forall a. a - Int -- The caller of test1 determines the type for test1 test2 :: (forall a. a) - Int -- The internals of test2 determines what type, or types, to instantiate the argument at Or, to put it another way, since there are no

Re: [Haskell-cafe] Parallel lazy zip

2009-09-16 Thread Daniel Peebles
Would using zipWith (\x y - x `par` y `pseq` x + y) (expensiveList 1) (expensiveList 2) do it? it seems to help a bit on my machine, but doesn't give me twice the performance On Wed, Sep 16, 2009 at 10:59 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: When reading  

Re: [Haskell-cafe] How to understand the 'forall' ?

2009-09-16 Thread Cristiano Paris
On Wed, Sep 16, 2009 at 7:12 PM, Ryan Ingram ryani.s...@gmail.com wrote: Here's the difference between these two types: test1 :: forall a. a - Int -- The caller of test1 determines the type for test1 test2 :: (forall a. a) - Int -- The internals of test2 determines what type, or types, to

Re: [Haskell-cafe] GHC threaded runtimes and pure functions

2009-09-16 Thread Andrew Coppin
Gregory Propf wrote: That makes sense. So maybe I should split my mapping into two parallel ones or however many CPUs there are using par. If you're going to use par, it doesn't really matter how many sparks you create. You just need to avoid creating millions of really tiny sparks. You

Re[2]: [Haskell-cafe] GHC threaded runtimes and pure functions

2009-09-16 Thread Bulat Ziganshin
Hello Andrew, Wednesday, September 16, 2009, 11:31:22 PM, you wrote: That makes sense. So maybe I should split my mapping into two parallel ones or however many CPUs there are using par. If you're going to use par, it doesn't really matter how many sparks you create. You just need to

[Haskell-cafe] weak pointers and memoization (was Re: memoization)

2009-09-16 Thread Rodney Price
How does garbage collection work in an example like the one below? You memoize a function with some sort of lookup table, which stores function arguments as keys and function results as values. As long as the function remains in scope, the keys in the lookup table remain in memory, which means

Re: [Haskell-cafe] How to understand the 'forall' ?

2009-09-16 Thread Dan Weston
There is no magic here. This is merely explicit type specialization from the most general inferred type to something more specific. The denotational semantics of a function whose type is specialized does not change for those values belonging to the more specialized type. f :: forall a. (Num

[Haskell-cafe] Can't install Haskell Platform (Ubuntu 9.02)

2009-09-16 Thread Gregory Propf
I'm trying to install the Haskell Platform.  I'm using Ubuntu 9.02 and GHC 6.10.4 on a 64 bit AMD and keep getting this crap when I do 'make install'.  The stuff builds OK and the script in question does indeed exist.  Anybody know what this is.  I've looked online and none of the other people

Re: [Haskell-cafe] Re: A thought about liberating Haskell's syntax

2009-09-16 Thread Gregory Propf
I just rejoined the list and am a bit new to things here anyway but this sounds a lot Lisp's old macro system a little. I'm guessing you're not proposing runtime execution of runtime generated code though.  I don't know much about Lisp internals but I suspect Lisp runtimes are quite different

Re: [Haskell-cafe] Can't install Haskell Platform (Ubuntu 9.02)

2009-09-16 Thread Paulo Tanimoto
Hi Gregory, On Wed, Sep 16, 2009 at 6:51 PM, Gregory Propf gregorypr...@yahoo.com wrote: I'm trying to install the Haskell Platform.  I'm using Ubuntu 9.02 and GHC 6.10.4 on a 64 bit AMD and keep getting this crap when I do 'make install'.  The stuff builds OK and the script in question