Re: [Haskell-cafe] Re: HXT Namespaces and XPath

2010-04-07 Thread Uwe Schmidt
Hi Mads,

 Replying to myself:
 
  I think another example will clarify my point. The code:
  
  simpleXmlOne, simpleXmlTwo :: String
  simpleXmlOne = a:Foo xmlns:a=\http://foo.org\/
  simpleXmlTwo = b:Foo xmlns:b=\http://foo.org\/
  
  nsEnv :: [(String, String)]
  nsEnv = [ (notFoo, http://notfoo.org;) ]
  
  evalXPath :: String - [XmlTree]
  evalXPath xml =
runLA ( xread
 propagateNamespaces
 getXPathTreesWithNsEnv nsEnv //a:Foo

this line contains the problem:

getXPathTreesWithNsEnv assumes, that for all prefixes used in the XPath expr,
the nsEnv contains an entry. Furthermore the default namespace
can be given by an entry for the empty prefix .

So you'll only get reasonable results, when nsEnv contains at least an entry 
for a, e.g.

nsEnv = [ (a, http://x.y;), ... ]

when you use the XPath expr //a:Foo.

You may argue, that in your example, an error should be raised by the XPath 
parser, instead
of accepting //a:Foo. But currently it's assumed, that getXPathTreesWithNsEnv 
is used
only in an innocent way.
 
Cheers,

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


Re: [Haskell-cafe] Re: HXT Namespaces and XPath

2010-04-07 Thread Ivan Miljenovic
On 7 April 2010 16:41, Uwe Schmidt s...@fh-wedel.de wrote:
 But currently it's assumed, that getXPathTreesWithNsEnv is used only in an 
 innocent way.

I like your phrasing here... I might steal it for graphviz rather than
just saying it's assumed that you don't do such-and-such :p

-- 
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] [haskell.org Google Summer of Code] Student Applications Due Friday!

2010-04-07 Thread Johan Tibell
On Wed, Apr 7, 2010 at 12:46 AM, Edward Kmett ekm...@gmail.com wrote:
 This is a friendly reminder that student applications for the summer of code
 are due to Google by Friday, April 9th.
 http://socghop.appspot.com/document/show/gsoc_program/google/gsoc2010/timeline
 That is just 3 days from now!
 Keep in mind that while we've been tracking general interest in different
 projects through the trac, the application doesn't count unless you submit
 it to Google at
 http://socghop.appspot.com/gsoc/program/home/google/gsoc2010

I'd just like to repeat that it's really important that you sign up with Google.

 While all details of the application do not need to be finalized, as much of
 the information from
 http://hackage.haskell.org/trac/summer-of-code/wiki/StudApply2010
 as possible should probably be included in your application.

Several people have sent long project descriptions to this mailing
lists. Please also include these in your application.

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


Re: [Haskell-cafe] Established names for a couple of list functionals?

2010-04-07 Thread Nicolas Pouillard
On Tue, 6 Apr 2010 21:56:37 +0100, Stephen Tetley stephen.tet...@gmail.com 
wrote:
 Hello all
 
 
 Having traversals with special behaviour for the first or last element
 is useful for my current work:
 
 -- first element special
 --
 anacrusisMap :: (a - b) - (a - b) - [a] - [b]
 anacrusisMap _ _ [] = []
 anacrusisMap f g (a:as) = f a : map g as

I think it makes for sense to not wire in the map function.

firstOthers :: (a - b) - ([a] - [b]) - [a] - [b]
firstOthers _ _ [] = []
firstOthers f g (x:xs) = f x : g xs

Then anacrusisMap is so short that we don't give it a name.

anacrusisMap f = firstOthers f . map

Same thing goes to the other one.

Regards,

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


Re: [Haskell-cafe] Announce: hothasktags

2010-04-07 Thread Evan Laforge
On Thu, Apr 1, 2010 at 1:46 PM, Luke Palmer lrpal...@gmail.com wrote:
 Hi,

 I'd like to draw attention to a little script I wrote.  I tend to use
 qualified imports and short names like new and filter.  This makes
 hasktags pretty much useless, since it basically just guesses which
 one to go to.  hothasktags is a reimplementation of hasktags that uses
 haskell-src-exts to analyze the import structure to generate (scoped)
 tags pointing to the right definition.  I'm pretty addicted to it,
 since it provides the only functionality I miss from visual studio
 :-).

 VIm only for now, since I don't know if emacs tags format supports
 scoped tags.  I am aware that it is not perfect -- patches and bug
 reports welcome.

Hi, thanks for this, I've been wanting something like this for a long
time!  I have a suggestion and a question though:

If you prepend the tags file with !_TAG_FILE_SORTED\t1\t ~\n then I
think vim should be able to do a binary search on the file.

This program generates a tag for each reference to a symbol:

Derive.PitchDeriver Derive/Derive.hs98;file:Cmd/Cmd.hs
Derive.PitchDeriver Derive/Derive.hs98;file:Cmd/Play.hs
Derive.PitchDeriver Derive/Derive.hs98;
file:Cmd/ResponderSync.hs
... [ 20 more ] ...

The vim tag documentation says these are static tags, and implies
they are meant to apply to symbols only valid within the same file,
but this is clearly not the case.  Actually, the vim doc implies that
only file: is defined, and doesn't talk about scoped tags so I'm
not sure what is going on.  Anyway, whenever I go to a tag I have to
first step through a message that says 1 of 25 or so.  There's one
for each reference in the tags file, even though those are references
in other files.

What's going on?  I even checked the current docs at vim.org and they
don't mention a file:xyz form either.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: hothasktags

2010-04-07 Thread Evan Laforge
Ohh, and the other issue I had was that setting iskeyword causes 'w'
to skip over '.'s.  This causes trouble for me because I'm used to
using 'w' to skip between components of the symbol and 'W' to skip it
entirely.  Is there a workaround you use, maybe a better way to
navigate?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Iavor Diatchki
Hi everyone,

thanks for your efforts to improve the site!  To be honest, I don't
really like the current design, so here are some suggestions that
might help:

* I find the color scheme a bit bleak;  I'd prefer something more colorful.
* Some graphics might improve the overall style.
* We need to be more consistent in the use of fonts: the current
design has text in almost all combinations of blue, black, orange,
bold, italic, and normal, and at least 3 different font sizes.  This
makes the page complex and somewhat disorganized.
* I realized that this is just a mock-up but there seems to be a lot
of duplication in the content (e.g., multiple links to the Haskell
platform, online interpreter, hackage, GHC).  Avoiding unnecessary
duplication might lead to a simpler and more organized page.
* It would be nice if the page layout provided more visual cues to
separate the bits of the page that are likely to change a lot (e.g.,
news  events) from the more static bits (e.g., downloads,
documentation, community resources, etc.).  Perhaps the more static
bits could be factored into some kind of menu?

Hope that this helps,
-Iavor




On Tue, Apr 6, 2010 at 8:03 PM, Antoine Latter aslat...@gmail.com wrote:
 On Tue, Apr 6, 2010 at 8:22 PM, Thomas Schilling
 nomin...@googlemail.com wrote:
 Ok, last revision for tonight:  http://i.imgur.com/d3ARq.png

 I'm no web design guru, but this is definitely better than what we
 have now. Good job on it.

 Antoine
 ___
 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] Re: Haskell.org re-design

2010-04-07 Thread Thomas Davie

On 7 Apr 2010, at 02:53, Ben Millwood wrote:

 On Wed, Apr 7, 2010 at 2:22 AM, Thomas Schilling
 nomin...@googlemail.com wrote:
 I have
 set a maximum width on purpose so that it doesn't degrade too badly on
 big screens.
 
 I've never really trusted this argument - it's not required that the
 browser window occupy the entire screen, so why not let the user
 choose how wide they want their text?

Unfortunately, because the majority operating system has such bad window 
management that all users do make their windows take up the entire screen.

:(

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


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Miguel Mitrofanov

Doesn't seem right. IMHO, the necessity of making windows NOT fullscreen is an 
indication of bad design.

Thomas Davie wrote:

On 7 Apr 2010, at 02:53, Ben Millwood wrote:


On Wed, Apr 7, 2010 at 2:22 AM, Thomas Schilling
nomin...@googlemail.com wrote:

I have
set a maximum width on purpose so that it doesn't degrade too badly on
big screens.

I've never really trusted this argument - it's not required that the
browser window occupy the entire screen, so why not let the user
choose how wide they want their text?


Unfortunately, because the majority operating system has such bad window 
management that all users do make their windows take up the entire screen.

:(

Bob___
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] Re: GSoC: Hackage 2.0

2010-04-07 Thread Matthew Gruen
On Wed, Apr 7, 2010 at 12:40 AM, Matthew Gruen wikigraceno...@gmail.com wrote:
 Hi Haskellers,

 snip

Oh, heh, I apologize if that was more of a wall of text than I had
realized. The above wasn't a project proposal itself, more the result
of some brainstorming and some research. If you have the time to read
it, I'd really appreciate your feedback.

In fewer words, what kinds of features would benefit the community
most for Hackage?

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


[Haskell-cafe] Network: buffering troubles

2010-04-07 Thread Yves Parès

Hello,

I have isolated a problem when using (lazy) ByteStrings through the network
(GHC 6.12.1, Ubuntu 9.10 32bits):

Here is my client:  http://old.nabble.com/file/p28162932/Client.hs Client.hs 
And my server:  http://old.nabble.com/file/p28162932/Server.hs Server.hs 

The server holds until the client closes the connection, even if I flush the
handle on the client side after writing or even if I turn off buffering on
both sides.

-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Network%3A-buffering-troubles-tp28162932p28162932.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] Re: Haskell.org re-design

2010-04-07 Thread Neil Brown

Thomas Schilling wrote:

Here's a matching Wiki style:  http://i.imgur.com/XkuzH.png

  


I like your designs (I liked the blue and orange version, but all the 
colour schemes seem fine).


For the wiki design, it would be good to re-think and cull those links 
at the top of the page.  For example, I don't think that random page 
needs to be in the top bar.  With several other links it's not clear to 
me what they do.  Perhaps it's just me, but wiki community and 
special pages doesn't suggest what they do or why I would want to 
click them, and related changes also puzzles me as to what it might 
be.  The recent changes and page history links seem redundant.


The Haskell wiki has some useful content but the pages are cluttered 
with these links.  Simply removing a few of these links (while we're 
redesigning the site anyway) would enhance the pages' usability.


Thanks,

Neil.



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


Re: [Haskell-cafe] Re: HXT Namespaces and XPath

2010-04-07 Thread Mads Lindstrøm
Hi Uwe

 Hi Mads,
 
  Replying to myself:
  
   I think another example will clarify my point. The code:
   
   simpleXmlOne, simpleXmlTwo :: String
   simpleXmlOne = a:Foo xmlns:a=\http://foo.org\/
   simpleXmlTwo = b:Foo xmlns:b=\http://foo.org\/
   
   nsEnv :: [(String, String)]
   nsEnv = [ (notFoo, http://notfoo.org;) ]
   
   evalXPath :: String - [XmlTree]
   evalXPath xml =
 runLA ( xread
  propagateNamespaces
  getXPathTreesWithNsEnv nsEnv //a:Foo
 
 this line contains the problem:
 
 getXPathTreesWithNsEnv assumes, that for all prefixes used in the XPath expr,
 the nsEnv contains an entry. Furthermore the default namespace
 can be given by an entry for the empty prefix .
 
 So you'll only get reasonable results, when nsEnv contains at least an entry 
 for a, e.g.
 
 nsEnv = [ (a, http://x.y;), ... ]
 
 when you use the XPath expr //a:Foo.
 
 You may argue, that in your example, an error should be raised by the XPath 
 parser, instead
 of accepting //a:Foo. But currently it's assumed, that 
 getXPathTreesWithNsEnv is used
 only in an innocent way.

Yes, that was what I would have expected.

  
 Cheers,
 
   Uwe

/Mads


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Magnus Therning
On Wed, Apr 7, 2010 at 11:12, Neil Brown nc...@kent.ac.uk wrote:
 For the wiki design, it would be good to re-think and cull those links at
 the top of the page.  For example, I don't think that random page needs to
 be in the top bar.  With several other links it's not clear to me what they
 do.  Perhaps it's just me, but wiki community and special pages doesn't
 suggest what they do or why I would want to click them, and related
 changes also puzzles me as to what it might be.  The recent changes and
 page history links seem redundant.

Special pages is rather useful for administrators, but not *that*
useful for regular users I guess.  Would it be possible to put it
easily accessible for administrators (people who are allowed to add
users), but hide it away a bit for non-admins?

/M

-- 
Magnus Therning(OpenPGP: 0xAB4DFBA4)
magnus@therning.org  Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Announce: hothasktags

2010-04-07 Thread Peter Hercek

On 04/07/2010 09:23 AM, Evan Laforge wrote:

On Thu, Apr 1, 2010 at 1:46 PM, Luke Palmerlrpal...@gmail.com  wrote:
   

VIm only for now, since I don't know if emacs tags format supports
scoped tags.  I am aware that it is not perfect -- patches and bug
reports welcome.
 

This program generates a tag for each reference to a symbol:

Derive.PitchDeriver Derive/Derive.hs98;file:Cmd/Cmd.hs
Derive.PitchDeriver Derive/Derive.hs98;file:Cmd/Play.hs
Derive.PitchDeriver Derive/Derive.hs98;
file:Cmd/ResponderSync.hs
... [ 20 more ] ...

The vim tag documentation says these are static tags, and implies
they are meant to apply to symbols only valid within the same file,
but this is clearly not the case.  Actually, the vim doc implies that
only file: is defined, and doesn't talk about scoped tags so I'm
not sure what is going on.  Anyway, whenever I go to a tag I have to
first step through a message that says 1 of 25 or so.  There's one
for each reference in the tags file, even though those are references
in other files.

What's going on?  I even checked the current docs at vim.org and they
don't mention a file:xyz form either.
   


As far as I know, there is nothing like file:xyz only file:. This is 
to support static tags which I would not call scoped tags because they 
know only one scope: the file scope. Between, ghci can generate tags 
file for you with static tags too in ghc 6.12.1. The ticket which 
discusses this feature and also discusses emacs support for static tags 
is here:

http://hackage.haskell.org/trac/ghc/ticket/3434

Peter.

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


[Haskell-cafe] Crypto: PC1 - Cipher?

2010-04-07 Thread Günther Schmidt

Hello,

does anyone know what the PC1-cipher is and if there is a Haskell 
implementation?


Günther


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


Re: [Haskell-cafe] Break Function Using Lazy Pairs

2010-04-07 Thread Leon Smith
That example doesn't particularly tie the knot,  unless you count
the fact that break is itself a recursive function.  Usually tie
the knot refers to some kind of circular programming,  i.e. a
self-referential data structure,  or explicit use of Data.Function.fix
to produce a recursive function  (as is useful in e.g. dynamic
programming)

Also,  you aren't understanding the laziness of the return product;
instead you are still thinking of this example in terms of eager
evaluation as almost every other programming language uses.   A better
approximation of what is going on could be represented textually as:

-- break hi\nbye
-- ( 'h' : ys, zs )   where (  ys, zs  ) = break i\nbye
-- ( 'h' : 'i' : ys, zs )   where (  ys, zs  ) = break \nbye
-- ( 'h' : 'i' : [] , bye)

Of course,  if you want to get more pendantic,  I've glossed over
steps involving the conditional and something resembling
beta-reduction.   Incidentally,  it's the latter part I omitted which,
 naively implemented,  creates the space leak referred to in the
original post.

Best,
Leon

On Mon, Apr 5, 2010 at 5:19 PM, aditya siram aditya.si...@gmail.com wrote:
 Hi all,
 For the past couple of weeks I've been trying to understand
 tying-the-knot style programming in Haskell.

 A couple of days ago, Heinrich Apfelmus posted the following 'break'
 function as part of an unrelated thread:
 break []     = ([],[])
 break (x:xs) = if x == '\n' then ([],xs) else (x:ys,zs)
               where (ys,zs) = Main.break xs

 I've stepped through the code manually to see if I understand and I'm
 hoping someone will tell me if I'm on the right track:
 -- break hi\nbye =
 --    let f1 = (break i\nbye)
 --           = let f2 = (break \nbye)
 --                    = ([],bye)
 --             ('i' : fst f2, snd f2) = ('i' : [], bye)
 --    ('h' : fst f1, snd f1) = ('h' : 'i' : [], bye)
 --                           = (hi,bye)

 -deech
 ___
 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] Re: GSoC: Hackage 2.0

2010-04-07 Thread Maciej Piechotka
On Wed, 2010-04-07 at 00:40 -0400, Matthew Gruen wrote:
 Hi Haskellers,
 
 I'm Matt Gruen (Gracenotes in #haskell), and the Hackage 2.0 SoC
 project at http://hackage.haskell.org/trac/summer-of-code/ticket/1587
 really piqued my interest. It seems doable, in a summer, to make the
 new hackage-server more-than-deployment-ready as well as clearing out
 some items in the hackage bug tracker[0]; so, I've been working on a
 proposal. In this email I'd like to consolidate my mental notes for
 haskell-cafe and formulate a roadmap towards a more social Hackage.
 
 The most vital part is getting hackage-server
 http://code.haskell.org/hackage-server/ to a state where it can be
 switched in place of hackage-scripts
 http://darcs.haskell.org/hackage-scripts/, and doing it properly,
 organizing the code so it can be extended painlessly in the future.
 Duncan Coutts, Antoine Latter, and others have done some great work on
 it in the past few years. I've been using Haskell for 1.33 of those
 years. I think I could become fluent in the codebases after a week of
 dedicated study, although even the hackage-server and hackage-scripts
 repositories don't include some components such as the current build
 report script.
 
 For putting the 2.0 in Hackage 2.0, any interface changes should help
 the library users and the library writers/uploaders without hurting
 either of them. Hackage should contain more of the right kind of
 information. Statistics help everyone, and they're a pretty good gauge
 on the direction of Hackage as a whole. Package popularity contents
 are one form of this. Reverse dependencies and even dependency
 graphs[1] are great, if I can integrate and expand Roel van Dijk's
 work[2].
 
 There should also be some space on package pages, or on pages a link
 away from them, for users to contribute information and suggestions.
 Coders can explain why or why not the package met their needs, as a
 sort of informal bug/enhancement tracking service. Another helpful
 flavor of information is package relationships beyond dependencies:
 'Deprecated in favor of Foo', 'a fork of Foo', or 'does blah instead
 of Foo's plugh functionality'. This will help people find the 'right'
 package among look-alikes. There could also be links to illustrative
 usage examples for getting started. Happstack's state management will
 be a good match for updating and serving this information in real
 time.
 

I guess 'works also with B in version X.Y.Z' is also. Most of the above
changes should not be IMHO in cabal (sorry for answering PS here).
Especially 'not maintained anymore' and 'does not build on recent
GHC' ;)

 There's also a need for a more interactive form of package
 documentation, but this should strengthen relationships with existing
 tools like Haddock and Cabal, not bypass the tools. For example,
 adding a changelog[3] or making Haddock's declaration-by-declaration
 commentary more wiki-like[4]. Changelogs seem to be within the scope
 of Hackage 2.0, integrating with Cabal; Haddock wikification might not
 be, perhaps deserving a separate student-summer session of its own.
 These can improve the package page and documentation subtrees.
 

As we are with Haddock - 'rebuild' button if package failed to build?
For some reasons some packages fails to build on hackage (as yi). I'm
not sure if it will work however. At least uploading docs should be
possible.

Regards



signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Daniel Fischer
Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite:
 While I think that (d) is a valid concern, it is also important not to
 let the perfect be the enemy of the good.  If we agree that the proposed
 web site layout is sufficiently better than the current one and is good
 enough aesthetically, then I think we should go ahead and switch to the
 new layout and *then* start thinking about how we could make it

Good plan.

 *completely amazing* like the Ruby web site,

www.ruby-lang.org ?

Sure, that looks pretty good, but completely amazing?

 because if we demand
 completely amazing for our *first* try then I fear that all that will
 happen is that nothing will change because the bar will have been set
 too high.

 Cheers,
 Greg

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


Re: [Haskell-cafe] hsql repository

2010-04-07 Thread Marc Weber
Hi Daniil Elovkov,

AFAIK Nick patched HSQL the last time.

However he hasn't had time to submit its changes to the repository.

So currently the Hackage version is more up to date than the repository.

HSQL is hosted on the Haskell community server:

http://code.haskell.org/HSQL/

Best way to continue: Get hackage version. Copy the mover into the darcs
repository. Ask Nick (Jörg Rudnick) whether he wants credits. Make a
darcs commit giving it a message such as fix some extensible Exceptions
stuff. patch provided by Joerg Rudnick and continue

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


[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Simon Marlow

On 25/03/2010 23:16, Bas van Dijk wrote:

On Thu, Mar 25, 2010 at 11:23 PM, Simon Marlowmarlo...@gmail.com  wrote:

So I'm all for deprecating 'block' in favor of 'mask'. However what do
we call 'unblock'? 'unmask' maybe? However when we have:

mask $ mask $ unmask x

and these operations have the counting nesting levels semantics,
asynchronous exception will not be unmasked in 'x'. However I don't
currently know of a nicer alternative.


But that's the semantics you wanted, isn't it?  Am I missing something?


Yes I like the nesting semantics that Twan proposed.

But with regard to naming, I think the name 'unmask' is a bit
misleading because it doesn't unmask asynchronous exceptions. What it
does is remove a layer of masking so to speak. I think the names of
the functions should reflect the nesting or stacking behavior. Maybe
something like:

addMaskingLayer :: IO a -  IO a
removeMaskingLayer :: IO a -  IO a
nrOfMaskingLayers :: IO Int

However I do find those a bit long and ugly...


I've been thinking some more about this, and I have a new proposal.

I came to the conclusion that counting nesting layers doesn't solve the 
problem: the wormhole still exists in the form of nested unmasks.  That 
is, a library function could always escape out of a masked context by 
writing


  unmask $ unmask $ unmask $ ...

enough times.

The functions blockedApply and blockedApply2 proposed by Bas van Dijk 
earlier solve this problem:


blockedApply :: IO a - (IO a - IO b) - IO b
blockedApply a f = do
  b - blocked
  if b
then f a
else block $ f $ unblock a

blockedApply2 :: (c - IO a) - ((c - IO a) - IO b) - IO b
blockedApply2 g f = do
  b - blocked
  if b
then f g
else block $ f $ unblock . g

but they are needlessly complicated, in my opinion.  This offers the 
same functionality:


mask :: ((IO a - IO a) - IO b) - IO b
mask io = do
  b - blocked
  if b
 then io id
 else block $ io unblock

to be used like this:

a `finally` b =
  mask $ \restore - do
r - restore a `onException` b
b
return r

So the property we want is that if I call a library function

  mask $ \_ - call_library_function

then there's no way that the library function can unmask exceptions.  If 
all they have access to is 'mask', then that's true.


It's possible to mis-use the API, e.g.

  getUnmask = mask return

but this is also possible using blockedApply, it's just a bit harder:

  getUnmask = do
m - newEmptyMVar
f - blockedApply (join $ takeMVar m) return
return (\io - putMVar m io  f)

To prevent these kind of shennanigans would need a parametricity trick 
like the ST monad.  I don't think it's a big problem that you can do 
this, as long as (a) we can explain why it's a bad idea in the docs, and 
(b) we can still give a semantics to it, which we can.


So in summary, my proposal for the API is:

  mask  :: ((IO a - IO a) - IO b) - IO b
  -- as above

  mask_ :: IO a - IO a
  mask_ io = mask $ \_ - io

and additionally:

  nonInterruptibleMask  :: ((IO a - IO a) - IO b) - IO b
  nonInterruptibleMask_ :: IO a - IO a

which is just like mask/mask_, except that blocking operations (e.g. 
takeMVar) are not interruptible.  Nesting mask inside 
nonInterruptibleMask has no effect.  The new version of 'blocked' would be:


   data MaskingState = Unmasked
 | MaskedInterruptible
 | MaskedNonInterruptible

  getMaskingState :: IO MaskingState

Comments?  I have a working implementation, just cleaning it up to make 
a patch.


Cheers,
Simon

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


RE: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Sittampalam, Ganesh
Simon Marlow wrote:

 I came to the conclusion that counting nesting layers doesn't solve
 the problem: the wormhole still exists in the form of nested unmasks.
 That is, a library function could always escape out of a masked
 context by writing
 
unmask $ unmask $ unmask $ ...
 
 enough times.
[...]
 mask :: ((IO a - IO a) - IO b) - IO b
 mask io = do
b - blocked
if b
   then io id
   else block $ io unblock
 
 to be used like this:
 
 a `finally` b =
mask $ \restore - do
  r - restore a `onException` b
  b
  return r
 
 So the property we want is that if I call a library function
 
mask $ \_ - call_library_function
 
 then there's no way that the library function can unmask exceptions. 
 If all they have access to is 'mask', then that's true.
[...]
 It's possible to mis-use the API, e.g.
 
getUnmask = mask return

Given that both the simple mask/unmask and your alternate proposal
have backdoors, is the extra complexity really worth it?

The problem with the existing API is that it's not possible even for
well-behaved library code to use block/unblock without screwing up
callers. With the simple mask/unmask, the rule is simply that you don't
call unmask except within the context of your own mask calls.

Ganesh

=== 
Please access the attached hyperlink for an important electronic communications 
disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
=== 

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


Re: [Haskell-cafe] Network: buffering troubles

2010-04-07 Thread Yves Parès

Apparently, the trouble seems to come from binary deserialization.

When I read my handle with:
inp - L.hGet hdl 24
and no longer with:
inp - L.hGetContents hdl
I get a lazy bytestring which is no longer infinite, and then
deserialization occurs right.
It proves that at the time of deserialization, the server has all the data
it needs, and should not hold.

I usually don't know the size of the structures I receive through network. I
only know their type, and this should be sufficient for Data.Binary.decode,
since it knows how to work with lazy bytestrings.

Apparently, this example shows no problem with GHC 6.10.

I think that network+binary is quite a common combination in Haskell, so is
there anyone here who also uses GHC 6.12 and has this problem?


Yves Parès wrote:
 
 Hello,
 
 I have isolated a problem when using (lazy) ByteStrings through the
 network (GHC 6.12.1, Ubuntu 9.10 32bits):
 
 Here is my client:  http://old.nabble.com/file/p28162932/Client.hs
 Client.hs 
 And my server:  http://old.nabble.com/file/p28162932/Server.hs Server.hs 
 
 The server holds until the client closes the connection, even if I flush
 the handle on the client side after writing or even if I turn off
 buffering on both sides.
 


-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Network%3A-buffering-troubles-tp28162932p28166613.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] Established names for a couple of list functionals?

2010-04-07 Thread Henning Thielemann

Stephen Tetley schrieb:

Hello all


Having traversals with special behaviour for the first or last element
is useful for my current work:

-- first element special
--
anacrusisMap :: (a - b) - (a - b) - [a] - [b]
anacrusisMap _ _ [] = []
anacrusisMap f g (a:as) = f a : map g as

-- last element special
--
cabooseMap :: (a - b) - (a - b) - [a] - [b]
cabooseMap _ _ [] = []
cabooseMap f g (a:as) = step a as where
  step x []   = [g x]
  step x (y:ys)   = f x : step y ys


*Overlay1 anacrusisMap (+1) id [1..10]
[2,2,3,4,5,6,7,8,9,10]

*Overlay1 cabooseMap id (+1) [1..10]
[1,2,3,4,5,6,7,8,9,11]

My question (trivial, but still...) - is there any prior art naming
these functions?

For the record, my name derivation is:

+ anacrusis - musical term, the pickup notes before the first bar in a score.

+ caboose - there was discussion on Haskell-Cafe a couple of months
ago about a list data type with a distinguished terminal type. Caboose
is the name I remember.
  

I build such functions using viewL/viewR or switchL/switchR:
   
http://hackage.haskell.org/packages/archive/utility-ht/0.0.5.1/doc/html/Data-List-HT.html#v%3AviewL


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


Re: [Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-07 Thread Henning Thielemann

Gregory Crosswhite schrieb:

I would venture that the condition under which unsafeIOtoST would be safe is if 
all of the computations you are performing in the IO monad are only changing 
state that is local to the computation within the ST monad in which you are 
running.  (For example, if there were no STRef type then you could emulate it 
using IORefs, and this would be safe since the IORefs couldn't leak outside of 
the ST monad.)

This is the way I implemented ST and STRef for JHC:
  http://code.haskell.org/~thielema/statethread/



On Apr 6, 2010, at 5:30 PM, Roman Leshchinskiy wrote:


  

In fact, the only safe-ish use for it I have found is to use Storable-related 
functions in ST, hoping that the instances don't actually use any real IO 
functionality. Arguably, this shouldn't be necessary as Storable should live in 
ST anyway.


But Storable in ST monad would be still dangerous, because pointers may 
point to non-allocated memory or point outside of an array.


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


Re: [Haskell-cafe] Network: buffering troubles

2010-04-07 Thread Yves Parès

News! (Sorry for the spam, but this problem turns to be a headache)

The problem actually comes from ByteStrings (either lazy or strict).
I reduced my server code to this:

import Network
import System.IO
import qualified Data.ByteString(.Lazy) as L

main = do
  (hdl,_,_) - listenOn (PortNumber ) = accept
  hSetBuffering hdl NoBuffering
  inp - L.hGetContents hdl
  putStrLn . show $ L.take 8 inp

My client hasn't changed, and sends properly the data. So the server
shouldn't hold. Well, even when trying to rawly print the first 8 bytes of
the stream, it does.

But when I use normal Strings, it doesn't hold:

import Network
import System.IO

main = do
  (hdl,_,_) - listenOn (PortNumber ) = accept
  hSetBuffering hdl NoBuffering
  inp - hGetContents hdl
  putStrLn . show $ take 8 inp

I think this behavior is normal for strict ByteStrings, but not for lazy
ones...

-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Network%3A-buffering-troubles-tp28162932p28166941.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] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Simon Marlow

On 07/04/2010 16:20, Sittampalam, Ganesh wrote:

Simon Marlow wrote:


I came to the conclusion that counting nesting layers doesn't solve
the problem: the wormhole still exists in the form of nested unmasks.
That is, a library function could always escape out of a masked
context by writing

unmask $ unmask $ unmask $ ...

enough times.

[...]

mask :: ((IO a -  IO a) -  IO b) -  IO b
mask io = do
b- blocked
if b
   then io id
   else block $ io unblock

to be used like this:

a `finally` b =
mask $ \restore -  do
  r- restore a `onException` b
  b
  return r

So the property we want is that if I call a library function

mask $ \_ -  call_library_function

then there's no way that the library function can unmask exceptions.
If all they have access to is 'mask', then that's true.

[...]

It's possible to mis-use the API, e.g.

getUnmask = mask return


Given that both the simple mask/unmask and your alternate proposal
have backdoors, is the extra complexity really worth it?


The answer is yes, for a couple of reasons.

 1. this version really is safer than mask/unmask that count
nesting levels.  If the caller is playing by the rules,
then a library function can't unmask exceptions.  The
responsibility not to screw up is in the hands of the
caller, not the callee: that's an improvement.

 2. in this version more of the code is in Haskell, and
the primitives and RTS implementation are simpler.  So
actually I consider this less complex than counting
nesting levels.

I did implement the nesting levels version first, and when adding 
non-interruptibility to the mix things got quite hairy.


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


Re: [Haskell-cafe] Established names for a couple of list functionals?

2010-04-07 Thread Stephen Tetley
Hi Henning and Nicolas

Thanks, but... I'm not arguing that the functions are generally useful
so inter-defined-ness is beside the point. I've a couple of instances,
in code that is sadly too complicated and I hope to simplify later,
where the describing/naming the traversal currently adds clarity and
makes the code marginally more succinct. I recognize this is somewhat
unusual - indeed the previous times I've used these two functionals
I've refactored them out later - but at the moment they are a benefit,
so its the names that I'm asking about not the definitions.

Best wishes

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


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Thomas Schilling
Yup, I have to agree.  The Ruby web site certainly is the best web
site for a programming language that I've come across, but it's
certainly not amazing.  I like the python documentation design, but
their home page is a bit dull.  Anyway, here's another variation, this
time with more colour:

http://i.imgur.com/Lj3xM.png

The image is about 80k (while the website alone is  10k) so I hope
there won't be any bandwidth issues.  Regarding the particular
contents:

  (a) I won't post another version for every tiny wibble.  You know,
you can actually post text via email (yes, really!) so if anyone has
improvements for how the sections should look like, post the suggested
alternative contents on this list.

  (b) A little redundancy is no problem at all.  I try to follow the
inverted pyramid model: put all the important information at the top,
and add more details below.  If that leads to a small amount of
duplication so be it.

  (c) As mentioned before, we don't want a perfect home page, we
simply want a better one.  Incremental improvements can be made later
on.

  (d) Who actually *can* update the homepage?  Ian, Ross, Malcolm, Simon M?

  (e) I don't have an iPhone, *Droid, or iPad, so I'd need some help
testing on any of those.

  (f) The design is not fixed width, and most sizes are specified in
terms of font size or percentages.  I merely added a max-width
restriction so that it still looks decent on maximised screens.  I
tried to remove it, but that just doesn't look good anymore.

On 7 April 2010 14:19, Daniel Fischer daniel.is.fisc...@web.de wrote:
 Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite:
 While I think that (d) is a valid concern, it is also important not to
 let the perfect be the enemy of the good.  If we agree that the proposed
 web site layout is sufficiently better than the current one and is good
 enough aesthetically, then I think we should go ahead and switch to the
 new layout and *then* start thinking about how we could make it

 Good plan.

 *completely amazing* like the Ruby web site,

 www.ruby-lang.org ?

 Sure, that looks pretty good, but completely amazing?

 because if we demand
 completely amazing for our *first* try then I fear that all that will
 happen is that nothing will change because the bar will have been set
 too high.

 Cheers,
 Greg

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




-- 
Push the envelope.  Watch it bend.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Daniel Fischer
Am Mittwoch 07 April 2010 18:53:28 schrieb Thomas Schilling:
 Yup, I have to agree.  The Ruby web site certainly is the best web
 site for a programming language that I've come across, but it's
 certainly not amazing.  I like the python documentation design, but
 their home page is a bit dull.

Agreed. But I prefer dull over too flashy, so don't exaggerate.

 Anyway, here's another variation, this time with more colour:

 http://i.imgur.com/Lj3xM.png

Not bad, but the black background for the Haskell is an advanced ... 
blurb is ugly. Having the text directly on the background image would be 
better, I think.


   (b) A little redundancy is no problem at all.  I try to follow the
 inverted pyramid model: put all the important information at the top,
 and add more details below.  If that leads to a small amount of
 duplication so be it.

+1 A little redundancy can be a great help sometimes, just keep an eye on 
the amount of duplication.


   (c) As mentioned before, we don't want a perfect home page, we
 simply want a better one.  Incremental improvements can be made later
 on.


Again: Aye, very much so.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Gregory Crosswhite
Ooo, I really like this revision;  it is a major improvement in your design!  I 
particularly like the picture you chose for the top, and the new way that you 
have laid out all of the boxes and made the bottom right box a different shade 
so that it is easier to distinguish it as a different column.  Also, I concur 
with your use of the inverted pyramid model, even if it comes at the expense 
of a little redundancy.

My only quibble is that I don't like the fact that the summary text at the top 
has a font background color, so that there are in essence several boxes around 
the text of different sizes and with space in between the lines.  I recognize 
that the purpose of the font background was to help the text contrast with the 
picture behind it, but it would be nicer if there were a better solution, such 
as by putting a box around all of the text and then filling that with color (so 
there aren't boxes of different sizes containing the text and empty spaces 
between the lines), or by putting a translucent box around the text so that we 
can still see the background but it's faded a bit so that the text still shows 
up.

Cheers,
Greg

On Apr 7, 2010, at 9:53 AM, Thomas Schilling wrote:

 Yup, I have to agree.  The Ruby web site certainly is the best web
 site for a programming language that I've come across, but it's
 certainly not amazing.  I like the python documentation design, but
 their home page is a bit dull.  Anyway, here's another variation, this
 time with more colour:
 
 http://i.imgur.com/Lj3xM.png
 
 The image is about 80k (while the website alone is  10k) so I hope
 there won't be any bandwidth issues.  Regarding the particular
 contents:
 
  (a) I won't post another version for every tiny wibble.  You know,
 you can actually post text via email (yes, really!) so if anyone has
 improvements for how the sections should look like, post the suggested
 alternative contents on this list.
 
  (b) A little redundancy is no problem at all.  I try to follow the
 inverted pyramid model: put all the important information at the top,
 and add more details below.  If that leads to a small amount of
 duplication so be it.
 
  (c) As mentioned before, we don't want a perfect home page, we
 simply want a better one.  Incremental improvements can be made later
 on.
 
  (d) Who actually *can* update the homepage?  Ian, Ross, Malcolm, Simon M?
 
  (e) I don't have an iPhone, *Droid, or iPad, so I'd need some help
 testing on any of those.
 
  (f) The design is not fixed width, and most sizes are specified in
 terms of font size or percentages.  I merely added a max-width
 restriction so that it still looks decent on maximised screens.  I
 tried to remove it, but that just doesn't look good anymore.
 
 On 7 April 2010 14:19, Daniel Fischer daniel.is.fisc...@web.de wrote:
 Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite:
 While I think that (d) is a valid concern, it is also important not to
 let the perfect be the enemy of the good.  If we agree that the proposed
 web site layout is sufficiently better than the current one and is good
 enough aesthetically, then I think we should go ahead and switch to the
 new layout and *then* start thinking about how we could make it
 
 Good plan.
 
 *completely amazing* like the Ruby web site,
 
 www.ruby-lang.org ?
 
 Sure, that looks pretty good, but completely amazing?
 
 because if we demand
 completely amazing for our *first* try then I fear that all that will
 happen is that nothing will change because the bar will have been set
 too high.
 
 Cheers,
 Greg
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
 -- 
 Push the envelope.  Watch it bend.
 ___
 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] Re: Metaprogramming in Haskell vs. Ocaml

2010-04-07 Thread Heinrich Apfelmus
Nicolas Pouillard wrote:
 Heinrich Apfelmus wrote:
 I'm curious, can metaocaml create new data type definitions, value
 declarations or type class instances?

 No metaocaml cannot do this. It is restricted to the expression
 level, and not the declaration level. Moreover you cannot pattern
 match over the generated code.

 Jacques Carette wrote:
 One thing I should have mentionned - TH and camlp4 are really 
 equivalents.  And camlp4 is as-typed-as TH (or not, depending on your 
 point of view).
 
 This is not exactly the same, TH is a bit more typed than camlp4 here is two
 examples:

Thanks for your clarifications, Jacques and Nicolas. :)

Incidentally, the distinction between camlp4 and metaocaml makes me
wonder whether it might be possible to implement the former *inside* the
latter. In other words, maybe there exists a domain specific language
inside camlp4 / TH that offers all the conveniences of metaocaml.

Of course, this doesn't work right away because camlp4 / TH are
compile-time only, but why not extend them slightly so that they can be
used during run-time, too?


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

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


[Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Simon Michael

On 4/7/10 9:53 AM, Thomas Schilling wrote:

Yup, I have to agree.  The Ruby web site certainly is the best web
site for a programming language that I've come across, but it's
certainly not amazing.  I like the python documentation design, but
their home page is a bit dull.  Anyway, here's another variation, this
time with more colour:

http://i.imgur.com/Lj3xM.png


This is not as simple as your first which I responded to, but it's rather nice!

Quibbles, I would try to:

- make the brown image full width, like the page header - re-establish the 
clear top and bottom division

- lose or deemphasize as much as possible the blue background of the blurb text - I know why it's there but it's way 
ugly at present


- lose the italics in the blurb text, or make it all italic

- bring back the serif font ?

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


[Haskell-cafe] lhaskell.vim: syntax highlighting fix for pragmas and comments in TeX mode

2010-04-07 Thread Tomas Janousek
Hello cafe :-),

you're the maintainer of lhaskell.vim and I'm sending you a patch that fixes
the highlighting of curly brackets and anything between them.

(Who's supposed to send it to vim maintainer? Me, or cafe?)

Regards,
-- 
Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/
--- /usr/share/vim/vim72/syntax/lhaskell.vim	2010-01-14 06:40:28.0 +0100
+++ lhaskell.vim	2010-04-07 19:23:39.0 +0200
@@ -107,13 +107,12 @@
 endif
 
 syntax region lhsHaskellBirdTrack start=^ end=\%(^[^]\)\...@= contai...@haskelltop,lhsBirdTrack contained...@lhstexcontainer
-syntax region lhsHaskellBeginEndBlock start=^\\begin{code}\s*$ matchgroup=NONE end=\%(^\\end{code}.*$\)\...@= contai...@haskelltop,@beginCode contained...@lhstexcontainer
+syntax region lhsHaskellBeginEndBlock start=^\\begin{code}\s*$ matchgroup=NONE end=\%(^\\end{code}.*$\)\...@= contai...@haskelltop,beginCodeBegin contained...@lhstexcontainer
 
 syntax match lhsBirdTrack ^ contained
 
 syntax match beginCodeBegin ^\\begin nextgroup=beginCodeCode contained
 syntax region beginCodeCode  matchgroup=texDelimiter start={ end=}
-syntax cluster beginCodecontains=beginCodeBegin,beginCodeCode
 
  Define the default highlighting.
  For version 5.7 and earlier: only when not done already
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-07 Thread Yves Parès

I'm wondering, would it be a problem of chunk size when using L.hGetContents?
Since the data to read is shorter than the default chunk size (32k), would
it cause problems?


Yves Parès wrote:
 
 Okay, so I turned off every buffering using hSetBuffering hdl NoBuffering
 on both Client and Server, but that doesn't fix it...
 BTW, I tried to do the same without your package, i.e. simply through Lazy
 ByteString and Binary, but it doesn't work either, I come up against the
 same issue.
 
 
 Gregory Crosswhite-2 wrote:
 
 Hmm, I am guessing it is more likely that the problem is that the I/O
 system changed from 6.10.4 to 6.12.1 somehow in a way that broke the
 package.  You could try turning off all buffering in the handle using
 hSetBuffering and seeing if that works.
 
 Cheers,
 Greg
 
 On Apr 6, 2010, at 3:44 PM, Yves Parès wrote:
 
 
 Weird...
 
 I use GHC 6.12.1, and I run Ubuntu 9.10 (32bits version).
 
 Would have I miss something? Like a flush or a close? Logically, I don't
 see
 where I would...
 
 
 Gregory Crosswhite-2 wrote:
 
 Yay, I'm glad to see someone else using my package.  :-)
 
 Hmm, your program seems to work for me.  I compiled and ran the Server
 (with ghc --make), then compiled and ran the Client, and then typed
 
Operation 1.0 Mult 2.0
 
 into the Client process, and the result it got was
 
2.0
 
 with the output
 
Just 2.0
 
 on the Server.
 
 I got the same results running this on Mac OSX and (Gentoo) Linux, with
 GHC 10.4.  What platform/GHC version are you running it on?
 
 Cheers,
 Greg
 
 On Apr 6, 2010, at 2:38 PM, Yves Parès wrote:
 
 
 Hello,
 
 I'm trying to use the packages Network and
 Control.Monad.BinaryProtocol
 together, with a very simple program in which a client sends an
 operation
 to
 the server, which computes the result and sends it back.
 
 But the server holds when trying to receive (Server.hs, line 22),
 whereas
 the client has actually sent the data (Client.hs, line 17).
 The server stops to hold only when the client is killed with a Ctrl-C.
 
 This should be rather simple, and I can't get to know why it doesn't
 work.
 
 The files are here:
 http://old.nabble.com/file/p28157883/Client.hs Client.hs 
 http://old.nabble.com/file/p28157883/Server.hs Server.hs 
 http://old.nabble.com/file/p28157883/SharedData.hs SharedData.hs 
 
 -
 Yves Parès
 
 Live long and prosper
 -- 
 View this message in context:
 http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883p28157883.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
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
 -
 Yves Parès
 
 Live long and prosper
 -- 
 View this message in context:
 http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883p28158514.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
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 


-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883p28168542.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


[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Isaac Dupree

On 04/07/10 11:12, Simon Marlow wrote:

It's possible to mis-use the API, e.g.

getUnmask = mask return


...incidentally,
unmask a = mask (\restore - return restore) = (\restore - restore a)


mask :: ((IO a - IO a) - IO b) - IO b


It needs to be :: ((forall a. IO a - IO a) - IO b) - IO b
so that you can use 'restore' on two different pieces of IO if you need 
to. (alas, this requires not just Rank2Types but RankNTypes. Also, it 
doesn't cure the loophole. But I think it's still essential.)



nonInterruptibleMask :: ((IO a - IO a) - IO b) - IO b
nonInterruptibleMask_ :: IO a - IO a

which is just like mask/mask_, except that blocking operations (e.g.
takeMVar) are not interruptible.


What would be an appropriate use of this?

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


Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-07 Thread Daniel Fischer
Am Mittwoch 07 April 2010 19:50:43 schrieb Yves Parès:
 I'm wondering, would it be a problem of chunk size when using
 L.hGetContents? Since the data to read is shorter than the default chunk
 size (32k), would it cause problems?

That shouldn't cause problems. When less than the default chunk size is 
available, it makes a chunk of what it got and tries to get more later 
(unless it found EOF, then it closes the handle).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Thomas Schilling
http://i.imgur.com/kFqP3.png   Didn't know about CSS's rgba to
describe transparency.  Very useful.

On 7 April 2010 18:19, Gregory Crosswhite gcr...@phys.washington.edu wrote:
 Ooo, I really like this revision;  it is a major improvement in your design!  
 I particularly like the picture you chose for the top, and the new way that 
 you have laid out all of the boxes and made the bottom right box a different 
 shade so that it is easier to distinguish it as a different column.  Also, I 
 concur with your use of the inverted pyramid model, even if it comes at the 
 expense of a little redundancy.

 My only quibble is that I don't like the fact that the summary text at the 
 top has a font background color, so that there are in essence several boxes 
 around the text of different sizes and with space in between the lines.  I 
 recognize that the purpose of the font background was to help the text 
 contrast with the picture behind it, but it would be nicer if there were a 
 better solution, such as by putting a box around all of the text and then 
 filling that with color (so there aren't boxes of different sizes containing 
 the text and empty spaces between the lines), or by putting a translucent box 
 around the text so that we can still see the background but it's faded a bit 
 so that the text still shows up.

 Cheers,
 Greg

 On Apr 7, 2010, at 9:53 AM, Thomas Schilling wrote:

 Yup, I have to agree.  The Ruby web site certainly is the best web
 site for a programming language that I've come across, but it's
 certainly not amazing.  I like the python documentation design, but
 their home page is a bit dull.  Anyway, here's another variation, this
 time with more colour:

 http://i.imgur.com/Lj3xM.png

 The image is about 80k (while the website alone is  10k) so I hope
 there won't be any bandwidth issues.  Regarding the particular
 contents:

  (a) I won't post another version for every tiny wibble.  You know,
 you can actually post text via email (yes, really!) so if anyone has
 improvements for how the sections should look like, post the suggested
 alternative contents on this list.

  (b) A little redundancy is no problem at all.  I try to follow the
 inverted pyramid model: put all the important information at the top,
 and add more details below.  If that leads to a small amount of
 duplication so be it.

  (c) As mentioned before, we don't want a perfect home page, we
 simply want a better one.  Incremental improvements can be made later
 on.

  (d) Who actually *can* update the homepage?  Ian, Ross, Malcolm, Simon M?

  (e) I don't have an iPhone, *Droid, or iPad, so I'd need some help
 testing on any of those.

  (f) The design is not fixed width, and most sizes are specified in
 terms of font size or percentages.  I merely added a max-width
 restriction so that it still looks decent on maximised screens.  I
 tried to remove it, but that just doesn't look good anymore.

 On 7 April 2010 14:19, Daniel Fischer daniel.is.fisc...@web.de wrote:
 Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite:
 While I think that (d) is a valid concern, it is also important not to
 let the perfect be the enemy of the good.  If we agree that the proposed
 web site layout is sufficiently better than the current one and is good
 enough aesthetically, then I think we should go ahead and switch to the
 new layout and *then* start thinking about how we could make it

 Good plan.

 *completely amazing* like the Ruby web site,

 www.ruby-lang.org ?

 Sure, that looks pretty good, but completely amazing?

 because if we demand
 completely amazing for our *first* try then I fear that all that will
 happen is that nothing will change because the bar will have been set
 too high.

 Cheers,
 Greg

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




 --
 Push the envelope.  Watch it bend.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe





-- 
Push the envelope.  Watch it bend.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread John Van Enk
Hot.

On Wed, Apr 7, 2010 at 2:35 PM, Thomas Schilling nomin...@googlemail.comwrote:

 http://i.imgur.com/kFqP3.png   Didn't know about CSS's rgba to
 describe transparency.  Very useful.

 On 7 April 2010 18:19, Gregory Crosswhite gcr...@phys.washington.edu
 wrote:
  Ooo, I really like this revision;  it is a major improvement in your
 design!  I particularly like the picture you chose for the top, and the new
 way that you have laid out all of the boxes and made the bottom right box a
 different shade so that it is easier to distinguish it as a different
 column.  Also, I concur with your use of the inverted pyramid model, even
 if it comes at the expense of a little redundancy.
 
  My only quibble is that I don't like the fact that the summary text at
 the top has a font background color, so that there are in essence several
 boxes around the text of different sizes and with space in between the
 lines.  I recognize that the purpose of the font background was to help the
 text contrast with the picture behind it, but it would be nicer if there
 were a better solution, such as by putting a box around all of the text and
 then filling that with color (so there aren't boxes of different sizes
 containing the text and empty spaces between the lines), or by putting a
 translucent box around the text so that we can still see the background but
 it's faded a bit so that the text still shows up.
 
  Cheers,
  Greg
 
  On Apr 7, 2010, at 9:53 AM, Thomas Schilling wrote:
 
  Yup, I have to agree.  The Ruby web site certainly is the best web
  site for a programming language that I've come across, but it's
  certainly not amazing.  I like the python documentation design, but
  their home page is a bit dull.  Anyway, here's another variation, this
  time with more colour:
 
  http://i.imgur.com/Lj3xM.png
 
  The image is about 80k (while the website alone is  10k) so I hope
  there won't be any bandwidth issues.  Regarding the particular
  contents:
 
   (a) I won't post another version for every tiny wibble.  You know,
  you can actually post text via email (yes, really!) so if anyone has
  improvements for how the sections should look like, post the suggested
  alternative contents on this list.
 
   (b) A little redundancy is no problem at all.  I try to follow the
  inverted pyramid model: put all the important information at the top,
  and add more details below.  If that leads to a small amount of
  duplication so be it.
 
   (c) As mentioned before, we don't want a perfect home page, we
  simply want a better one.  Incremental improvements can be made later
  on.
 
   (d) Who actually *can* update the homepage?  Ian, Ross, Malcolm, Simon
 M?
 
   (e) I don't have an iPhone, *Droid, or iPad, so I'd need some help
  testing on any of those.
 
   (f) The design is not fixed width, and most sizes are specified in
  terms of font size or percentages.  I merely added a max-width
  restriction so that it still looks decent on maximised screens.  I
  tried to remove it, but that just doesn't look good anymore.
 
  On 7 April 2010 14:19, Daniel Fischer daniel.is.fisc...@web.de wrote:
  Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite:
  While I think that (d) is a valid concern, it is also important not to
  let the perfect be the enemy of the good.  If we agree that the
 proposed
  web site layout is sufficiently better than the current one and is
 good
  enough aesthetically, then I think we should go ahead and switch to
 the
  new layout and *then* start thinking about how we could make it
 
  Good plan.
 
  *completely amazing* like the Ruby web site,
 
  www.ruby-lang.org ?
 
  Sure, that looks pretty good, but completely amazing?
 
  because if we demand
  completely amazing for our *first* try then I fear that all that will
  happen is that nothing will change because the bar will have been set
  too high.
 
  Cheers,
  Greg
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
  --
  Push the envelope.  Watch it bend.
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 



 --
 Push the envelope.  Watch it bend.
 ___
 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] Simple binary-protocol through network test

2010-04-07 Thread Yves Parès

Yes, from what I read, I assumed it had this behavior.
But, then, I don't see why the server holds...
I've posted a mail on Haskell-Cafe called Network: buffering troubles, in
which I put a smaller example which reproduces this problem.


Daniel Fischer-4 wrote:
 That shouldn't cause problems. When less than the default chunk size is 
 available, it makes a chunk of what it got and tries to get more later 
 (unless it found EOF, then it closes the handle).


-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883p28169295.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] Re: GSoC: Improving Cabal's Test Support

2010-04-07 Thread Duncan Coutts
On Tue, 2010-04-06 at 18:51 -0400, Thomas Tuegel wrote:
 Hello again!
 
 Based on the invaluable feedback I've received, I've made some
 revisions to the proposal I made a few days ago (at the end of this
 post, after my signature).  I apologize for the length of my post, but
 I'd like once again to solicit feedback on this.  Any commentary is
 very helpful!

Hia Thomas.

 Package Description File Syntax
 
 The syntax for designating test executables in package description
 files will be based on the existing syntax for describing executables.
  Such a stanza in the hypothetical package's description file would
 look like:
 
  Test foo-tests
  main-is: foo-tests.hs
  build-depends: haskell-foo, Cabal, QuickCheck

One feature that I consider to be vital (and as Cabal maintainer I get
to say that kind of thing! ;-) ) is that the stanza must specify the
testing interface that it supports.

The importance of this is that it lets us develop improved testsuite
interfaces in future. At the moment there are two test interfaces we
want to support. One is the simple unix style exit code + stdout
interface. This is good because it is a lowest common denominator that
all existing testsuites can fit into.

Of course that test interface does not provide any detailed
machine-readable information (though you do get human-readable test
logs). So that's why we want a second interface. That one should let the
testing agent (for example cabal test but could be other agents) get
much more detail about what tests can be run and then what the results
are of various tests.

The details of such an interface are up for discussion. I do not mind if
that is a command line executable interface or a library interface.

 Handling of Test Executables by Cabal
 
 The changes proposed here will make it possible to build, test, and
 install a Cabal package with the usual sequence of commands:

That all sounds reasonable. I'd like to add that the interface between
the testsuite and a testing agent such as the cabal program should be
clearly documented and specified. There will likely be dedicated test
agents that want to run the tests too and send reports to other systems
(e.g. dedicated hackage test agents) and convert to other formats (e.g.
integration in companies in-house systems).

A cabal test user interface is obviously great for developers.

Gregory makes a goof suggestion about using or adapting the existing
test-framework package. That was also something I was thinking about. It
would be good to work with the maintainer of the test-framework package
so that it can be used to implement the interface that Cabal specifies.

Duncan

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


Re: [Haskell-cafe] libraries [was GUI haters]

2010-04-07 Thread Duncan Coutts
On Fri, 2010-04-02 at 09:39 -0700, gladst...@gladstein.com wrote:
 As a working engineer, one of my greatest frustrations is my inability
 to use Haskell in the workplace. The unfortunate fact is that my media
 industry clients use mostly Windows, some Macs, and no linux except for
 servers. The core system works everywhere, but many contributed
 libraries don't. GUIs are the big showstopper.

It's really not that bad. I have customers using Haskell GUI
applications on Windows (Gtk2Hs). We hardly had any problems at all.

-- 
Duncan Coutts, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/

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


Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-07 Thread Daniel Fischer
Am Mittwoch 07 April 2010 20:43:24 schrieb Yves Parès:
 Yes, from what I read, I assumed it had this behavior.
 But, then, I don't see why the server holds...
 I've posted a mail on Haskell-Cafe called Network: buffering troubles,
 in which I put a smaller example which reproduces this problem.

I know :)

I have now tested it, with both (simple) servers and I can't reproduce the 
problem (ghc-6.12.1 and ghc-6.10.3).

0) compile everything with -O2 (I always do, but for testing purposes I've 
also compiled the servers without optimisations for the lazy ByteStrings)

1) start server

