[Haskell-cafe] Re: the real world of Haskell books (Re: Online Real World Haskell, problem with Sqlite3 chapters)

2008-09-06 Thread Gour
 Bryan == Bryan O'Sullivan [EMAIL PROTECTED] writes:

Bryan Other tech books face the same problem, which, if they sell
Bryan successfully and the authors haven't moved into caves afterwards
Bryan to recover, they address with subsequent editions. If readers
Bryan find that specific pieces of information have bitrotted, I'm sure
Bryan we'll hear about it. In that case, we'll create a wiki page with
Bryan errata, and link to it from the book site.

I think we should be happy that RWH book is done and considering it is
for 'real-world' users I'm sure they will find a way to cope for
upgrading libs, non-working packages etc.

A blind uncle is better than no uncle :-D

Congrats to RWH's 'Gang od Three' ;)


Sincerely,
Gour

-- 

Gour  | Zagreb, Croatia  | GPG key: C6E7162D



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


[Haskell-cafe] darcs hacking sprint, venues confirmed! (25-26 October)

2008-09-06 Thread Eric Y. Kow
Dear darcs users and Haskell hackers,

Earlier I wrote an announcement for the darcs hacking sprint on 25-26
October.  Tonight, I am delighted to announce that we have two venues
confirmed for the sprint and one serious offer.

Venues
--
We plan to host the sprint across three sites:

 * CONFIRMED: Brighton, UK (University of Brighton)
 * CONFIRMED: Portland, USA(Galois Connections)
 * likely:Paris,France (Université Paris Diderot)

So if you were waiting to book tickets, this is the time!

For more details, please see http://wiki.darcs.net/index.html/Sprints

Agenda
--
During this first sprint, we shall be focusing our attention on the day
to day performance issues that darcs users commonly face.

This is what we are reaching for:

1. Fast network operations.  We want to make it very pleasant
   for users to darcs get a repository and pull some patches to
   it over http and ssh.  Git does this very well, and we plan to
   learn from them.

2. Cutting memory consumption.  We want to profile the heck out
   of operations like darcs record, darcs convert and darcs whatsnew.
   What's eating up all the memory?  And how can we can cut it down
   to size?

3. Responsiveness. Sometimes basic darcs commands can take long enough
   for programmers to lose their train of thought.  We want to track
   down these lost seconds and kill that dreaded context switch.

Of course, if you are interested in other areas, then you can work on
those instead.

Note that if you are new to the darcs code or to Haskell, there will
also be a lot interesting jobs for you to get started with.  Everyone
will have something to hack on, so come join us!

Thanks very much to the University of Brighton, Galois connections and
University of Paris VII for their generous offers.

Hope to see you there, everyone! :-)

-- 
Eric Kow http://www.nltg.brighton.ac.uk/home/Eric.Kow
PGP Key ID: 08AC04F9


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


[Haskell-cafe] Re: Top Level -

2008-09-06 Thread Ashley Yakeley

Ganesh Sittampalam wrote:
But it's limited to the initialisers. An IORef holding an Integer 
isn't much memory, and it only ever gets leaked once.



It happens every time you load and unload, surely?


No. An initialiser is only ever run once per run of the RTS.

Also I thought this was a general discussion with Data.Unique as a 
concrete example; something else might leak substantially more memory. 
Your witnesses stuff would leak one Integer per module, wouldn't it?


It would leak one Integer per IOWitness initialiser for the run of the RTS.

Finally, any memory leak at all can be unacceptable in some contexts. 
It's certainly not something we should just dismiss as oh, it's only 
small.


Since it's of the order of the number of uniquely identified 
initialisers, it's arguably not a memory leak so much as a static 
overhead. The only way to get a continuous leak is to load and unload an 
endless stream of _different_ modules, each with their own initialisers.


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


[Haskell-cafe] Re: Top Level -

2008-09-06 Thread Ganesh Sittampalam

On Sat, 6 Sep 2008, Ashley Yakeley wrote:


Ganesh Sittampalam wrote:
But it's limited to the initialisers. An IORef holding an Integer isn't 
much memory, and it only ever gets leaked once.



It happens every time you load and unload, surely?


No. An initialiser is only ever run once per run of the RTS.


Oh, I see. Yes, sorry.

Since it's of the order of the number of uniquely identified 
initialisers, it's arguably not a memory leak so much as a static 
overhead. The only way to get a continuous leak is to load and unload an 
endless stream of _different_ modules, each with their own initialisers.


I would call it a leak if something that is no longer being used cannot be 
reclaimed. The endless stream of different modules is possible in 
long-running systems where the code being run evolves or changes over time 
(e.g. something like lambdabot, which runs user-provided code).


Cheers,

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


[Haskell-cafe] Re: Top Level -

2008-09-06 Thread Ashley Yakeley

