Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Malcolm Wallace
instance (Monad m, MonadPlus m) => Monoid (Stream m a) where > mempty = Chunks mempty > mappend (Chunks xs) (Chunks ys) = Chunks (xs `mappend` ys) > mappend _ _ = EOF > > > Iteratee.hs:28:25: > No instance for (Monoid (m a)) > arising from a use of `mempty' > There

Re: [Haskell-cafe] Erlang's module discussion

2011-05-30 Thread Gregory Crosswhite
On 5/28/11 10:11 AM, Alex Rozenshteyn wrote: Since no-one has yet mentioned it, and I think it might be relevant, http://types.bu.edu/seminar-modularity/first-class-modules-for-haskell.pdf I haven't read it with any degree of understanding, but I don't think it's tractable to remove modules fr

[Haskell-cafe] Student Internships for Parallel Haskell Programming at NII, Tokyo

2011-05-30 Thread Sebastian Fischer
As part of my research fellowship at the National Institute of Informatics in Tokyo, I announce the availability of student internships for up to three months between July and September 2011. Qualified applicants are enrolled in a Masters or Phd program, have a firm grasp of the Haskell programmin

[Haskell-cafe] Looking for n-body example with repa.

2011-05-30 Thread Grigory Sarnitskiy
Hello! I'm studying repa package and trying to implement O(N^2) n-body code. I'm using Array DIM2 Double to represent the collection of particles. I've managed to write a function which calculates the energy of one particle in the field of others but I'm struggling to write a code to calculate

[Haskell-cafe] maybe a GHC bug but not sure

2011-05-30 Thread Edward Amsden
When building the Haskell Objective C bindings tool from Using GHC 7.0.3 for Haskell Platform 2011.2.0.1, OS X 64 bit HOC compiles HOC_cbits.o before trying to build it into the rest of the program (I don't say link because this came up while trying to compile: > [

[Haskell-cafe] ANNOUNCE: time-recurrence-0.4.2

2011-05-30 Thread Chris Heller
I've been busy making major changes to my time library: http://hackage.haskell.org/package/time-recurrence Things are still under heavy development. This release is to show the direction the library is heading in. A major shift in the design has been made, and the current work is an attempt

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Canhua
sorry, `m a` as an instance of Monoid, not `m' On Tue, May 31, 2011 at 9:30 AM, Canhua wrote: > I think you should declare `m' as an instance of Monoid, > rather than as instnaces of Monad and MonadPlus > > On Tue, May 31, 2011 at 8:33 AM, John Ky wrote: >> Hi Brandon, >> Thanks for your suggest

Re: [Haskell-cafe] Please add a method for optimized concat to the Semigroup class

2011-05-30 Thread Edward Kmett
I felt I should probably mention that ultimately what was done is I moved NonEmpty all the way down into semigroups and chose > sconcat :: NonEmpty a -> a at it was the closest analogue to the current mconcat behavior. So, request accomodated. ;) -Edward On Tue, May 3, 2011 at 7:23 PM, Edward

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread John Ky
Hi Brandon, Thanks for your suggestion. I'm a little stuck as adding Monad and MonadPlus in my instance declaration doesn't seem sufficient. I know mconcat comes from Monoid, but I don't know how to put that in. data Stream m a = Chunks (m a) | EOF deriving (Show, Eq) instance (Monad m, MonadP

Re: [Haskell-cafe] uniplate (was: code review?)

2011-05-30 Thread John Lato
Hi Neil, thanks for the response. On Mon, May 30, 2011 at 8:48 PM, Neil Mitchell wrote: > Hi John, > > >> > While I'm on the topic, I recently wrote a tool that wanted to > >> > traverse deep data structures as produced by haskell-src-exts. ?I > >> > wound up with about 50 lines of case expressi

Re: [Haskell-cafe] Can't figure out cmap in hmatrix

2011-05-30 Thread Carter Schonwald
this is actually a bug in the type of cmap, a fix is due in the next release (at least thats what Alberto indicated to me when I asked about this a monthish ago) (note how you have the container type c e, but we want c a and c b ). Instead use the vector map or matrix map ops directly cheers -Car

Re: [Haskell-cafe] uniplate (was: code review?)

2011-05-30 Thread Neil Mitchell
Hi John, >> > While I'm on the topic, I recently wrote a tool that wanted to >> > traverse deep data structures as produced by haskell-src-exts. ?I >> > wound up with about 50 lines of case expressions and around the time >> > my hands were literally beginning to hurt decided that enough was >> >

[Haskell-cafe] Can't figure out cmap in hmatrix