2) start client

3) server prints
Chunk \NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX Empty
(\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX for [Char]-IO)
resp.
(3,4,5)
and exits

4) press return to shut down client

Only with strict ByteStrings does the server wait until I shut down the 
client before printing \NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX and exiting, but 
that is to be expected, isn't it?


 Daniel Fischer-4 wrote:
  That shouldn't cause problems. When less than the default chunk size
  is available, it makes a chunk of what it got and tries to get more
  later (unless it found EOF, then it closes the handle).

 -
 Yves Parès

 Live long and prosper

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


[Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-07 Thread Simon Michael

On 4/7/10 12:33 PM, Duncan Coutts wrote:

The importance of this is that it lets us develop improved testsuite
interfaces in future. At the moment there are two test interfaces we
want to support. One is the simple unix style exit code + stdout
interface. This is good because it is a lowest common denominator that
all existing testsuites can fit into.


I don't know how, but maybe http://hackage.haskell.org/package/shelltestrunner 
can help in this niche ?

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


[Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Johannes Waldmann
Ivan Miljenovic ivan.miljenovic at gmail.com writes:

 I hate websites/blogs/etc. that only take up a fraction of the
 screen width 

+1

Although this battle seems lost.

Web 2.0 is actually a synonym for useless whitespace right and left. 

J.W.


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


Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-07 Thread Thomas Tuegel
On Wed, Apr 7, 2010 at 3:33 PM, Duncan Coutts
duncan.cou...@googlemail.com wrote:
 The importance of this is that it lets us develop improved testsuite
 interfaces in future. At the moment there are two test interfaces we
 want to support. One is the simple unix style exit code + stdout
 interface. This is good because it is a lowest common denominator that
 all existing testsuites can fit into.

 Of course that test interface does not provide any detailed
 machine-readable information (though you do get human-readable test
 logs). So that's why we want a second interface. That one should let the
 testing agent (for example cabal test but could be other agents) get
 much more detail about what tests can be run and then what the results
 are of various tests.

For the purpose of differentiating between these two, would a field in
the test section such as interface: stdout (in the first case) or
interface: detailed (in the second) suffice?

 The details of such an interface are up for discussion. I do not mind if
 that is a command line executable interface or a library interface.

That's something I've been thinking about.  The former seems more
portable.  Maybe cabal could call the test program with test_program
--list to produce a list of tests and test_program
test1,test2,test3 to run some tests.

I also want to ask how strictly this is within the scope of the SoC
project, i.e. how well will my proposal be received if it focuses
primarily on the first part of the problem (getting everything working
for the stdout interface)?  I ask because the detailed interface seems
like a much larger mandate given that cabal doesn't really support any
of the syntax/features for the simple stdout interface.

     Handling of Test Executables by Cabal

 The changes proposed here will make it possible to build, test, and
 install a Cabal package with the usual sequence of commands:

 That all sounds reasonable. I'd like to add that the interface between
 the testsuite and a testing agent such as the cabal program should be
 clearly documented and specified. There will likely be dedicated test
 agents that want to run the tests too and send reports to other systems
 (e.g. dedicated hackage test agents) and convert to other formats (e.g.
 integration in companies in-house systems).

Rogan mentioned possible upcoming support in test-framework for JUnit
XML as an output format for test results.  That certainly seems to be
widely supported; do you think it is suitable?

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


Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-07 Thread Daniel Fischer
Am Mittwoch 07 April 2010 21:53:20 schrieb Daniel Fischer:
 Am Mittwoch 07 April 2010 20:43:24 schrieb Yves Parès:
  Yes, from what I read, I assumed it had this behavior.
  But, then, I don't see why the server holds...
  I've posted a mail on Haskell-Cafe called Network: buffering
  troubles, in which I put a smaller example which reproduces this
  problem.

 I know :)

 I have now tested it, with both (simple) servers and I can't reproduce
 the problem (ghc-6.12.1 and ghc-6.10.3).

Installed binary-protocol and tried the original (no hSetBuffering), that 
also works flawlessly (ghc-6.12.1 on openSuSE 11.1).

Server:
$ ../BeginnersTesting/Server
I wait for a client...
Result: Just 1.6190478
I wait for a client...
Result: Just 12.0
I wait for a client...
Result: Nothing
^C

Client:
$ ./Client localhost
Operation?
Operation 3.4 Div 2.1
Operation sent.
1.6190478
Operation?
Operation 17 Minus 5
Operation sent.
12.0
Operation?
Stop
Operation sent.


Seems to be something with Ubuntu.
Maybe somebody else on Ubuntu could test it?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Malcolm Wallace

   The platform installer is supposed to erase previous platform
   editions before it installs itself.


I would consider that a serious bug.

The Haskell Platform is not like a standard user application, where it  
would be reasonable to have only one version installed at a time.  If  
you are a software developer, it is frequently essential to have  
several different versions of the development environment (compiler +  
libraries) installed simultaneously, so that you can adequately  
support users who have different versions of your own software.


Regards,
Malcolm

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


[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Bas van Dijk
On Wed, Apr 7, 2010 at 5:12 PM, Simon Marlow marlo...@gmail.com wrote:
 Comments?

I really like this design.

One question, are you planning to write the MVar utility functions
using 'mask' or using 'nonInterruptibleMask'? As in:

 withMVar :: MVar a - (a - IO b) - IO b
 withMVar m f = whichMask? $ \restore - do
   a - takeMVar m
   b - restore (f a) `onException` putMVar m a
   putMVar m a
   return b

regards,

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


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Gregory Crosswhite
Nicely done!

On Apr 7, 2010, at 11:35 AM, Thomas Schilling wrote:

 http://i.imgur.com/kFqP3.png   Didn't know about CSS's rgba to
 describe transparency.  Very useful.
 
 On 7 April 2010 18:19, Gregory Crosswhite gcr...@phys.washington.edu wrote:
 Ooo, I really like this revision;  it is a major improvement in your design! 
  I particularly like the picture you chose for the top, and the new way that 
 you have laid out all of the boxes and made the bottom right box a different 
 shade so that it is easier to distinguish it as a different column.  Also, I 
 concur with your use of the inverted pyramid model, even if it comes at 
 the expense of a little redundancy.
 
 My only quibble is that I don't like the fact that the summary text at the 
 top has a font background color, so that there are in essence several boxes 
 around the text of different sizes and with space in between the lines.  I 
 recognize that the purpose of the font background was to help the text 
 contrast with the picture behind it, but it would be nicer if there were a 
 better solution, such as by putting a box around all of the text and then 
 filling that with color (so there aren't boxes of different sizes containing 
 the text and empty spaces between the lines), or by putting a translucent 
 box around the text so that we can still see the background but it's faded a 
 bit so that the text still shows up.
 
 Cheers,
 Greg
 
 On Apr 7, 2010, at 9:53 AM, Thomas Schilling wrote:
 
 Yup, I have to agree.  The Ruby web site certainly is the best web
 site for a programming language that I've come across, but it's
 certainly not amazing.  I like the python documentation design, but
 their home page is a bit dull.  Anyway, here's another variation, this
 time with more colour:
 
 http://i.imgur.com/Lj3xM.png
 
 The image is about 80k (while the website alone is  10k) so I hope
 there won't be any bandwidth issues.  Regarding the particular
 contents:
 
  (a) I won't post another version for every tiny wibble.  You know,
 you can actually post text via email (yes, really!) so if anyone has
 improvements for how the sections should look like, post the suggested
 alternative contents on this list.
 
  (b) A little redundancy is no problem at all.  I try to follow the
 inverted pyramid model: put all the important information at the top,
 and add more details below.  If that leads to a small amount of
 duplication so be it.
 
  (c) As mentioned before, we don't want a perfect home page, we
 simply want a better one.  Incremental improvements can be made later
 on.
 
  (d) Who actually *can* update the homepage?  Ian, Ross, Malcolm, Simon M?
 
  (e) I don't have an iPhone, *Droid, or iPad, so I'd need some help
 testing on any of those.
 
  (f) The design is not fixed width, and most sizes are specified in
 terms of font size or percentages.  I merely added a max-width
 restriction so that it still looks decent on maximised screens.  I
 tried to remove it, but that just doesn't look good anymore.
 
 On 7 April 2010 14:19, Daniel Fischer daniel.is.fisc...@web.de wrote:
 Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite:
 While I think that (d) is a valid concern, it is also important not to
 let the perfect be the enemy of the good.  If we agree that the proposed
 web site layout is sufficiently better than the current one and is good
 enough aesthetically, then I think we should go ahead and switch to the
 new layout and *then* start thinking about how we could make it
 
 Good plan.
 
 *completely amazing* like the Ruby web site,
 
 www.ruby-lang.org ?
 
 Sure, that looks pretty good, but completely amazing?
 
 because if we demand
 completely amazing for our *first* try then I fear that all that will
 happen is that nothing will change because the bar will have been set
 too high.
 
 Cheers,
 Greg
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
 --
 Push the envelope.  Watch it bend.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
 
 -- 
 Push the envelope.  Watch it bend.

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


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Gregory Collins
Malcolm Wallace malcolm.wall...@cs.york.ac.uk writes:

The platform installer is supposed to erase previous platform
editions before it installs itself.

 I would consider that a serious bug.

Lacking a feature I would consider essential /= a bug in my opinion,
especially when the desirability of the feature is in question. I have
enough legitimate bugs to deal with as it stands.


 The Haskell Platform is not like a standard user application, where it
 would be reasonable to have only one version installed at a time.  If
 you are a software developer, it is frequently essential to have
 several different versions of the development environment (compiler +
 libraries) installed simultaneously, so that you can adequately
 support users who have different versions of your own software.

We'll have to disagree here; I'd consider this a power user feature.
After all, the platform libs can be acquired by other means than the
turnkey binary installer. The OSX package system is so insane that I can
barely get the thing working to begin with, even after making a bunch of
simplifying assumptions (like we don't need to support multiple
platform installations).

That said, I'm not at all opposed to having this feature, if you can
explain to me (or even better, provide code for) a reasonable scheme for
doing it that isn't going to make this project even more brittle than it
already is.

G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Ivan Lazar Miljenovic
Thomas Schilling nomin...@googlemail.com writes:

 http://i.imgur.com/kFqP3.png   Didn't know about CSS's rgba to
 describe transparency.  Very useful.

It's a vely nice!! (in a Borat voice)

  (e) I don't have an iPhone, *Droid, or iPad, so I'd need some help
 testing on any of those.

I have a Symbian phone, so I can probably help you out there.

-- 
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] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Ivan Lazar Miljenovic
Malcolm Wallace malcolm.wall...@cs.york.ac.uk writes:
 The Haskell Platform is not like a standard user application, where it
 would be reasonable to have only one version installed at a time.

As far as I know, most Linux distributions only let you install one
version of GHC at a time; we do this with Gentoo because despite there
being some distribution-specific architecture in place to be able to
switch between compilers (used for GCC, Ruby, Python, etc.) we haven't
resolved how to deal with dependency problems when a library was built
with one version of GHC and then you try to build something that depends
upon it with another version of GHC (since the package manager _knows_
that the dependency is installed, yet GHC is vehement that it knows
nothing about it).

-- 
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] lhaskell.vim: syntax highlighting fix for pragmas and comments in TeX mode