Ganesh Sittampalam wrote:
I would call it a leak if something that is no longer being used cannot 
be reclaimed. The endless stream of different modules is possible in 
long-running systems where the code being run evolves or changes over 
time (e.g. something like lambdabot, which runs user-provided code).


This might be fixable with an option to the dynamic load function.

Let us say a module M has a number of top-level - of the form

  val - exp

The set of ACIO expressions exp is the static initialisers of M. The 
RTS must note when each static initialiser is run, and cache its result 
val. Let's call this cache of vals the static results cache of M.


When M is loaded, and a static results cache for M already exists, then 
it will be used for the vals of M.


It is the static results cache that might leak.

Let us have an flag to the dynamic load function, to mark the static 
results cache of M as freeable. If the static results cache is 
freeable, then it will be deleted when M is unloaded (and M is not part 
of the main program).


If you pass True for this flag, your code is unsafe if all of the following:

* M has static initialisers
* M will be loaded again after unloading
* Values from M will be stored elsewhere in the program.

If you pass False for this flag, your code will continuously leak memory 
if you continuously load modules


* that are all different
* that contain static initialisers

There may also have to be some way to specify how to apply the flag to 
dependencies as well.


In general I'm way beyond my knowledge of the RTS, so I may have 
something Very Wrong here. I don't think hs-plugins implements unloading 
 at all currently.


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


[Haskell-cafe] Re: [xmonad] ANNOUNCE: xmonad 0.8 released!

2008-09-06 Thread Don Stewart
nomeata:
 Hi,
 
 Am Freitag, den 05.09.2008, 18:38 -0700 schrieb Don Stewart:
  xmonad packages are available in the package systems of at least:
  
  Debian, Gentoo, Arch, Ubuntu, OpenBSD,
  NetBSD, FreeBSD, Gobo, NixOS, Source Mage, Slackware
  
  and 0.8 packages will appear in coming days (some are already 
  available).
 
 Debian xmonad and xmonad-contrib package uploaded (although
 xmonad-contrib is in the two-day delayed queue, to give autobuilders a
 chance to build xmonad first).

Great work, Joachim!

Thanks for being so responsive on this. Go Debian!

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


[Haskell-cafe] What's the best way to give up?

2008-09-06 Thread David F. Place

Hi, all.

Say I have a function solve which is a constraint solver.  It  
reconfigures its input to be a solution.  If there is no solution, it  
returns the input.


solve :: a - Either a a
solve input output = maybe (Left input) Right $ solve' input

If there is a solution, it finds it in a few seconds.  If there is no  
solution, it goes away for days proving that.  So, I'd like to give  
up on it if it doesn't return in a few seconds.   I can think of  
several ways of doing that.  I could keep a tally of the number of  
variable assignments and give up when it reaches an impossibly huge  
number.   I could change the type to

a - IO (Either a a ) and use getCPUTime.

Is there a standard way to do this?  Can you think of another way to  
do it?


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


[Haskell-cafe] GADTs and instances

2008-09-06 Thread Tony Hannan
Hello haskellers,

Anyone know the trick for making a Binary instance of a GADT.
See sample code below followed by the type error reported by ghc version
6.8.3

Thanks,
Tony