2011-05-30 Thread Mats Klingberg
Hello, I'm playing around a bit with the hmatrix package (http://hackage.haskell.org/package/hmatrix) but can't quite figure out how to make the cmap function in Numeric.Container work. An example: ghci> import Numeric.LinearAlgebra ghci> let v = fromList [1.0,2.0,3.0] ghci> v fromList [1.0,2.

Re: [Haskell-cafe] Code critique - Was [Maybe Int] sans Nothings

2011-05-30 Thread michael rice
Nice tool. I'll be using it a lot from now on, I'm sure. Thanks, Neil. Michael --- On Mon, 5/30/11, Neil Mitchell wrote: From: Neil Mitchell Subject: Re: [Haskell-cafe] Code critique - Was [Maybe Int] sans Nothings To: "michael rice" Cc: "Haskell Cafe" , "Alexander Solla" Date: Monday, May 3

Re: [Haskell-cafe] Code critique - Was [Maybe Int] sans Nothings

2011-05-30 Thread Neil Mitchell
Hi Michael, You've used quite a few entirely redundant brackets. The tool HLint ( http://community.haskell.org/~ndm/hlint) will tell you which ones. Thanks, Neil On Wed, May 25, 2011 at 12:09 AM, michael rice wrote: > The input file: http://dl.dropbox.com/u/27842656/psalms > > The Markov chain

[Haskell-cafe] something between a QQ and Q Exp?

2011-05-30 Thread Nicolas Frisby
This message motivates adding support to Template Haskell for code that can be spliced but can no longer be intensionally analyzed. I'm trying to use the well-known technique of a hidden constructor in order to represent values that satisfy a particular predicate. > module Safe (Safe(), safe, mkS

Re: [Haskell-cafe] Template Haskell sometimes sees hidden constructors

2011-05-30 Thread Nicolas Frisby
A quick follow-up: 1) I had a typo: it should say "N4 is like N1 with a phantom type variable". 2) In my larger code base, the constructor that is visible to TH when I think it shouldn't be is part of a type that is alpha-equivalent to N3. It's odd that N3 doesn't exhibit the leakiness here but a

[Haskell-cafe] GHCJS/Firefox support for forkIO and MVars

2011-05-30 Thread Hamish Mackenzie
Firstly a big thanks to Neil Mix for this threading library... http://www.neilmix.com/2007/02/07/threading-in-javascript-17/ It is just what GHCJS needs for threading support (at least in Firefox). Here is what I did to get it working in GHCJS... * Added "Jump" so that tail calls don't grow the s

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Lyndon Maydwell
I just tried to use the generic form with (Maybe a) and 'mconcat' prevented this from working, so that needs to be considered too. On Mon, May 30, 2011 at 10:53 PM, Casey McCann wrote: > On Mon, May 30, 2011 at 9:01 AM, John Ky wrote: >> instance Monoid (Stream a) where >>     mempty = Chunks me

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Casey McCann
On Mon, May 30, 2011 at 9:01 AM, John Ky wrote: > instance Monoid (Stream a) where > mempty = Chunks mempty > mappend (Chunks xs) (Chunks ys) = Chunks (xs ++ ys) > mappend _ _ = EOF > > I guess, it shows my lack of experience in Haskell, but my question is, why > is writing the code th

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Brandon Moore
>From: John Ky >Sent: Monday, May 30, 2011 8:01 AM > >Hi all, > >I'm trying to learn about enumerators by reading this paper and came across >some code on page 2 that I found hard to digest, but I think I finally got it: Hi John. These programs should behave identically, and I think your versio

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Lyndon Maydwell
Because they are more general functions that work on all monads rather than just lists. This allows Stream to be defined more flexibly. On Mon, May 30, 2011 at 9:01 PM, John Ky wrote: > Hi all, > I'm trying to learn about enumerators by reading this paper and came across > some code on page 2 th

[Haskell-cafe] ANNOUNCE: Clipboard-2.2.0. System clipboard interface.

2011-05-30 Thread Daniel Díaz Casanueva
Hi all, I've just uploaded Clipboard-2.2.0 to Hackage [1]. Clipboard [2] is a library that provides an interface for the system clipboard. The API is very simple, so anyone can use it without knowing of low-level Win32 API. Currently, this library only works on a Windows OS, due to its dependency

Re: [Haskell-cafe] State Machine and the Abstractions

2011-05-30 Thread Heinrich Apfelmus
Yves Parès wrote: For the purposes of a simple strategy game, I'd like to build an EDSL that expresses missions. A mission could be represented as a state machine. With basic bricks such as actions (MoveTo, ShootAt...) or tests (EnemiesAround, LowHealth...), I could (ideally dynamically) build s

Re: [Haskell-cafe] How unique is Unique

2011-05-30 Thread Heinrich Apfelmus
Emil Axelsson wrote: Heinrich Apfelmus wrote: Since every module of my DSL depends on the same global variable, only two things should happen: * Reloading a module does not reload the global counter. Everything is fine. * Reloading a module does reload the global counter. This forces *all* m

Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Alexey Khudyakov
On 30.05.2011 14:45, Henning Thielemann wrote: Alexey Khudyakov schrieb: On 30.05.2011 12:26, Bas van Dijk wrote: How about 'checkers' by Conal Elliott: http://hackage.haskell.org/package/checkers We really need better search on hackage than C-f in browser. I didn't find them. Thank you for