2010-04-07 Thread Ivan Lazar Miljenovic
Tomas Janousek t...@nomi.cz writes:
 (Who's supposed to send it to vim maintainer? Me, or cafe?)

You.  It's your patch/fix, and it's a bit difficult to ascertain which
part of the amorphous mass that is haskell-cafe is meant to be doing
your bidding for you ;-)

-- 
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] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Simon Marlow

On 07/04/10 21:23, Bas van Dijk wrote:

On Wed, Apr 7, 2010 at 5:12 PM, Simon Marlowmarlo...@gmail.com  wrote:

Comments?


I really like this design.

One question, are you planning to write the MVar utility functions
using 'mask' or using 'nonInterruptibleMask'? As in:


withMVar :: MVar a -  (a -  IO b) -  IO b
withMVar m f = whichMask? $ \restore -  do
   a- takeMVar m
   b- restore (f a) `onException` putMVar m a
   putMVar m a
   return b


Definitely the ordinary interruptible mask.  It is the intention that 
the new nonInterruptibleMask is only used in exceptional circumstances 
where dealing with asynchronous exceptions emerging from blocking 
operations would be impossible to deal with.  The more unwieldy name was 
chosen deliberately for this reason.


The danger with nonInterruptibleMask is that it is all too easy to write 
a program that will be unresponsive to Ctrl-C, for example.  It should 
be used with great care - for example when there is reason to believe 
that any blocking operations that would otherwise be interruptible will 
only block for short bounded periods.