{-# LANGUAGE GADTs #-}

module GADTTest where

import Data.Binary
import Control.Monad (liftM)

data Query a where
Lookup :: String - Query (Maybe Int)
Fetch :: [String] - Query [Int]

instance (Binary a) = Binary (Query a) where
put (Lookup x) = putWord8 0  put x
put (Fetch x) = putWord8 1  put x
get = getWord8 = \tag - case tag of
0 - liftM Lookup get
1 - liftM Fetch get
-

GADTTest.hs:12:0:
Couldn't match expected type `Maybe Int'
   against inferred type `[Int]'
When trying to generalise the type inferred for `get'
  Signature type: forall a. (Binary a) = Get (Query a)
  Type to generalise: Get (Query a)
In the instance declaration for `Binary (Query a)'
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What's the best way to give up?

2008-09-06 Thread Arnar Birgisson
Hi there,

On Sat, Sep 6, 2008 at 13:30, David F. Place [EMAIL PROTECTED] wrote:
 If there is a solution, it finds it in a few seconds.  If there is no
 solution, it goes away for days proving that.  So, I'd like to give up on it
 if it doesn't return in a few seconds.   I can think of several ways of
 doing that.  I could keep a tally of the number of variable assignments and
 give up when it reaches an impossibly huge number.   I could change the type
 to
 a - IO (Either a a ) and use getCPUTime.

 Is there a standard way to do this?  Can you think of another way to do it?

I don't know, but this seems relevant:
http://www.haskell.org/pipermail/haskell-cafe/2005-October/011946.html

I'd make a generic (i.e. higher-order) function that handles the
timeout for any computation. i.e.

timeout :: (a - b) - Int - a - IO (Maybe b)

or similar.

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


Re: [Haskell-cafe] What's the best way to give up?

2008-09-06 Thread Christopher Lane Hinson



a - IO (Either a a ) and use getCPUTime.

Is there a standard way to do this?  Can you think of another way to do it?


I don't know, but this seems relevant:
http://www.haskell.org/pipermail/haskell-cafe/2005-October/011946.html

I'd make a generic (i.e. higher-order) function that handles the
timeout for any computation. i.e.

timeout :: (a - b) - Int - a - IO (Maybe b)


http://haskell.org/ghc/docs/latest/html/libraries/base/System-Timeout

Perhaps this is for not so much for pure computations as hanging when 
connecting to nonresponsive servers, although I also use it in a case 
where buggy long-running code could frustrate the responsiveness of 
unrelated processes..


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


Re: [Haskell-cafe] Re: Top Level -

2008-09-06 Thread Brandon S. Allbery KF8NH

On 2008 Sep 6, at 6:10, Ashley Yakeley wrote:

Ganesh Sittampalam wrote:
I would call it a leak if something that is no longer being used  
cannot be reclaimed. The endless stream of different modules is  
possible in long-running systems where the code being run evolves  
or changes over time (e.g. something like lambdabot, which runs  
user-provided code).


This might be fixable with an option to the dynamic load function.

Let us say a module M has a number of top-level - of the form

 val - exp

The set of ACIO expressions exp is the static initialisers of M.  
The RTS must note when each static initialiser is run, and cache its  
result val. Let's call this cache of vals the static results cache  
of M.


When M is loaded, and a static results cache for M already exists,  
then it will be used for the vals of M.


This sounds reachable to me, and therefore static overhead and not a  
leak.
Your proposed freeable flag is still useful, but I think this is not  
a problem.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


Re: [Haskell-cafe] What's the best way to give up?

2008-09-06 Thread Brandon S. Allbery KF8NH

On 2008 Sep 6, at 7:30, David F. Place wrote:
Say I have a function solve which is a constraint solver.  It  
reconfigures its input to be a solution.  If there is no solution,  
it returns the input.


solve :: a - Either a a
solve input output = maybe (Left input) Right $ solve' input

If there is a solution, it finds it in a few seconds.  If there is  
no solution, it goes away for days proving that.  So, I'd like to  
give up on it if it doesn't return in a few seconds.


http://www.haskell.org/haskellwiki/Timing_out_computations

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


Re: [Haskell-cafe] Re: Top Level -

2008-09-06 Thread Ganesh Sittampalam

On Sat, 6 Sep 2008, Brandon S. Allbery KF8NH wrote:


On 2008 Sep 6, at 6:10, Ashley Yakeley wrote:


The set of ACIO expressions exp is the static initialisers of M. The RTS 
must note when each static initialiser is run, and cache its result val. 
Let's call this cache of vals the static results cache of M.


When M is loaded, and a static results cache for M already exists, then it 
will be used for the vals of M.


This sounds reachable to me, and therefore static overhead and not a 
leak.


You can call it what you like, but it's still unacceptable behaviour, 
particularly since clients of M will have no way of telling from its API 
that it will happen.


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


Re: [Haskell-cafe] Re: Top Level -

2008-09-06 Thread Brandon S. Allbery KF8NH

On 2008 Sep 6, at 11:22, Ganesh Sittampalam wrote:

On Sat, 6 Sep 2008, Brandon S. Allbery KF8NH wrote:

On 2008 Sep 6, at 6:10, Ashley Yakeley wrote:
The set of ACIO expressions exp is the static initialisers of M.  
The RTS must note when each static initialiser is run, and cache  
its result val. Let's call this cache of vals the static results  
cache of M.
When M is loaded, and a static results cache for M already exists,  
then it will be used for the vals of M.


This sounds reachable to me, and therefore static overhead and  
not a leak.


You can call it what you like, but it's still unacceptable  
behaviour, particularly since clients of M will have no way of  
telling from its API that it will happen.



You want run-once behavior without giving the runtime the ability to  
tell that it's already been run?


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


Re: [Haskell-cafe] Re: Top Level -

2008-09-06 Thread Ganesh Sittampalam

On Sat, 6 Sep 2008, Brandon S. Allbery KF8NH wrote:

On 2008 Sep 6, at 11:22, Ganesh Sittampalam wrote:

On Sat, 6 Sep 2008, Brandon S. Allbery KF8NH wrote:

On 2008 Sep 6, at 6:10, Ashley Yakeley wrote:
The set of ACIO expressions exp is the static initialisers of M. The 
RTS must note when each static initialiser is run, and cache its result 
val. Let's call this cache of vals the static results cache of M.
When M is loaded, and a static results cache for M already exists, then 
it will be used for the vals of M.


This sounds reachable to me, and therefore static overhead and not a 
leak.


You can call it what you like, but it's still unacceptable behaviour, 
particularly since clients of M will have no way of telling from its 
API that it will happen.


You want run-once behavior without giving the runtime the ability to 
tell that it's already been run?


I don't want run-once behaviour, other people do. I'm just trying to pin 
down what it would mean.


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


Re: [Haskell-cafe] What's the best way to give up?

2008-09-06 Thread David F. Place
On Sat, 2008-09-06 at 11:10 -0400, Brandon S. Allbery KF8NH wrote:
 On 2008 Sep 6, at 7:30, David F. Place wrote:
  Say I have a function solve which is a constraint solver.  It  
  reconfigures its input to be a solution.  If there is no solution,  
  it returns the input.
 
  solve :: a - Either a a
  solve input output = maybe (Left input) Right $ solve' input
 
  If there is a solution, it finds it in a few seconds.  If there is  
  no solution, it goes away for days proving that.  So, I'd like to  
  give up on it if it doesn't return in a few seconds.
 
 http://www.haskell.org/haskellwiki/Timing_out_computations
 

Thanks, Arnar, Christopher and Brandon.  I looked into all your
suggestions.

I came up with this:

import Control.Exception
import System.Timeout

apt :: Int - (a - a) - a - IO (Either a a)
apt time f x =
do { ans - timeout time $ evaluate (f x)
   ; return $ maybe (Left x) Right ans
   }

test x = sum [1..x]
test2 x = length $ repeat x

Which seems to do what I want for test:

*Main apt 100 test 100
Right 5050
*Main apt 100 test 1000
Right 500500
*Main apt 100 test 1
Right 50005000
*Main apt 100 test 10
Left 10
*Main apt 100 test 100
Left 100
*Main apt 100 test 1000
Left 1000


But, the following sets the cpu spinning and can't be interrupted.
*Main apt 100 test2 100




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


Re: [Haskell-cafe] What's the best way to give up?

2008-09-06 Thread Derek Elkins
On Sat, 2008-09-06 at 12:17 -0400, David F. Place wrote:
 On Sat, 2008-09-06 at 11:10 -0400, Brandon S. Allbery KF8NH wrote:
  On 2008 Sep 6, at 7:30, David F. Place wrote:
   Say I have a function solve which is a constraint solver.  It  
   reconfigures its input to be a solution.  If there is no solution,  
   it returns the input.
  
   solve :: a - Either a a
   solve input output = maybe (Left input) Right $ solve' input
  
   If there is a solution, it finds it in a few seconds.  If there is  
   no solution, it goes away for days proving that.  So, I'd like to  
   give up on it if it doesn't return in a few seconds.
  
  http://www.haskell.org/haskellwiki/Timing_out_computations
  
 
 Thanks, Arnar, Christopher and Brandon.  I looked into all your
 suggestions.
 
 I came up with this:
 
 import Control.Exception
 import System.Timeout
 
 apt :: Int - (a - a) - a - IO (Either a a)
 apt time f x =
 do { ans - timeout time $ evaluate (f x)
; return $ maybe (Left x) Right ans
}
 
 test x = sum [1..x]
 test2 x = length $ repeat x
 
 Which seems to do what I want for test:
 
 *Main apt 100 test 100
 Right 5050
 *Main apt 100 test 1000
 Right 500500
 *Main apt 100 test 1
 Right 50005000
 *Main apt 100 test 10
 Left 10
 *Main apt 100 test 100
 Left 100
 *Main apt 100 test 1000
 Left 1000
 
 
 But, the following sets the cpu spinning and can't be interrupted.
 *Main apt 100 test2 100

length (repeat x) doesn't require allocating any memory.  GHC only
performs a context switch at heap checks.  If there are no allocations,
there are no heap checks and therefore no context switches.

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


Re: [Haskell-cafe] Re: Functional references

2008-09-06 Thread Tim Newsham

Tim Newsham's approach with invertible functions is interesting, though it
feels like it's another layer wrapped on top of the primitive idea of
functional references.


Not all of the refs are using invertible functions..  however, the
ones that are invertible are more flexible.. you can use them
to make functional references that are mapped over lists, for example.

I've reformulated my code a few times since initially posting it..
In the latest incarnation, FRefGen (generic FRefs with arbitrary
get/modify) and Inv (invertible functions) are both instances of an
FRef class.  In earlier versions I had a function for converting
an invertible into an FRef.


~wren


Tim Newsham
http://www.thenewsh.com/~newsham/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] experimental static blog engine in Haskell (file based, markdown syntax)

2008-09-06 Thread jinjing
Hia,

It's called Panda. It's pretty young, no theme, no tags, no comments,
around 360 lines of code and uses Kibro to bootstrap.

hosted on GitHub:
http://github.com/nfjinjing/panda/

a quick demo at:
http://jinjing.blog.easymic.com/

cheers,

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


Re: [Haskell-cafe] experimental static blog engine in Haskell (file based, markdown syntax)

2008-09-06 Thread Don Stewart
nfjinjing:
 Hia,
 
 It's called Panda. It's pretty young, no theme, no tags, no comments,
 around 360 lines of code and uses Kibro to bootstrap.
 
 hosted on GitHub:
 http://github.com/nfjinjing/panda/
 
 a quick demo at:
 http://jinjing.blog.easymic.com/

Awesome! Kibro seems to be taking off.

Will you release it on hackage.haskell.org?

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


[Haskell-cafe] Haskell Weekly News: Issue 84 - September 6, 2008

2008-09-06 Thread Brent Yorgey
---
Haskell Weekly News
http://sequence.complete.org/hwn/20080906
Issue 84 - September 06, 2008
---

   Welcome to issue 84 of HWN, a newsletter covering developments in the
   [1]Haskell community.

   This is the This issue is not late since the HWN will henceforth be
   published on Saturday now that I have real work to do edition.
   Featured this week: darcs hacking sprint plans solidify, xmonad 0.8
   released, typed sprintf and sscanf, and tons of discussion about
   everything from functional references to splitting up the base library
   to the future direction of Haskell.

Announcements

   unicode-properties 3.2.0.0, unicode-names 3.2.0.0. Ashley Yakeley
   [2]announced the release of the [3]unicode-properties 3.2.0.0 and
   [4]unicode-names 3.2.0.0 packages, which are representations in
   Haskell of various data in the Unicode 3.2.0 Character Database.

   experimental static blog engine in Haskell. jinjing [5]announced the
   initial release of [6]Panda, an experimental static blog engine written
   in Haskell.

   darcs hacking sprint, venues confirmed! (25-26 October). Eric Y. Kow
   [7]announced that two venues (Brighton, UK and Portland, Oregon, USA)
   have been confirmed for the [8]darcs hacking sprint on 25-26 October.

   darcs weekly news #2. Eric Y. Kow The second weekly issue of the
   [9]darcs weekly news has been published.

   xmonad 0.8 released!. Don Stewart [10]announced the release of
   [11]xmonad 0.8, featuring a general purpose gaps replacement, locale
   support, the ability to create your own configuration parsers, and
   various other [12]enhancements and fixes.

   POPL logo design contest. Don Stewart [13]forwarded a message
   announcing a logo design contest for POPL 2009. Dust off your magic
   markers/photoshop skills and get designing!

   ICFP09 Announcement. Matthew Fluet [14]announced [15]ICFP 2009, to be
   held 31st August to 2nd September 2009 in Edinburgh. ICFP provides a
   forum for researchers and developers to hear about the latest work on
   the design, implementations, principles, and uses of functional
   programming.

   Fast parallel binary-trees for the shootout:
   Control.Parallel.Strategies FTW!. Don Stewart [16]announced that the
   Computer Language Shootout recently got a quad core 64 bit machine, and
   outlined a plan and some initial results for porting the Haskell
   entries to take advantage of the available parallelism.

   The initial view on typed sprintf and sscanf. oleg [17]announced an
   implementation of typed sprintf and sscanf functions sharing the same
   formatting specifications, which also led to some interesting
   discussion and alternative proposals.

Discussion

   Generalize groupBy in a useful way?. Bart Massey [18]proposed changing
   the implementation of groupBy to extend its usefulness for predicates
   which are not equivalence relations.

   Splitting SYB from the base package in GHC 6.10. José Pedro Magalhães
   [19]initiated a discussion regarding splitting the SYB libraries out of
   the base package for GHC 6.10.

   The base library and GHC 6.10. Ian Lynagh initiated a [20]discussion on
   further splitting up the base package for GHC 6.10.

   Functional references. Tim Newsham began a [21]discussion on functional
   references and the possibility of merging the existing four or five
   implementations into something more standard.

   Types and Trees. Matt Morrow [22]wrote something about types and type
   representations, involving some commutative diagrams and some code. I
   haven't read it yet but it looks neat!

   Research language vs. professional language. Ryan Ingram started an
   interesting [23]discussion on the future direction(s) of the Haskell
   language.

   language proposal: ad-hoc overloading. Ryan Ingram [24]proposed adding
   ad-hoc name overloading to Haskell, prompting quite a bit of
   discussion.

   Top Level -. Ashley Yakeley originally [25]asked whether there is any
   interest in implementing a top level - to run monadic code. This set
   off a cascade of discussion the likes of which have been rarely seen on
   the Cafe. I would tell you what the discussion has been about but I
   must confess that I haven't read it.

Blog noise

   [26]Haskell news from the [27]blogosphere.
 * Eric Kow (kowey): [28]darcs hacking sprint (25-26 October 2008).
 * Magnus Therning: [29]Confusion with HaskellDB.
 * Xmonad: [30]xmonad 0.8 released!.
 * Real-World Haskell: [31]Speaking in Silicon Valley next week.
 * Luke Palmer: [32]Composable Input for Fruit.
 * Luke Palmer: [33]Slicing open the belly of the IO monad in an
   alternate universe.
 * FP Lunch: [34]Modular Monad Transformers.
 * Douglas M. Auclair (geophf): [35]Fuzzy unification parser in
   Haskell.
 * Bjoern Edstroem: [36]Speeding up Haskell

Re: [Haskell-cafe] GADTs and instances

2008-09-06 Thread Ryan Ingram
The problem is that the caller of get is allowed to say what type of
Query they want with this instance, for example:

] get :: Get (Query Int)
because Int is an instance of Binary, and you claim
] instance Binary a = Binary (Query a)
In fact, since the type of each query is unique, the tagging in put
doesn't help you.

So there is no way to write a generic Binary instance for Query a.

But don't give up!  Here's a solution in literate haskell...

 {-# LANGUAGE ExistentialQuantification, FlexibleInstances, GADTs #-}
 module Query where
 import Data.Binary
 import Control.Monad (liftM)

 data Query a where
 Lookup :: String - Query (Maybe Int)
 Fetch :: [String] - Query [Int]

One obvious strategy is to use existential types:

 data SomeQuery = forall a. SomeQuery (Query a)

You can then make SomeQuery an instance of Binary using very similar
code to your implementation.  Now, the code that calls get needs to
be able to deal with any Query type it gets back inside the SomeQuery.

Another possibility is to drop the tagging altogether and use a helper class:

 class BinaryQuery a where
 putQ :: Query a - Put
 getQ :: Get (Query a)

 instance BinaryQuery a = Binary (Query a) where
 put = putQ
 get = getQ

 instance BinaryQuery (Maybe Int) where
 putQ (Lookup x) = put x
 getQ = liftM Lookup get

 instance BinaryQuery [Int] where
 putQ (Fetch xs) = put xs
 getQ = liftM Fetch get

You can also combine the strategies and use SomeQuery when the stored
value needs a tag:

 instance Binary SomeQuery where
put (SomeQuery x@(Lookup _)) = putWord8 0  put x
put (SomeQuery x@(Fetch _)) = putWord8 1  put x
get = getWord8 = \tag - case tag of
0 - liftM SomeQuery (get :: Get (Query (Maybe Int)))
1 - liftM SomeQuery (get :: Get (Query [Int]))

The pattern matching in put specializes the type of x, allowing the
query-level put to find the correct implementation.  Similarily, in
get we choose the correct get based on the input type.

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


Re: [Haskell-cafe] Re: [xmonad] ANNOUNCE: xmonad 0.8 released!

2008-09-06 Thread Lennart Kolmodin

Don Stewart wrote:

nomeata:

Hi,

Am Freitag, den 05.09.2008, 18:38 -0700 schrieb Don Stewart:

xmonad packages are available in the package systems of at least:

Debian, Gentoo, Arch, Ubuntu, OpenBSD,
NetBSD, FreeBSD, Gobo, NixOS, Source Mage, Slackware

and 0.8 packages will appear in coming days (some are already available).

Debian xmonad and xmonad-contrib package uploaded (although
xmonad-contrib is in the two-day delayed queue, to give autobuilders a
chance to build xmonad first).


Great work, Joachim!

Thanks for being so responsive on this. Go Debian!


Committed to Gentoo Linux earlier this evening.

http://packages.gentoo.org/package/x11-wm/xmonad
http://packages.gentoo.org/package/x11-wm/xmonad-contrib

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


Re: [Haskell-cafe] Re: [xmonad] ANNOUNCE: xmonad 0.8 released!

2008-09-06 Thread Don Stewart
kolmodin:
 Don Stewart wrote:
 nomeata:
 Hi,
 
 Am Freitag, den 05.09.2008, 18:38 -0700 schrieb Don Stewart:
 xmonad packages are available in the package systems of at least:
 
 Debian, Gentoo, Arch, Ubuntu, OpenBSD,
 NetBSD, FreeBSD, Gobo, NixOS, Source Mage, Slackware
 
 and 0.8 packages will appear in coming days (some are already 
 available).
 Debian xmonad and xmonad-contrib package uploaded (although
 xmonad-contrib is in the two-day delayed queue, to give autobuilders a
 chance to build xmonad first).
 
 Great work, Joachim!
 
 Thanks for being so responsive on this. Go Debian!
 
 Committed to Gentoo Linux earlier this evening.
 
 http://packages.gentoo.org/package/x11-wm/xmonad
 http://packages.gentoo.org/package/x11-wm/xmonad-contrib

Gentoo steps up! Excellent work guys.
And if I read those graphs correctly, that's xmonad on hppa and sparc too?

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


Re: [Haskell-cafe] Re: [xmonad] ANNOUNCE: xmonad 0.8 released!

2008-09-06 Thread Lennart Kolmodin

Don Stewart wrote:

kolmodin:

Don Stewart wrote:

nomeata:

Hi,
Debian xmonad and xmonad-contrib package uploaded (although
xmonad-contrib is in the two-day delayed queue, to give autobuilders a
chance to build xmonad first).

Great work, Joachim!

Thanks for being so responsive on this. Go Debian!

Committed to Gentoo Linux earlier this evening.

http://packages.gentoo.org/package/x11-wm/xmonad
http://packages.gentoo.org/package/x11-wm/xmonad-contrib


Gentoo steps up! Excellent work guys.
And if I read those graphs correctly, that's xmonad on hppa and sparc too?



Yep, that's right.
Our arch teams has tested an earlier version, thus it's available for 
this version too since it doesn't introduce any major changes in 
dependencies or build procedure. Although probably no one has yet build 
it using our ebuild for this version, we're confident it'll work ;)


I'm pleased with upgrading and switching to avoidStruts without even 
having to log out, well done :)


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


[Haskell-cafe] Re: Top Level -

2008-09-06 Thread Ashley Yakeley

Ganesh Sittampalam wrote:
The set of ACIO expressions exp is the static initialisers of M. 
The RTS must note when each static initialiser is run, and cache its 
result val. Let's call this cache of vals the static results cache 
of M.


When M is loaded, and a static results cache for M already exists, 
then it will be used for the vals of M.


This sounds reachable to me, and therefore static overhead and not a 
leak.


You can call it what you like, but it's still unacceptable behaviour, 
particularly since clients of M will have no way of telling from its API 
that it will happen.


That what will happen?

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


Re: [Haskell-cafe] Re: Top Level -

2008-09-06 Thread Brandon S. Allbery KF8NH

On 2008 Sep 6, at 18:06, Ashley Yakeley wrote:

Ganesh Sittampalam wrote:
The set of ACIO expressions exp is the static initialisers of  
M. The RTS must note when each static initialiser is run, and  
cache its result val. Let's call this cache of vals the static  
results cache of M.


When M is loaded, and a static results cache for M already  
exists, then it will be used for the vals of M.


This sounds reachable to me, and therefore static overhead and  
not a leak.
You can call it what you like, but it's still unacceptable  
behaviour, particularly since clients of M will have no way of  
telling from its API that it will happen.


That what will happen?



I have no idea what Ganesh is complaining about, but if the point of  
ACIO is one-time initialization, it is pretty much required that  
something will be allocated to record the fact that a given item has  
been initialized (otherwise it can't guarantee the initializer runs  
exactly once, after all), and therefore that is part of the base ACIO  
API.  So what exactly is the issue here?


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


Re: [Haskell-cafe] Re: Top Level -

2008-09-06 Thread Brandon S. Allbery KF8NH


On 2008 Sep 6, at 18:25, Ashley Yakeley wrote:

1. Results from initialisers cannot be GC'd even if they become
otherwise unreachable, because the dynamic loader might re-load the
module (and then we'd need those original results).

2. If the dynamic loader loads an endless stream of different modules
containing initialisers, memory will thus leak.



I think if the issue is this vs. not being able to guarantee any once- 
only semantics, i consider the former necessary overhead for proper  
program behavior.  And that, given that there exists extra-program  
global state that one might want to access, once-only initialization  
is a necessity.  (Whoever it was who jumped off this point to say  
Haskell should exit the real world misses the point:  it's not even  
all that useful from a theoretical standpoint if it's not allowed to  
interact with anything outside itself, and stdin/stdout tend to  
require once-only initialization.  You can't really hide from it.)


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


[Haskell-cafe] (no subject)

2008-09-06 Thread Mario Blažević
Hello. I'm trying to apply the nested regions (as in Lightweight Monadic 
Regions by Oleg Kiselyov and Chung-chieh Shan) design pattern, if that's the 
proper term. I was hoping to gain a bit more type safety in this little library 
I'm working on -- Streaming Component Combinators, available on Hackage. I 
guess the problem is that I'm getting too much type safety now, because I can't 
get the thing to compile. Most of the existing code works, the only exceptions 
seem to be various higher-order functions. I've reduced the problem to several 
lines of Literate Haskell code below, can anybody think of a solution or a 
reason there can't be one?

 {-# LANGUAGE MultiParamTypeClasses, EmptyDataDecls, Rank2Types #-}
 {-# LANGUAGE FunctionalDependencies, FlexibleInstances, IncoherentInstances 
 #-}
 module Main where
 main = undefined

I'll call the main type, originally a monad transformer, simply Region. I'm 
leaving out the Monad and MonadTransformer instances, because they don't 
contribute to the problem. The parameter r is the phantom region type.

 newtype Region r a = Region a

The Ancestor class is used to denote relationship between two regions where one 
is nested in another.

 data Child r

 class Ancestor r r'

 instance   Ancestor r (Child r)
 instance Ancestor r1 r2 = Ancestor r1 (Child r2)

Handle is a simple wrapper around a value. It carries information about the 
region that originates the value.

 data Handle r x = Handle x

A typical calculation in the Region monad will take a bunch of Handles 
inherited from an Ancestor region and do something with them. The Ancestor 
constraint is there to ensure that the handles are not fake but genuinely 
inherited.

 type SingleHandler x y = forall r1s rs. Ancestor r1s rs =
  Handle r1s x - Region rs y
 type DoubleHandler x y z = forall r1d r2d rd. (Ancestor r1d rd, Ancestor r2d 
 rd) =
Handle r1d x - Handle r2d y - Region rd z

And now I'm getting to the problem. The following higher-order function doesn't 
type-check:

 mapD :: (SingleHandler x z - SingleHandler y z)
 - DoubleHandler x w z - DoubleHandler y w z
 mapD f d = \y w- f (\x- d x w) y

I get the same error from GHC 6.8.2 and 6.8.2:

Test.lhs:36:28:
Could not deduce (Ancestor r2d rs)
  from the context (Ancestor r1s rs)
  arising from a use of `d' at Test.lhs:36:28-32
Possible fix:
  add (Ancestor r2d rs) to the context of
the polymorphic type
  `forall r1s rs. (Ancestor r1s rs) = Handle r1s x - Region rs z'
In the expression: d x w
In the first argument of `f', namely `(\ x - d x w)'
In the expression: f (\ x - d x w) y

The same code compiles just fine if all the Ancestor constraints are removed. I 
don't see any place to add the extra (Ancestor r2d rs) constraint, as GHC 
recommends. I think it ought to be able to figure things out based on the 
exisisting constraints, but I may be wrong: perhaps higher-order functions pose 
an insurmountable problem for type-level programming in Haskell. Can anybody 
shed any light on this?



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


[Haskell-cafe] A problem with nested regions and higher-order functions

2008-09-06 Thread Mario Blažević
I forgot the subject, sorry for reposting...

I'm trying to apply the nested regions (as in Lightweight Monadic Regions by 
Oleg Kiselyov and Chung-chieh Shan) design pattern, if that's the proper term, 
in hope to gain a bit more type safety in this little library I'm working on 
(Streaming Component Combinators, available on Hackage). I guess the problem is 
that I'm getting too much type safety now, because I can't get the thing to 
compile. Most of the existing code works, the only exceptions seem to be 
various higher-order functions. I've reduced the problem to several lines of 
Literate Haskell code below, can anybody find a solution or confirm there isn't 
one?

 {-# LANGUAGE EmptyDataDecls, Rank2Types #-}
 {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, 
 FlexibleInstances, IncoherentInstances #-}
 module Main where
 main = undefined

I'll call the main type, originally a monad transformer, simply Region. I'm 
leaving out the Monad and MonadTransformer instances, because they don't 
contribute to the problem. The parameter r is the phantom region type.

 newtype Region r a = Region a

The Ancestor class is used to denote relationship between two regions where one 
is nested in another.

 data Child r

 class Ancestor r r'

 instance   Ancestor r (Child r)
 instance Ancestor r1 r2 = Ancestor r1 (Child r2)

Handle is a simple wrapper around a value. It carries information about the 
region that originates the value.

 data Handle r x = Handle x

A typical calculation in the Region monad will take a bunch of Handles 
inherited from an Ancestor region and do something with them. The Ancestor 
constraint is there to ensure that the handles are not fake but genuinely 
inherited.

 type SingleHandler x y = forall r1s rs. Ancestor r1s rs =
  Handle r1s x - Region rs y
 type DoubleHandler x y z = forall r1d r2d rd. (Ancestor r1d rd, Ancestor r2d 
 rd) =
Handle r1d x - Handle r2d y - Region rd z

And now I get to the problem. The following higher-order function doesn't 
type-check:

 mapD :: (SingleHandler x z - SingleHandler y z)
 - DoubleHandler x w z - DoubleHandler y w z
 mapD f d = \y w- f (\x- d x w) y

I get the same error from GHC 6.8.2 and 6.8.2:

Test.lhs:36:28:
Could not deduce (Ancestor r2d rs)
  from the context (Ancestor r1s rs)
  arising from a use of `d' at Test.lhs:36:28-32
Possible fix:
  add (Ancestor r2d rs) to the context of
the polymorphic type
  `forall r1s rs. (Ancestor r1s rs) = Handle r1s x - Region rs z'
In the expression: d x w
In the first argument of `f', namely `(\ x - d x w)'
In the expression: f (\ x - d x w) y

The same code compiles just fine if all the Ancestor constraints are removed. I 
don't see any place to add the extra (Ancestor r2d rs) constraint, as GHC 
recommends. I think it ought to be able to figure things out based on the 
exisisting constraints, but I may be wrong: perhaps higher-order functions pose 
a fundamental problem for type-level programming. Can anybody shed any light on 
this?


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