Re: [Haskell-cafe] Haskell School of Expression (graphics)

2011-05-30 Thread michael rice
and then cabal install soegtk? Michael --- On Mon, 5/30/11, John Lato wrote: From: John Lato Subject: Re: [Haskell-cafe] Haskell School of Expression (graphics) To: "michael rice" Cc: haskell-cafe@haskell.org, "Andrew Coppin" Date: Monday, May 30, 2011, 8:48 AM From: michael rice I think t

[Haskell-cafe] Detecting overlay-ed signal patterns

2011-05-30 Thread Dmitri O.Kondratiev
Hello, I am trying to detect signal patterns in a system with numerous signals overlaying each other in time. I am aware that there is a whole class of problem solving methods for this task, yet trying my own algorithm, that may be wrong of course :) Next I use a simple example to describe the prob

[Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread John Ky
Hi all, I'm trying to learn about enumerators by reading this paperand came across some code on page 2 that I found hard to digest, but I think I finally got it: import Data.Monoid data Stream a = Chunks [a] | EOF deriving (Show, Eq) in

Re: [Haskell-cafe] Haskell School of Expression (graphics)

2011-05-30 Thread John Lato
> > From: michael rice > I think this is fixed in the gtk2hs source tree, have you tried building from the repo? > cabal install gtk2hs-buildtools > darcs get --lazy http://code.haskell.org/gtk2hs/ > cd gtk2hs > chmod +x bootstrap.sh > ./bootstrap.sh John Lato > Is this worth chasing down? I

Re: [Haskell-cafe] Please help with double recursion

2011-05-30 Thread Dmitri O.Kondratiev
On Mon, May 30, 2011 at 11:26 AM, Richard O'Keefe wrote: > > On 28/05/2011, at 11:47 PM, Dmitri O.Kondratiev wrote: > > > Hello, > > I am trying to solve a simple task, but got stuck with double recursion - > for some reason not all list elements get processed. > > Please advice on a simple solu

Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Henning Thielemann
Alexey Khudyakov schrieb: > On 30.05.2011 12:26, Bas van Dijk wrote: >> >> How about 'checkers' by Conal Elliott: >> http://hackage.haskell.org/package/checkers >> > We really need better search on hackage than C-f in browser. I didn't > find them. Thank you for pointers. google with site:hackage.

[Haskell-cafe] ANN: dtd-types 0.0.0.1

2011-05-30 Thread Yitzchak Gale
The dtd-types package provides types for processing XML DTDs in Haskell. These types are intended to be compatible with and extend the set of types provided by John Millikin's xml-types package. This is a very preliminary first version, pending discussion by the community on the web-devel list abo

Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Alexey Khudyakov
On 30.05.2011 12:26, Bas van Dijk wrote: On 30 May 2011 00:14, Alexey Khudyakov wrote: It always puzzled me why there are no packages for for testing general type classes laws. (Monoid laws, monad laws etc). It looks like ideal case for quickcheck and smallcheck. How about 'checkers' by Conal

Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Bas van Dijk
On 30 May 2011 00:14, Alexey Khudyakov wrote: > It always puzzled me why there are no packages for for testing general > type classes laws. (Monoid laws, monad laws etc). It looks like ideal > case for quickcheck and smallcheck. How about 'checkers' by Conal Elliott: http://hackage.haskell.org/pa

Re: [Haskell-cafe] Haskell School of Expression (graphics)

2011-05-30 Thread Jerzy Karczmarczuk
Henk-Jan van Tuyl commenting Andrew Coppin ... (about HOpenGL and H.Platform) ... Uh... yes, you might be right about that. However, AFAIK you still need something with which to create a rendering surface in the first place. (Not sure if HP includes GLUT...) As you can see in the HP document

Re: [Haskell-cafe] How unique is Unique

2011-05-30 Thread Emil Axelsson
2011-05-28 11:35, Heinrich Apfelmus skrev: Emil Axelsson wrote: Hello! Lacking a proper blog, I've written some notes about Data.Unique here: http://community.haskell.org/~emax/darcs/MoreUnique/ This describes a real problem that makes Data.Unique unsuitable for implementing observable sha

Re: [Haskell-cafe] Please help with double recursion

2011-05-30 Thread Richard O'Keefe
On 28/05/2011, at 11:47 PM, Dmitri O.Kondratiev wrote: > Hello, > I am trying to solve a simple task, but got stuck with double recursion - for > some reason not all list elements get processed. > Please advice on a simple solution, using plane old recursion :) > *** Task: > From a sequence of

Re: [Haskell-cafe] Erlang's module discussion

2011-05-30 Thread Richard O'Keefe
On 28/05/2011, at 3:37 PM, Brandon Allbery wrote: > On Fri, May 27, 2011 at 23:10, Tom Murphy wrote: >> I sure love Hackage, but there's a very interesting discussion >> going on, on the Erlang mailing list, about completely restructuring >> the module-model. > > Sounds like one of those id