In the case of withMVar, if the caller is concerned about the 
interruptibility then they can call it within nonInterruptibleMask, 
which overrides the interruptible mask in withMVar.


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


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Daniel Fischer
Am Mittwoch 07 April 2010 23:43:05 schrieb Ivan Lazar Miljenovic:
 Malcolm Wallace malcolm.wall...@cs.york.ac.uk writes:
  The Haskell Platform is not like a standard user application, where it
  would be reasonable to have only one version installed at a time.

 As far as I know, most Linux distributions only let you install one
 version of GHC at a time;

I currently have 6.10.1, 6.10.3 and 6.12.1 installed (openSuSe 11.1), no 
problem.
On my previous computer (SuSE 8.2), I had every release from 6.2.2 to 
6.8.2, no problem either.

 we do this with Gentoo because despite there
 being some distribution-specific architecture in place to be able to
 switch between compilers (used for GCC, Ruby, Python, etc.) we haven't
 resolved how to deal with dependency problems when a library was built
 with one version of GHC and then you try to build something that depends
 upon it with another version of GHC (since the package manager _knows_
 that the dependency is installed, yet GHC is vehement that it knows
 nothing about it).

Ah, but one shouldn't use a package manager for Haskell packages.
Cabal is far superior to all of them 8-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: JSONb-1.0.0

2010-04-07 Thread Jason Dusek
  A new release of JSONb, taking advantage of the latest Attoparsec.

http://hackage.haskell.org/package/JSONb-1.0.0

  Thanks to Grant Monroe for help with the numerics parser.

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


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Malcolm Wallace

  The platform installer is supposed to erase previous platform
  editions before it installs itself.


I would consider that a serious bug.


Lacking a feature I would consider essential /= a bug in my  
opinion,

especially when the desirability of the feature is in question.


It is not merely that a feature is lacking.  Removing software from my  
machine without my knowledge or permission is just wrong.  (I was  
bitten by this once before, with a ghc installer for Mac.  It removed  
the previous working ghc, without telling me.  Then I discovered that  
a library I needed could not be compiled by the new version of ghc.  
The old ghc installer then refused to delete the new ghc and revert to  
the old one, because it could not imagine why anyone would want to  
downgrade.)


Regards,
Malcolm

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


[Haskell-cafe] ANNOUNCE: Hac phi 2010

2010-04-07 Thread Chris Casinghino
Greetings,

I am very pleased to officially announce Hac phi 2010, a Haskell
hackathon/get-together to be held May 21-23 at the University of
Pennsylvania in Philadelphia.  The hackathon will officially kick off
at 2:30 Friday afternoon, and go until 5pm on Sunday (with breaks for
sleep, of course).  Last year's Hac phi was a lot of fun, and many
people have already expressed interest in coming back this year.  I
want to stress that everyone is welcome---you do not have to be a
Haskell guru to attend!  Helping hack on someone else's project could
be a great way to increase your Haskell-fu.

If you plan on coming, please officially register [1].  Registration,
travel, lodging and many other details can be found on the Hac phi
wiki [2].  Note that we're in a different space this year and may have
to cap attendance, so register early.

We're also looking for a few people interested in giving short (15-20
min.) talks, probably on Saturday afternoon.  Anything of interest to
the Haskell community is fair game---a project you've been working on,
a paper, a quick tutorial.  If you'd like to give a talk, add it on
the wiki [3].

Hope to see you in Philadelphia!

-The Hac φ team

[1] http://haskell.org/haskellwiki/Hac_φ/Register
[2] http://haskell.org/haskellwiki/Hac_φ
[3] http://haskell.org/haskellwiki/Hac_φ/Talks
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Weird behaviour with positional parameters in HDBC-mysql

2010-04-07 Thread Martijn van Steenbergen

Dear café (CC John and Chris),

I'm having some trouble with getting positional parameters in HDBC-mysql 
to work. Most of the time they work fine, but sometimes (and often 
enough that it's a serious bother) the parameters don't reach the server 
correctly.


Let me first describe my setup:
* Ubuntu 8.10 intrepid (inside VMWare Fusion on Mac OS X Snow Leopard)
* mysql  Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (i486) using 
readline 5.2

* ghc 6.10.3
* HDBC-2.2.4
* HDBC-mysql-0.6.1

I have a database with a single, empty table:


CREATE TABLE `foo` (
  `id` int(11) NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1031 DEFAULT CHARSET=latin1


And I have the following Haskell program:


import Database.HDBC
import Database.HDBC.MySQL
import Data.List
import Data.Traversable
import Control.Monad

main :: IO ()
main = do
  conn - connectMySQL defaultMySQLConnectInfo
{ mysqlUnixSocket = /var/run/mysqld/mysqld.sock
, mysqlUser = root
, mysqlDatabase = db
}
  for [1..1000] $ \n - do
let sql = select id from foo where id in (
  ++ intercalate , (replicate (fromInteger n) ?) ++ )
stmt - prepare conn sql
execute stmt (map SqlInteger [1..n])
finish stmt
  return ()


The program produces no output. All 1000 queries that are sent to the 
database are expected to return 0 results, since table foo is empty. 
This is all fine.


The problem is in the queries that the server receives. If I turn on 
full logging, I expect all queries to have a where id in (...) where 
there is an increasing list of integers within the parentheses. But when 
examining the logs, some are small negative numbers, NULLs or just other 
numbers:



506 Execute [980] select id from foo where id in
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,
27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,824,825,826,827,828,829,
830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,
848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,
866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,
884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,
902,903,904,905,906,907,908,0,0,34359738368,-5210566582833489576,NULL,
NULL,0,34359738368,-5210565758199768552,NULL,NULL,0,34359738368,
-5210564933566047528,NULL,NULL,0,34359738368,-5210564108932326504,NULL,
NULL,0,34359738368,-5210563284298605480,NULL,NULL,0,34359738368,
-5210562459664884456,NULL,NULL,158,159,160,161,162,(snip)


The server then faithfully executes the statement and returns the 
results expected for the query it reports to have received, which (in a 
table with actual data) is not what the Haskell program was expecting.


If I compile the program once, the results vary per run.
If I don't use positional parameters but instead render the full SQL 
query myself, there is no problem.


Is this a problem in HDBC or in HDBC-mysql?
What's going on here? How do I fix or work around this?

Many thanks,

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


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Ivan Lazar Miljenovic
Daniel Fischer daniel.is.fisc...@web.de writes:
 I currently have 6.10.1, 6.10.3 and 6.12.1 installed (openSuSe 11.1), no 
 problem.
 On my previous computer (SuSE 8.2), I had every release from 6.2.2 to 
 6.8.2, no problem either.

Using system packages?

 Ah, but one shouldn't use a package manager for Haskell packages.
 Cabal is far superior to all of them 8-)

Except for the fact that you can't uninstall, check for
non-Haskell-library dependencies, etc. ...

-- 
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] Re: lhaskell.vim: syntax highlighting fix for pragmas and comments in TeX mode

2010-04-07 Thread Tomáš Janoušek
Hello,

On Thu, Apr 08, 2010 at 07:45:43AM +1000, Ivan Lazar Miljenovic wrote:
 Tomas Janousek t...@nomi.cz writes:
  (Who's supposed to send it to vim maintainer? Me, or cafe?)
 
 You.  It's your patch/fix, and it's a bit difficult to ascertain which
 part of the amorphous mass that is haskell-cafe is meant to be doing
 your bidding for you ;-)

Okay, sent. Sorry for that silly question, somehow I thought that it's a role
of the file maintainer to review patches and forward them to the vim
maintainer. But yeah, it's obvious that cafe itself can't do that :-).

-- 
Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: JSONb-1.0.0

2010-04-07 Thread Ivan Lazar Miljenovic
Jason Dusek jason.du...@gmail.com writes:
   A new release of JSONb, taking advantage of the latest Attoparsec.

 http://hackage.haskell.org/package/JSONb-1.0.0

Is this meant to be a continuation of the json-b package?

-- 
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] Suitable structure to represents lots of similar lists

2010-04-07 Thread Dan Piponi
I have a situation where I have a bunch of lists and I'll frequently
be making new lists from the old ones by applying map and filter. The
map will be applying a function that's effectively the identity on
most elements of the list, and filter will be using a function that
usually gives True. This means that there is potential for a large
amount of sharing between these lists that could be exploited,
something that ordinary lists would do badly. Does anyone have a
recommendation for a pure functional data structure for this case?

(It reminds me a bit of my own antidiagonal type, but that's not well
adapted to the highly dynamic situation I'm describing.)
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Daniel Fischer
Am Donnerstag 08 April 2010 00:09:34 schrieb Ivan Lazar Miljenovic:
 Daniel Fischer daniel.is.fisc...@web.de writes:
  I currently have 6.10.1, 6.10.3 and 6.12.1 installed (openSuSe 11.1),
  no problem.
  On my previous computer (SuSE 8.2), I had every release from 6.2.2 to
  6.8.2, no problem either.

 Using system packages?

Of course not, I'm a source freak (except the 6.10.1, one has to get 
started somehow).


  Ah, but one shouldn't use a package manager for Haskell packages.
  Cabal is far superior to all of them 8-)

 Except for the fact that you can't uninstall,

Well, I can uninstall manually if I really want to, but disk space isn't 
that scarce yet.

 check for non-Haskell-library dependencies,

True, a distro package manager could do that.
However, so far I've found the ease of managing Haskell packages via cabal-
install worth much more than taking care of the occasional non-Haskell 
dependency.

 etc. ...

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


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Gregory Collins
Malcolm Wallace malcolm.wall...@cs.york.ac.uk writes:

   The platform installer is supposed to erase previous platform
   editions before it installs itself.

 I would consider that a serious bug.

 Lacking a feature I would consider essential /= a bug in my opinion,
 especially when the desirability of the feature is in question.

 It is not merely that a feature is lacking.  Removing software from my
 machine without my knowledge or permission is just wrong.  (I was
 bitten by this once before, with a ghc installer for Mac.  It removed
 the previous working ghc, without telling me.  Then I discovered that
 a library I needed could not be compiled by the new version of ghc.
 The old ghc installer then refused to delete the new ghc and revert to
 the old one, because it could not imagine why anyone would want to
 downgrade.)

I get where you're coming from, however: almost every binary installer
on every platform I've ever used performs a forcible package upgrade
unless the package maintainer takes special pains to do otherwise.

Like I said, I'm not opposed to doing something about this, if something
simple solves it without adding a significant complexity overhead. Is it
enough to do what GHC does? I.e. a
/Library/Frameworks/HaskellPlatform.framework/Versions directory with
appropriate symlinks, as well as a bundled, optional uninstaller script
which zaps everything?

G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Weird behaviour with positional parameters in HDBC-mysql

2010-04-07 Thread John Goerzen

Martijn van Steenbergen wrote:


Is this a problem in HDBC or in HDBC-mysql?


Smells to me like a bug in HDBC-mysql.  However, it is possible that the 
bug lies in the C MySQL library itself.


To help isolate, it would be good to try your program:

 * with HDBC-postgresql
 * with HDBC-sqlite3
 * with HDBC-ODBC and the MySQL driver

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


Re: [Haskell-cafe] Announce: hothasktags

2010-04-07 Thread Luke Palmer
On Wed, Apr 7, 2010 at 1:23 AM, Evan Laforge qdun...@gmail.com wrote:
 On Thu, Apr 1, 2010 at 1:46 PM, Luke Palmer lrpal...@gmail.com wrote:
 Hi,

 I'd like to draw attention to a little script I wrote.  I tend to use
 qualified imports and short names like new and filter.  This makes
 hasktags pretty much useless, since it basically just guesses which
 one to go to.  hothasktags is a reimplementation of hasktags that uses
 haskell-src-exts to analyze the import structure to generate (scoped)
 tags pointing to the right definition.  I'm pretty addicted to it,
 since it provides the only functionality I miss from visual studio
 :-).

 VIm only for now, since I don't know if emacs tags format supports
 scoped tags.  I am aware that it is not perfect -- patches and bug
 reports welcome.

 Hi, thanks for this, I've been wanting something like this for a long
 time!  I have a suggestion and a question though:

 If you prepend the tags file with !_TAG_FILE_SORTED\t1\t ~\n then I
 think vim should be able to do a binary search on the file.

Thanks!

 This program generates a tag for each reference to a symbol:

Almost.  It generates a tag for each file/symbol pair such that the
symbol is accessible from the file.


 Derive.PitchDeriver     Derive/Derive.hs        98;    file:Cmd/Cmd.hs
 Derive.PitchDeriver     Derive/Derive.hs        98;    file:Cmd/Play.hs
 Derive.PitchDeriver     Derive/Derive.hs        98;
 file:Cmd/ResponderSync.hs
 ... [ 20 more ] ...

 The vim tag documentation says these are static tags, and implies
 they are meant to apply to symbols only valid within the same file,
 but this is clearly not the case.  Actually, the vim doc implies that
 only file: is defined, and doesn't talk about scoped tags so I'm
 not sure what is going on.  Anyway, whenever I go to a tag I have to
 first step through a message that says 1 of 25 or so.  There's one
 for each reference in the tags file, even though those are references
 in other files.

Hmm odd, I don't get that behavior.  Is that with the sorted
annotation?  What version of vim?

 What's going on?  I even checked the current docs at vim.org and they
 don't mention a file:xyz form either.

I think I saw it documented *somewhere*, but now that I look again I
can't find it anywhere.  Maybe it was in a dream.  I hope a newer
version of vim didn't remove the support or something...

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


Re: [Haskell-cafe] ANNOUNCE: JSONb-1.0.0

2010-04-07 Thread Jason Dusek
2010/04/07 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com:
 Jason Dusek jason.du...@gmail.com writes:
    A new release of JSONb, taking advantage of the latest Attoparsec.
 
      http://hackage.haskell.org/package/JSONb-1.0.0

 Is this meant to be a continuation of the json-b package?

  Yes. I moved to camel case because that is consistent with the
  module name.

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


Re: [Haskell-cafe] Suitable structure to represents lots of similar lists

2010-04-07 Thread Edward Kmett
I've been meaning to generalize Data.Rope in my rope library to use Vector
rather than ByteString.

Ultimately it looks like a FingerTree of Vector's using length as the
monoid.

The vectors can be sliced cheaply and the fingertree as a whole supports
cheap splicing.

-Edward Kmett

On Wed, Apr 7, 2010 at 6:22 PM, Dan Piponi dpip...@gmail.com wrote:

 I have a situation where I have a bunch of lists and I'll frequently
 be making new lists from the old ones by applying map and filter. The
 map will be applying a function that's effectively the identity on
 most elements of the list, and filter will be using a function that
 usually gives True. This means that there is potential for a large
 amount of sharing between these lists that could be exploited,
 something that ordinary lists would do badly. Does anyone have a
 recommendation for a pure functional data structure for this case?

 (It reminds me a bit of my own antidiagonal type, but that's not well
 adapted to the highly dynamic situation I'm describing.)
 --
 Dan
 ___
 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] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Ivan Miljenovic
On 8 April 2010 08:25, Daniel Fischer daniel.is.fisc...@web.de wrote:
 Am Donnerstag 08 April 2010 00:09:34 schrieb Ivan Lazar Miljenovic:
 etc. ...

 Such as?

To avoid stating these all over again:
http://ivanmiljenovic.wordpress.com/2010/03/15/repeat-after-me-cabal-is-not-a-package-manager/
(specifically the section titled Why you should use your
distribution’s package management system).

-- 
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] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Daniel Fischer
Am Donnerstag 08 April 2010 01:47:19 schrieb Ivan Miljenovic:
 On 8 April 2010 08:25, Daniel Fischer daniel.is.fisc...@web.de wrote:
  Am Donnerstag 08 April 2010 00:09:34 schrieb Ivan Lazar Miljenovic:
  etc. ...
 
  Such as?

 To avoid stating these all over again:
 http://ivanmiljenovic.wordpress.com/2010/03/15/repeat-after-me-cabal-is-
not-a-package-manager/ (specifically the section titled Why you should
 use your
 distribution’s package management system).

Fair enough, Cabal/Hackage/cabal-install certainly isn't a package manager 
(good that I never claimed it was :), I just use it to manage my Haskell 
source packages; no, I won't stop doing that, I'm not going to switch 
distros, I like SuSE, I didn't like Ubuntu or sidux, I might give Gentoo a 
try when I buy my next computer, though).

However, I wanted to know what the etc stood for, with taking care of 
dependencies and uninstalling already mentioned. Upgrading, yes, but what 
else?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Ivan Miljenovic
On 8 April 2010 10:41, Daniel Fischer daniel.is.fisc...@web.de wrote:
 However, I wanted to know what the etc stood for, with taking care of
 dependencies and uninstalling already mentioned. Upgrading, yes, but what
 else?

Patching, bug fixing, stuff like that.

-- 
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] GHC LLVM ARM Cross Compilation

2010-04-07 Thread Nathaniel Neitzke
I saw the Google Summer of Code project for using LLVM to cross compile for
other architectures such as ARM.  Professionally I write embedded Linux code
that targets ARM processors such as the TI DaVinci DM355 and am
very intrigued by the potential use of Haskell for future projects.

If I was interested in attempting to add support for LLVM ARM
cross-compilation, are there any thoughts on what parts would have to be
modified to do so?  Or has work already been conducted in this area?

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


Re: [Haskell-cafe] Re: True Random Numbers

2010-04-07 Thread Gökhan San
James Cook mo...@deepbondi.net writes:

 As the maintainer of random-fu, I'd be interested to know whether you
 find it useful after further inspection.

Is there a way to get multiple random numbers without having to
replicateM?

While comparing the random-fu interface with Control.Monad.Random (both
using StdGen), I noticed that while performance is comparable, using
getRandomRs to get a list of random numbers is a lot faster than
replicating uniform (or getRandomR for that matter). I don't know if
this kind of speed gain makes sense for random-fu though.

-- 

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


Re: [Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-07 Thread Roman Leshchinskiy
On 08/04/2010, at 01:38, Henning Thielemann wrote:

 On Apr 6, 2010, at 5:30 PM, Roman Leshchinskiy wrote:
  
 In fact, the only safe-ish use for it I have found is to use 
 Storable-related functions in ST, hoping that the instances don't actually 
 use any real IO functionality. Arguably, this shouldn't be necessary as 
 Storable should live in ST anyway.
 

 But Storable in ST monad would be still dangerous, because pointers may point 
 to non-allocated memory or point outside of an array.

I don't think that's the kind of safety the original poster had in mind. You 
can have invalid memory accesses even in pure code but that's ok since we know 
what the semantics is: bottom. I understood the question to be about the 
conditions under which unsafeIOToST can violate referential transparency.

Roman
 

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


Re: [Haskell-cafe] ANNOUNCE: Hac phi 2010

2010-04-07 Thread Jason Dagit
2010/4/7 Chris Casinghino chris.casingh...@gmail.com

 Greetings,

 I am very pleased to officially announce Hac phi 2010, a Haskell
 hackathon/get-together to be held May 21-23 at the University of
 Pennsylvania in Philadelphia.  The hackathon will officially kick off
 at 2:30 Friday afternoon, and go until 5pm on Sunday (with breaks for
 sleep, of course).  Last year's Hac phi was a lot of fun, and many
 people have already expressed interest in coming back this year.  I
 want to stress that everyone is welcome---you do not have to be a
 Haskell guru to attend!  Helping hack on someone else's project could
 be a great way to increase your Haskell-fu.

 If you plan on coming, please officially register [1].  Registration,
 travel, lodging and many other details can be found on the Hac phi
 wiki [2].  Note that we're in a different space this year and may have
 to cap attendance, so register early.


If you don't run out of space, what is the registration deadline?

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


Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)

2010-04-07 Thread Jason Dagit
On Wed, Apr 7, 2010 at 2:57 PM, Malcolm Wallace 
malcolm.wall...@cs.york.ac.uk wrote:

  The platform installer is supposed to erase previous platform
  editions before it installs itself.


 I would consider that a serious bug.


 Lacking a feature I would consider essential /= a bug in my opinion,
 especially when the desirability of the feature is in question.


 It is not merely that a feature is lacking.  Removing software from my
 machine without my knowledge or permission is just wrong.  (I was bitten by
 this once before, with a ghc installer for Mac.  It removed the previous
 working ghc, without telling me.  Then I discovered that a library I needed
 could not be compiled by the new version of ghc. The old ghc installer then
 refused to delete the new ghc and revert to the old one, because it could
 not imagine why anyone would want to downgrade.)


If I understand correctly, the issue at hand is that the uninstaller step is
removing previous libraries and ghc?

If so, then I completely agree with Malcolm here.  Having the installer only
allow one version of ghc means I'll keep using the tarball provided by GHC
HQ instead of the nice shiny installer for the HP.  I need to be able to
test things on multiple GHC versions for the foreseeable future.

I have a workaround, but I implore you to please kindly reconsider your
stance here.

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


[Haskell-cafe] HDBC-ODBC and SqlValues

2010-04-07 Thread Tim Docker
I'm experimenting with haskell and relational databases. I have
successfully coupled unixodbc + freetds + hdbc-odbc, and can make
trivial queries. However, I'm surprised at the result types:

$ ghci
GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude c -  Database.HDBC.ODBC.connectODBC
 DSN=x;UID=x;PWD=
Loading package syb ... linking ... done.
Loading package base-3.0.3.1 ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package containers-0.2.0.1 ... linking ... done.
Loading package bytestring-0.9.1.4 ... linking ... done.
Loading package old-locale-1.0.0.1 ... linking ... done.
Loading package old-time-1.0.0.2 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package utf8-string-0.3.5 ... linking ... done.
Loading package time-1.1.4 ... linking ... done.
Loading package convertible-1.0.9 ... linking ... done.
Loading package HDBC-2.2.4 ... linking ... done.
Loading package HDBC-odbc-2.2.3.0 ... linking ... done.
Prelude Database.HDBC.quickQuery c select 1+3 []
[[SqlByteString 4]]
Prelude

Why do I see an SqlByteString returned, rather than a numeric type?

Taking a closer look at the HDBC-ODBC implementation it would appear
that data will always be returned as SqlByteString, or as SqlNull.

Is this the intended behaviour, or just a sign of an incomplete
implementation of the ODBC driver? It would certainly seem possible for
the ODBC driver to return more specific types.

Tim

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


Re: [Haskell-cafe] GHC LLVM ARM Cross Compilation

2010-04-07 Thread Jason Dagit
On Wed, Apr 7, 2010 at 6:06 PM, Nathaniel Neitzke night...@gmail.comwrote:

 I saw the Google Summer of Code project for using LLVM to cross compile for
 other architectures such as ARM.  Professionally I write embedded Linux code
 that targets ARM processors such as the TI DaVinci DM355 and am
 very intrigued by the potential use of Haskell for future projects.

 If I was interested in attempting to add support for LLVM ARM
 cross-compilation, are there any thoughts on what parts would have to be
 modified to do so?  Or has work already been conducted in this area?


I'm not a GHC hacker, but my understanding goes like this:
  1) the version of ghc in darcs has support for using LLVM to generate code
on at least x86.
  2) GHC has never really work as a cross compiler, but there is an active
push to change this.

The GHC wiki is here:
  http://hackage.haskell.org/trac/ghc/

If you want to get started on understanding the source and hacking on it,
there are pages for that:
  http://hackage.haskell.org/trac/ghc/wiki/GettingStarted
  http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions

Probably the best thing you can do is get on the GHC mailing list:

http://www.haskell.org/ghc/docs/latest/html/users_guide/mailing-lists-GHC.html

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


Re: [Haskell-cafe] HDBC-ODBC and SqlValues

2010-04-07 Thread Jason Dagit
On Wed, Apr 7, 2010 at 9:08 PM, Tim Docker t...@dockerz.net wrote:

 I'm experimenting with haskell and relational databases. I have
 successfully coupled unixodbc + freetds + hdbc-odbc, and can make
 trivial queries. However, I'm surprised at the result types:

 $ ghci
 GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer ... linking ... done.
 Loading package base ... linking ... done.
 Prelude c -  Database.HDBC.ODBC.connectODBC
 DSN=x;UID=x;PWD=
 Loading package syb ... linking ... done.
 Loading package base-3.0.3.1 ... linking ... done.
 Loading package array-0.2.0.0 ... linking ... done.
 Loading package containers-0.2.0.1 ... linking ... done.
 Loading package bytestring-0.9.1.4 ... linking ... done.
 Loading package old-locale-1.0.0.1 ... linking ... done.
 Loading package old-time-1.0.0.2 ... linking ... done.
 Loading package mtl-1.1.0.2 ... linking ... done.
 Loading package utf8-string-0.3.5 ... linking ... done.
 Loading package time-1.1.4 ... linking ... done.
 Loading package convertible-1.0.9 ... linking ... done.
 Loading package HDBC-2.2.4 ... linking ... done.
 Loading package HDBC-odbc-2.2.3.0 ... linking ... done.
 Prelude Database.HDBC.quickQuery c select 1+3 []
 [[SqlByteString 4]]
 Prelude

 Why do I see an SqlByteString returned, rather than a numeric type?


The query consists of one column and one row of an integer whose value is 4.
 But, ODBC lets you request your data as some other type if you like during
the call to SQLFetch.  You set this up during SQLBindCol.  It's up to the
database to support (or not) the conversion from the type it has to the type
you requested.  I think pretty much every database supports converting its
types to string.  What I'm getting at, is that yes the database should be
holding an int for you to fetch, but the code is requesting it as a string.

You can read more about how it works here:
http://msdn.microsoft.com/en-us/library/ms709280(v=VS.85).aspx

Furthermore, your specific case is not giving the database any hint as to
what type you're expecting.  There is no table schema to go by, no cast in
the query, etc.  You might try your example using the odbc interactive sql
prompt 'isql' and see what type it gets from your database.


 Taking a closer look at the HDBC-ODBC implementation it would appear
 that data will always be returned as SqlByteString, or as SqlNull.


I can't really comment here because I'm not familiar with the internals of
HDBC, but I'm familiar with the internals of Takusen.  In Takusen, the type
of the function you use to fetch data determines if there is a conversion
during the SQLFetch.  This is setup with some type classes.



 Is this the intended behaviour, or just a sign of an incomplete
 implementation of the ODBC driver? It would certainly seem possible for
 the ODBC driver to return more specific types.


I suspect the solution is to correctly tell Haskell what type you expect and
then hopefully HDBC will do the conversion.  For example, using fromSql:
http://software.complete.org/static/hdbc/doc/Database-HDBC.html#v%3AfromSql

Alternatively, you could try Takusen.  The types are a bit harder to
understand at first compared to HDBC, but it seems to really work well once
you get the hang of it.  If you're using the ODBC backend you'll need the
darcs version of Takusen.  The version on hackage has at least a few ODBC
bugs that are show stoppers, but are corrected in the darcs version:
  darcs get --lazy http://darcs.haskell.org/takusen

I hope that helps,
Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HDBC-ODBC and SqlValues

2010-04-07 Thread Jason Dagit
On Wed, Apr 7, 2010 at 9:45 PM, Jason Dagit da...@codersbase.com wrote:


   darcs get --lazy http://darcs.haskell.org/takusen


Oops.  That's a dead link, try this instead:
  darcs get --lazy http://code.haskell.org/takusen/

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


[Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-07 Thread Carter Schonwald
Hello All,

I would like to know if there is enough community interest in following gsoc
project proposal of mine for me to write up a proper haskell gsoc app for it
. (and accordingly if there is a person who'd be up for having the mentoring
role)

Project: Alternate numerical prelude with a typeclass hierarchy that follows
that found in abstract algebra, along with associated generic algorithms for
various computations can be done on datastructures satisfying these type
clases.

In particular, the motivating idea is the following: yes it'd be useful (for
more mathematically inclined haskellers) to have a numerical prelude whose
hierarchy means something, but for even that subset of the haskell user
population, such an alternate prelude is only useful if users get extra
functionality out of that more detailed infrastructure (and I believe that
some of the infrastructure that becomes feasible would be worthwhile to the
larger haskell community).

the basic plan is as follows

1) define a typeclass hierarchy that covers everything such as  monoids -
groups - rings - fields, and various points in between.   After some
experimenting, it  has become pretty clear to me that  all of these need to
be defined indirectly with the help of template haskell so that the names of
the various operators can be suitably parameterized (so that * and + etc
aren't the only choices people have).
   This part itself isn't terribly difficult, though theres a lot of
important intermediate algebraic structures that also need to be defined,
and as I currently plan it, i'm very much inclined towards  specifying all
the required properties of each algebraic structure as testable properties,
so that in a certain sense all these type clases could be interpreted as
adding facts to an inference engine . This part is easy, just a lot of
support type classes which a user wouldn't often encounter or deal with
unless they're doing real math, in which case understanding them is probably
key for correctly writing the desired code anyways.

For those reading this who don't know the abstract algebra terminology:
*a monoid* is a set with an operation + which has an identity element, an
example would be lists and the append operation.

*a group * is a monoid where the operation is invertible, it could be
something as simple as positive rational numbers under multiplication or the
various translations and rotations that one does to 3d objects such as when
doing open gl programming where in this latter case the * or + operation
is composition of these (invertible) transformations

*a ring *will have both a +, and a *, and the + will be a group over
the set of objects in the ring and the * a monoid, over the objects in the
ring. a simple example would just be the integers with + and * as they
usually are. Plus some rules about 0 and 1.

*a field * would be a ring where all the nonzero elements are invertible
with respect to multiplication (ie nonzero elements form a multiplicative
group). A standard example would be rational numbers with the standard + and
*

and so forth for many other algebraic objects.

2) providing algorithmic machinery that makes this all worthwhile: in
particular there are two veins of algorithmic machinery that would be goals
of the gsoc project, one which is certainly feasible, and the other which
i'm still working out the design details for but feel is very likely.
respectively:

a) generic algorithms for various standard algebraic computational problems,
for example a generic euclidean algorithm that will work on any sort of data
structure/object/algebraic thingy that satisfies all the necessary algebraic
properties (such as multivariate polynomials!), with specialized versions
for various cases where better algorithms are known and the nature of the
representation can be exploited (eg binary gcd on the integers).
This part of the project would essentially be me going through some
computational number theory /algebra texts such as http://www.shoup.net/ntb/
 (A Computational Introduction to Number Theory and Algebra)  and
implementing every interesting/useful algorithm both generic and specialized
variants. As haskell's numerical typeclass hierarchy currently stands, it is
impossible to implement generic versions of these algorithms in haskell, and
I don't think any widely used language aside from  haskell (except perhaps
scala?) even has the right abstraction facilities to make it feasible.
   Of course certain specialized cases would even benefit perhaps by
actually having them be in turn implemented in a more low level fashion (eg
via some external c/c++ library), but that itself is not really important
for the core project and would be beyond the scope of a single summers work.

b) because the type classes would directly encode what manipulations and
equational reasoning steps are valid, the same information  could be used to
 safely do computer assisted algebra/mathematics. In particular, the various
types which 

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Dean Herington
Is there any reason not to use the more standard uninterruptible 
instead of noninterruptible?


Dean

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