Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Magnus Therning
On Thu, Mar 4, 2010 at 18:05, Stephen Tetley stephen.tet...@gmail.com wrote:
 Hi Tom

 Hmm, its seems I'm due to eat my hat...

 To me though, the judgement makes that insistence that using an API is
 making a derivative work. I can't see how that squares up.

That has, AFAIU, been the intention of the GPL all along.  See e.g.
http://www.fsf.org/licensing/licenses/why-not-lgpl.html

It also explains why there has been a discussion in the Linux kernel
community about closed source drivers (e.g. nvidia).

The LGPL was, AFAIU, written to explicitly allow a shift of license at
the API level.  Without the insistence you point out, GPL and LGPL
would be pretty much the same license.

/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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Luke Palmer
On Fri, Mar 5, 2010 at 12:53 AM, Kevin Jardine kevinjard...@yahoo.com wrote:
 I'm a Haskell newbie but long time open source developer and I've been 
 following this thread with some interest.

 The GPL is not just a license - it is a form of social engineering and social 
 contract. The idea if I use the GPL is that I am releasing free and open 
 source software to the community. You are welcome to use it for any purpose 
 but in exchange you must also agree to release any software you create that 
 uses my software as free and open source.

 That is the difference between GPL and BSD type licenses. The GPL very 
 deliberately creates an obligation. Yes, that can be inconvenient. It is 
 meant to be inconvenient.

 Actually the GPL reminds me of a Haskell concept that I am struggling with 
 right now - the monad. When I started writing Haskell code I was always 
 trying to mix pure and IO code and I soon learned that once I used the IO 
 monad I was stuck within it. The monad creates an inconvenient obligation and 
 any IO code can only be used within other IO code. There are good reasons for 
 monads (just as, in my view, there are good reasons for the GPL) but using 
 them means that I need to make a lot of changes to the way I write software.

Sure.  You can put a GPL license on any software:

license :: a - GPL a

And if you could have used some public domain package 'a' to create
some GPL'd software, then you can use the GPL'd 'a' to create that
same software.

usage :: (a - GPL b) - GPL a - GPL b

:-P

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread minh thu
2010/3/5 Magnus Therning mag...@therning.org:
 On Thu, Mar 4, 2010 at 18:05, Stephen Tetley stephen.tet...@gmail.com wrote:
 Hi Tom

 Hmm, its seems I'm due to eat my hat...

 To me though, the judgement makes that insistence that using an API is
 making a derivative work. I can't see how that squares up.

 That has, AFAIU, been the intention of the GPL all along.  See e.g.
 http://www.fsf.org/licensing/licenses/why-not-lgpl.html

 It also explains why there has been a discussion in the Linux kernel
 community about closed source drivers (e.g. nvidia).

 The LGPL was, AFAIU, written to explicitly allow a shift of license at
 the API level.  Without the insistence you point out, GPL and LGPL
 would be pretty much the same license.

I don't see how what you say is related by the link you provide.

They say there is an advantage to make a library GPL when there is no
alternative so program using the library is required to be GPL too. As
an example,  they licensed the C library LGPL because they were
already other available C library, so making their one GPL licensed
could not really drive more programs to be GPL.

Indeed the boundary of a library is its API but that hardly translates
to say that the GPL covers the API.

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Magnus Therning
On Fri, Mar 5, 2010 at 08:55, minh thu not...@gmail.com wrote:
 2010/3/5 Magnus Therning mag...@therning.org:
 On Thu, Mar 4, 2010 at 18:05, Stephen Tetley stephen.tet...@gmail.com 
 wrote:
 Hi Tom

 Hmm, its seems I'm due to eat my hat...

 To me though, the judgement makes that insistence that using an API is
 making a derivative work. I can't see how that squares up.

 That has, AFAIU, been the intention of the GPL all along.  See e.g.
 http://www.fsf.org/licensing/licenses/why-not-lgpl.html

 It also explains why there has been a discussion in the Linux kernel
 community about closed source drivers (e.g. nvidia).

 The LGPL was, AFAIU, written to explicitly allow a shift of license at
 the API level.  Without the insistence you point out, GPL and LGPL
 would be pretty much the same license.

 I don't see how what you say is related by the link you provide.

 They say there is an advantage to make a library GPL when there is no
 alternative so program using the library is required to be GPL too. As
 an example,  they licensed the C library LGPL because they were
 already other available C library, so making their one GPL licensed
 could not really drive more programs to be GPL.

 Indeed the boundary of a library is its API but that hardly translates
 to say that the GPL covers the API.

Ah, I might have misunderstood the whole thread then.  I thought the
discussion was about using the API of a GPLd library.  While your
comment suggests it's actually about re-implementing a GPLd library,
making it API compatible, and releasing the re-implementation under
another license.

In that case wouldn't a project like Harmony
(http://en.wikipedia.org/wiki/Harmony_toolkit) be problematic?
So would editline's mode for compatibility with readline, right?

(GNU TLS would probably not get in trouble for providing an OpenSSL
compatibility layer though.)

/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


Re: [Haskell-cafe] Re: How do you rewrite your code?

2010-03-05 Thread Henning Thielemann

Ertugrul Soeylemez schrieb:

As a side note: I have found that many people don't understand the
filterM-based solution.  That's because many people don't understand the
list monad and the power of the monadic interface.  So if you work in a
group, either don't write code like this or preferably explain monads to
your groupmates.
  
Alternatively, keep all versions and compare them in a QuickCheck 
test-suite.


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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Stephen Tetley
Hi Magnus

The 'Why not LGPL' doesn't cover the particular argument here:

 using the ordinary GPL for a library makes it available only for free 
 programs.

The particular concern we have here is quite specific, considering
(--) to be a dependency, can Hackage libraries under BSD3 that depend
on libraries under GPL?

[1] App -- libBSD3 -- libGPL


Any App built has to incorporate the GPL library - so the App has to
be GPL. -- No dispute --.

Similar BSD3 is a GPL compatible library, so this dependency chain
would be legal:

[2] App -- libGPL -- libBSD

The argument is whether it is legal to distribute (read host on
Hackage) BSD3 libs that depend on GPL libs - formulation [1].


--

I'd have thought Harmony would be problematic for different reasons -
i.e. coping the API of a copyright work.

Best wishes

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Stephen Tetley
On 5 March 2010 09:38, Stephen Tetley stephen.tet...@gmail.com wrote:


 Similar BSD3 is a GPL compatible library, so this dependency chain
 would be legal:

 [2] App -- libGPL -- libBSD



Typo above - should be

Similar BSD3 is a GPL compatible __license__, so this dependency chain
would be legal:

[2] App -- libGPL -- libBSD


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


Re: [Haskell-cafe] Real-time garbage collection for Haskell

2010-03-05 Thread Henning Thielemann

Curt Sampson schrieb:

Understanding the general techniques for this sort of thing and seeing
where you're likely to need to apply them isn't all that difficult, once
you understand the problem. (It's probably much easier if you don't have
to work it out all for yourself, as I did. Someone needs to write the
how to manage lazyness in Haskell guide.)


My attempt in this direction:
 http://www.haskell.org/haskellwiki/Laziness_is_not_always_good
 http://www.haskell.org/haskellwiki/Maintaining_laziness

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Magnus Therning
On Fri, Mar 5, 2010 at 09:38, Stephen Tetley stephen.tet...@gmail.com wrote:
 Hi Magnus

 The 'Why not LGPL' doesn't cover the particular argument here:

 using the ordinary GPL for a library makes it available only for free 
 programs.

 The particular concern we have here is quite specific, considering
 (--) to be a dependency, can Hackage libraries under BSD3 that depend
 on libraries under GPL?

 [1] App -- libBSD3 -- libGPL


 Any App built has to incorporate the GPL library - so the App has to
 be GPL. -- No dispute --.

 Similar BSD3 is a GPL compatible library, so this dependency chain
 would be legal:

 [2] App -- libGPL -- libBSD

 The argument is whether it is legal to distribute (read host on
 Hackage) BSD3 libs that depend on GPL libs - formulation [1].

Now I'm even more confused.  How is hosting on Hackage an issue in [1]?

Both involved licenses are very liberal when it comes to distribution.
 The only issue I do see is that the author of libBSD3 is actually
deluding her/him-self, since the use of libGPL means both libraries
are in fact under GPL.  I don't see this being anything that anyone
involved with Hackage can be held responsible for, the responsibility
must fall on the author of libBSD3.  In this scenario I don't see
Hackage as anything more than a conduit.

/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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Stephen Tetley
On 5 March 2010 09:53, Magnus Therning mag...@therning.org wrote:

 Now I'm even more confused.  How is hosting on Hackage an issue in [1]?

Hi Magnus

The issue arouse when Tom Tobin spotted Hackage was hosting hakyll
(libBSD3) that depends in pandoc (libGPL). Hakyll's author is allowed
to privately write any code he wants that uses GPL code, Hackage come
into it as he published on Hackage.

Best wishes

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Malcolm Wallace

On 5 March 2010 09:53, Magnus Therning mag...@therning.org wrote:

Now I'm even more confused.  How is hosting on Hackage an issue in  
[1]?


The GPL specifically (and only) applies when code is distributed to  
others outside the originating authors' organisation.


Hackage is a means of distributing such code.  Because Hackage has  
received the code from the author, it therefore has the same  
obligations (under the GPL, or BSD, or whatever) as any other recipient.


To be clear, like any recipient, one treats the donor in good faith.   
That is, one believes the license granted by the author (or upstream  
distributor) is valid until notified otherwise.  It is the author's  
responsibility to check, not Hackage's.


Regards,
Malcolm

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread David Leimbach
On Fri, Mar 5, 2010 at 2:19 AM, Stephen Tetley stephen.tet...@gmail.comwrote:

 On 5 March 2010 09:53, Magnus Therning mag...@therning.org wrote:

  Now I'm even more confused.  How is hosting on Hackage an issue in [1]?

 Hi Magnus

 The issue arouse when Tom Tobin spotted Hackage was hosting hakyll
 (libBSD3) that depends in pandoc (libGPL). Hakyll's author is allowed
 to privately write any code he wants that uses GPL code, Hackage come
 into it as he published on Hackage.


Yes the author can privately license code to himself under any license he
wants, but when he distributes code based on GPL'd code, it has to be GPL'd.
 That's why people hate this license, or love this license.  For all the
freedom it talks about it's awfully restrictive.

Dave




 Best wishes

 Stephen
 ___
 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] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread David Leimbach
As always I'm still not a lawyer, so this is not legal advice... but here's
how I think it works.  If you need to talk to a lawyer to get this cleared
up, do it.

On Fri, Mar 5, 2010 at 2:30 AM, Malcolm Wallace 
malcolm.wall...@cs.york.ac.uk wrote:

 On 5 March 2010 09:53, Magnus Therning mag...@therning.org wrote:

  Now I'm even more confused.  How is hosting on Hackage an issue in [1]?


 The GPL specifically (and only) applies when code is distributed to
 others outside the originating authors' organisation.



I'm pretty sure it says nothing about organizations.  If I threw a flash
stick with a binary of a program I wrote over my cubicle wall to say, my
coworker, Steve, and I tried to tell him he couldn't have the source to my
binary that I created based on a GPL'd program on that stick, he could say
I've infringed on his rights under the GPL.


 Hackage is a means of distributing such code.  Because Hackage has received
 the code from the author, it therefore has the same obligations (under the
 GPL, or BSD, or whatever) as any other recipient.


Hackage has no obligations unless it's an intelligent entity.

Hackage does not have to enforce the GPL, the author responsible for the
perceived violation of the GPL must resolve it with the person claiming the
violation, either by settling it inside or outside of court, by either
making their code the GPL, or dealing with someone potentially bringing them
in front of a judge.

In fact the people running Hackage have now become the same as the person I
threw my flash drive over the cube wall to, and have the same rights as
Steve.



 To be clear, like any recipient, one treats the donor in good faith.  That
 is, one believes the license granted by the author (or upstream distributor)
 is valid until notified otherwise.  It is the author's responsibility to
 check, not Hackage's.


EXACTLY :-)


Now for a bit of personal reflection that you can ignore if you wish...

Wouldn't it be excellent if Google could tell us just how many times
innocent mailing lists like haskell-cafe have to put up with confusion over
the GPL?  Every single open source project I've ever been on has had a
mailing list that has had this problem in the last 15 years I've been active
in open source communities, and it just keeps rearing it's ugly head.

It's really irritating and distracts people who'd rather be sharing their
work with one another from doing so, completely thwarting the point of the
FSF to begin with.

As such I've long since abandoned any love for any form of the GPL, and much
prefer licenses like the BSD license.



 Regards,
Malcolm


 ___
 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] Books for advanced Haskell

2010-03-05 Thread David Leimbach
On Thu, Mar 4, 2010 at 7:11 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote:

 I assumed that CBL meant Call By Location



Commercial Brewer's License?  I think it's about beer!






 ___
 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] How to put data from a string to a tuple

2010-03-05 Thread Pradeep Wickramanayake
Hi,

Im self learner in Haskell. And im stuck in a  small place which I tried
searching in google but couldn't find
Proper answer 

I have some values in a string, Im removing them one by one from the string
(word by word) and I want to put them in a tuple. Because it contain
Integers and Strings. 

Can someone help me



 

__ Information from ESET NOD32 Antivirus, version of virus signature
database 4917 (20100305) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

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


Re: [Haskell-cafe] How to put data from a string to a tuple

2010-03-05 Thread Luke Palmer
Consider taking this to the haskell-beginners list.

On Fri, Mar 5, 2010 at 4:32 AM, Pradeep Wickramanayake prad...@talk.lk wrote:
 Hi,

 Im self learner in Haskell. And im stuck in a  small place which I tried
 searching in google but couldn't find
 Proper answer

 I have some values in a string, Im removing them one by one from the string
 (word by word) and I want to put them in a tuple. Because it contain
 Integers and Strings.

Could you be more specific?  Paste the code you have already, and be
clearer about what you are trying to accomplish.

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


[Haskell-cafe] How to obtain unique integers

2010-03-05 Thread Robert Rothenberg
I'm implementing a variant of Prolog in Haskell (yes, I know others
already exist...) and am looking to solve the following issues:

(1) I need to translate anonymous variables _ into unique variable
names.  Data.Unique does not give me a printable identifier. Is there
another package that does this?

(2) Is there a cabal package similar to the Atom.hs module form ginsu,
that associates strings with unique hashes?

The alternative of course is to maintain state variables and pass them
along to display and parsing functions, but that makes it difficult to
make the terms instances of Read/Show without reference to a global
variable anyhow.

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Malcolm Wallace
 The GPL specifically (and only) applies when code is distributed  
to others outside the originating authors' organisation.



I'm pretty sure it says nothing about organizations.


http://www.gnu.org/licenses/gpl-faq.html#InternalDistribution

Is making and using multiple copies within one organization or company  
“distribution”?
No, in that case the organization is just making the copies for  
itself. As a consequence, a company or other organization can develop  
a modified version and install that version through its own  
facilities, without giving the staff permission to release that  
modified version to outsiders.


However, when the organization transfers copies to other organizations  
or individuals, that is distribution. In particular, providing copies  
to contractors for use off-site is distribution.


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


[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-05 Thread Simon Marlow

On 04/03/2010 09:14, Curt Sampson wrote:


However: now that Simon's spent a bunch of time experimenting with the
runtime's GC settings and found a set that's mitigated much of our
problem, other things are pushing their way up my priority list. Between
that and an upcoming holiday, I'm probably not going to get back to this
for a few weeks. But I'd be happy to discuss my ideas with anybody else
who's interested in similar things, even if just to know what would be
useful to others.


What settings are you using, out of interest?


What do you guys think about setting up a separate mailing list for
this? I have to admit, I don't follow haskell-cafe much due to the high
volume of the list. (Thus my late presence in this thread.) I would be
willing to keep much closer track of a low-volume list that dealt with
only GC stuff.


Please feel free to discuss on glasgow-haskell-users@ which is lower 
volume.  I don't particularly like setting up new mailing lists unless 
there's likely to be an ongoing need - we have quite a few defunct lists 
on haskell.org now.



I'd even be open to providing hosting for the list, using my little baby
mailing list manager written in Haskell (mhailist). It's primitive, but
it does handle subscribing, unsubscribing and forwarding of messages.


Sure, that would be fine too.

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


[Haskell-cafe] Re: How to obtain unique integers

2010-03-05 Thread Ertugrul Soeylemez
Robert Rothenberg rob...@gmail.com wrote:

 I'm implementing a variant of Prolog in Haskell (yes, I know others
 already exist...) and am looking to solve the following issues:

 (1) I need to translate anonymous variables _ into unique variable
 names.  Data.Unique does not give me a printable identifier. Is there
 another package that does this?

 (2) Is there a cabal package similar to the Atom.hs module form ginsu,
 that associates strings with unique hashes?

 The alternative of course is to maintain state variables and pass them
 along to display and parsing functions, but that makes it difficult to
 make the terms instances of Read/Show without reference to a global
 variable anyhow.

Well, you can use hashUnique, but there are no guarantees about
collisions.  If you need thread safety, the easiest approach is an id
generator thread like this:

  idVar - newEmptyMVar
  forkIO . mapM (putMVar idVar) $ [0..]
  let getId = takeMVar idVar

If you don't need it, you will need to pass state around, just like with
Data.Unique.


Greets
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife = sex)
http://blog.ertes.de/


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


[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-05 Thread Simon Marlow

On 05/03/2010 05:03, wren ng thornton wrote:

Simon Marlow wrote:

So it would be pretty easy to provide something like

disableMajorGC, enableMajorGC :: IO ()

Of course leaving it disabled too long could be bad, but that's your
responsibility.


It seems like it'd be preferable to have an interface like:

withMajorGCDisabled :: IO() - IO()

or (for some definition of K):

withMajorGCDisabled :: (K - IO()) - IO()


Sure, my intention was that you'd build this with the primitives.

 in order to ensure that it always gets turned back on eventually. Of
 course, the latter can be created from the former pair. It's just that
 the former reminds me a bit much of explicit memory management and how
 difficult it is to balance the free()s...

quite!

Cheers,
Simon

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


[Haskell-cafe] Re: Books for advanced Haskell

2010-03-05 Thread Günther Schmidt

Hi,

oh boy it took me a while to find this post again.



Perhaps not exactly. I build monads left and right, but that's because
I don't understand much else. :-) Before you get all hung up on them,
though, I recommend reading The Typeclassopedia,[1], which will
introduce you to all of the monad's friends and family.



When you say that you use monads to the left and right, do you mean 
using pre-defined monad instances, or do you construct your own, ie. 
define something to be an instance of a monad and then write codes using 
that instance?




Günther


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


[Haskell-cafe] Re: GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Maciej Piechotka
On Fri, 2010-03-05 at 01:42 -0700, Luke Palmer wrote:
 On Fri, Mar 5, 2010 at 12:53 AM, Kevin Jardine kevinjard...@yahoo.com wrote:
  I'm a Haskell newbie but long time open source developer and I've been 
  following this thread with some interest.
 
  The GPL is not just a license - it is a form of social engineering and 
  social contract. The idea if I use the GPL is that I am releasing free and 
  open source software to the community. You are welcome to use it for any 
  purpose but in exchange you must also agree to release any software you 
  create that uses my software as free and open source.
 
  That is the difference between GPL and BSD type licenses. The GPL very 
  deliberately creates an obligation. Yes, that can be inconvenient. It is 
  meant to be inconvenient.
 
  Actually the GPL reminds me of a Haskell concept that I am struggling with 
  right now - the monad. When I started writing Haskell code I was always 
  trying to mix pure and IO code and I soon learned that once I used the IO 
  monad I was stuck within it. The monad creates an inconvenient obligation 
  and any IO code can only be used within other IO code. There are good 
  reasons for monads (just as, in my view, there are good reasons for the 
  GPL) but using them means that I need to make a lot of changes to the way I 
  write software.
 

Hmm. I believe that there are sufficient loopholes in GPL as library to
not use it. Personally I follow such rules of thumb (for myself):
- BSD3/MIT/... - Small code or BSD3 community
- LGPL - Larger libraries 
- GPL - Programs

BTW. What if package have multiply licenses? Cabal seems to not express
following situations:
- It is dual licensed
- Library is LGPL but helper program is GPL
- Part of library is on striker license but part of it is for example
public domain (so it would be worth to note this)

 Sure.  You can put a GPL license on any software:
 
 license :: a - GPL a
 
 And if you could have used some public domain package 'a' to create
 some GPL'd software, then you can use the GPL'd 'a' to create that
 same software.
 
 usage :: (a - GPL b) - GPL a - GPL b
 
 :-P
 
 Luke

Hmm. IMHO it is more similar

class Licence l where
license :: Package a = a - l a

class Licence l = GPLCompatible l where
...

instance GPLCompatible GPL
instance GPLCompatible LGPL
...

liftToGPL :: (GPLCompatible l, Package a) = l a - GPL a

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: GPL answers from the SFLC

2010-03-05 Thread Ivan Lazar Miljenovic
Maciej Piechotka uzytkown...@gmail.com writes:
 BTW. What if package have multiply licenses? Cabal seems to not express
 following situations:
 - It is dual licensed
 - Library is LGPL but helper program is GPL
 - Part of library is on striker license but part of it is for example
 public domain (so it would be worth to note this)

What seems to happen so far is that the library license is given in the
Cabal file (as it has the most amount of code usually).

For example, see the license for cpphs [1]; on Hackage it's listed as
LGPL whereas the library is LGPL and the program is GPL.

[1]: http://haskell.org/cpphs/

-- 
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: New OpenGL package: efficient way to convert datatypes?

2010-03-05 Thread Achim Schneider
Nick Bowler nbow...@elliptictech.com wrote:

 I meant to say that fromRational . toRational is not appropriate for
 converting values from one floating point type to another floating
 point type.

It gets even worse: My GPU doesn't know about doubles and its floats
aren't IEEE, at all (not that Haskell Doubles are guaranteed to be IEEE
iirc)

I think the situation calls for a split interface: One to satisfy the
numericists / scientific IEEE users, and one to satisfy performance.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


[Haskell-cafe] Re: GPL answers from the SFLC

2010-03-05 Thread Achim Schneider
Stefan Monnier monn...@iro.umontreal.ca wrote:

  Note that this is a safety measure for the submitter: If the code
  is, indeed, released to the public, it is (dual licesed) GPL,
  anyway, even if that might not have been the intent.
 
 No.  If the submitter did not explicitly release his code under the
 GPL, then it is not licensed under the GPL, even if is a derivative of
 GPL code.  Instead, it is a breach of the GPL license and the
 submitter is exposing himself to a civil suit.
 
...I think for the majority of non-commercial developers (and even a
lot of companies), the net result is the same.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


[Haskell-cafe] Re: Benchmarking and Garbage Collection

2010-03-05 Thread Neil Brown

Simon Marlow wrote:

import Control.Concurrent
import Control.Concurrent.CML
import Control.Monad

main :: IO ()
main = do let numChoices = 2
cs - replicateM numChoices channel
mapM_ forkIO [replicateM_ (10 `div` numChoices) $ sync $ transmit 
c () | c - cs]

replicateM_ 10 $ sync $ choose [receive c (const True) | c - cs]


Good grief.  Can I get a copy of this program?  It might be something 
simple that we can fix.  Just having lots of threads shouldn't be a 
performance problem per se, we have benchmarks that create millions of 
threads without any problems.
That's all the code you need, along with the cml package from Hackage.  
Put the above few lines into GoodGrief.hs (the reply has munged the 
indentation slightly), and do:


cabal install cml
ghc --make -threaded GoodGrief.hs
./GoodGrief +RTS -s

That got me the listed results on GHC 6.12.1  (I did use -threaded but 
not -N as I was on a single-core machine; I believe the same problem 
occurs without -threaded).  The problem is in the CML library that the 
above code uses.


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


[Haskell-cafe] Re: A few ideas about FRP and arbitrary access in time

2010-03-05 Thread Patai Gergely
 I'm not sure I want to follow WWRD all the way. I do want events, for
 example mouse clicks (for which there doesn't seem to be any logical
 behavior representation). As you note the pull-based approach does a
 lot more work in those cases than seems necessary.
Events are indispensable for practically all applications, even those
that have continuous output, so leaving them out would be no option. I
only did so for Elerea to be able to quickly get a working system
running, so I can actually experiment with application-side design. But
yeah, it can't be used for serious purposes without some support for
events.

 In any case, what I'm discussing in that report is mostly centered on
 the continuous-time values, so I'm more concerned with what we call
 behaviors. The question is how to model memory-full operations with
 point-wise operations.
I think it would help if you tried to solve more specific problems first
and see what common structure you can factor out from the solutions.
It's easy to get into a dead end if you go for the big picture right
away.

 Right. You'll agree that it would be nice to have a general approach?
 How will that work? That's what I'd like to find out.
And I do hope you'll manage to find a useful result. My intuition says,
however, that looking for a sensible interface between events and
behaviours is more fruitful than trying to unify these two notions. The
reason is the difference in TCMs, as noted previously.

 report. I'd like things to be unified, so maybe playing with the idea
 of a total function to 'Maybe a' for events is the right direction. I
 think this was already explored by some FRP incarnations, but I don't
 recall what came out of it.
Yes, that's the Yampa way. The problem is that in this case you'll need
an awkward operator to refer to 'the time of last defined point'.

 But isn't Lucid Synchrone essentially discrete-timed? Also, events
 shouldn't be semantically constrained to multiples of some basic
 clock, they are defined over continuous time.
Of course, it's more like a possible model for operational semantics (I
know you're interested in denotation, but inspiration can come from
anywhere). I just thought that clock calculus might be an interesting
topic to throw into the hat.

Gergely

-- 
http://www.fastmail.fm - Email service worth paying for. Try it for free

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


Re: [Haskell-cafe] Re: Books for advanced Haskell

2010-03-05 Thread Stephen Tetley
2010/3/5 Günther Schmidt gue.schm...@web.de:

 When you say that you use monads to the left and right, do you mean using
 pre-defined monad instances, or do you construct your own, ie. define
 something to be an instance of a monad and then write codes using that
 instance?

Hi Günther


One view of Monads (in the context of Haskell) is that they provide effects:

 - State Monad - state

 - Maybe monad - partiality (answer or failure)

 - Error monad - partiality with some answer type for the failure
(variation of Maybe)

 - Environment monad aka Reader - read only access to context

 - Writer monad - tracing - write only access to context

 - List monad - non-determinism

 - Resumption monad - interleaving for (simulating) concurrency


Because a monad (in the context of Haskell) is an implementation of
the Monad type class and the obligation to satisfy the monad laws,
there are quite few 'variations on a theme' monads  e.g.:

Jerzy Karczmarczuk's time travel State Monad
http://users.info.unicaen.fr/~karczma/arpap/revpearl.pdf

Ralf Hinze's - partial CPS monad Typed Quote/Antiquote
-- paper currently off-line unfortunately

The codensity monad - variation on the CPS monad
http://www.cs.nott.ac.uk/~gmh/wrapper2.pdf

Plus unique but currently rare monads, e.g:

Probability
http://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf


These latter monads still represent effects, and one should be able to
define them as transformers (I think, I haven't actually tried), but
they less common presumably because people have found less need for
the effects they provide.

There are also monads where I'd struggle to claim any analogous
'effect' (maybe they have one and I don't understand the presentation,
or maybe they don't actually have one) - generally these monads don't
seem to have escaped from the mathematical world to the Haskell world.

E.g. the monad of locales, power locales
http://www.cs.bham.ac.uk/~mhe/papers/pinjective.pdf


To work with monads in Haskell its not ignoble simple to decide what
effect or combination of effects you want and use the relevant monad
(for a single effect) or build a transformer (for multiple effects).

Best wishes

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


[Haskell-cafe] Re: GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Achim Schneider
David Leimbach leim...@gmail.com wrote:

 Yes the author can privately license code to himself under any
 license he wants, but when he distributes code based on GPL'd code,
 it has to be GPL'd. That's why people hate this license, or love this
 license.  For all the freedom it talks about it's awfully restrictive.

It has to be lincensed under GPL, but GPL doesn't have to be the only
license.

Consider, for example, releasing an app that depends on readline (GPL)
under GPL/BSD: People may use+distribute it under GPL, they may hack it
to remove the readline dependency and use and distribute it under
either GPL, BSD, or both, or someone could come along and re-implement
readline (guess what has happened) and everybody will be able to choose
between GPL, BSD, or both, again.

The GPL is viral, but it doesn't (and can't) prevent you from releasing
_your_ code under -- additionally -- any bleeding license you wish[1].

It could also be argued that, as BSD explicitely allows re-lincensing,
that any grant of a BSD-license implies a dual-license under GPL, as
everyone and everybody can just re-license the code as such. BSD also
does not claim that the lincensed code is not allowed to be used under
GPL, and it does not guarantee FITNESS FOR ANY PURPOSE, which includes,
but is not limited to, being distributable under violation of GPL.

This, admittedly, isn't a bullet-proof argument. I'd be surpised,
though, if any court would see _intent_ of closing up GPL'ed code if
you release it under terms _that allow, but not by themselves enforce,_
GPL distribution.

However, (apart from IANAL and whether or not above argument holds), not
mentioning that your code depends on GPL and thus can't be distributed
in violation of it is clearly a mean, aweful breach of the principle of
least surprise and is therefore to be fought with any static means we
have at our disposal:

% cabal sdist
foo.cabal: Error: Depends on a GPL library but only mentions BSD3
as license. Either change License: to include GPL or remove the
offending dependency.

Please, please don't make this a mere warning. It's easy and
painless enough to fix and will result in way less confusion about what
terms some random piece of hackage code can be used under.


[1] I strongly advice dual-licensing any BSD code under the Beer
License, regardless of GPL involvement.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


Re: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-05 Thread Ozgur Akgun
Does this release include a new Haskell Platform for Snow Leopard as well?

Best,

On 4 March 2010 18:30, Don Stewart d...@galois.com wrote:

 bugfact:
  Using GHC 6.12.1 on Windows currently is hard, since one must compile
  the latest version of cabal-install, which is a nightmare to do for a
  typical windows user (install mingw, msys, utils like wget, download
  correct package from hackage, compile them in correct order, etc etc)
 
  What's the status of the Haskell platform for the latest and greatest
  Glasgow Haskell Compiler?

 We've just entered the release phase,

http://trac.haskell.org/haskell-platform/wiki/ReleaseTimetable

 And you can expect 2010.2 during ZuriHac.

 Thanks for checking in!

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




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


[Haskell-cafe] Re: Benchmarking and Garbage Collection

2010-03-05 Thread Simon Marlow

On 05/03/2010 13:45, Neil Brown wrote:

Simon Marlow wrote:

import Control.Concurrent
import Control.Concurrent.CML
import Control.Monad

main :: IO ()
main = do let numChoices = 2
cs - replicateM numChoices channel
mapM_ forkIO [replicateM_ (10 `div` numChoices) $ sync $ transmit
c () | c - cs]
replicateM_ 10 $ sync $ choose [receive c (const True) | c - cs]


Good grief. Can I get a copy of this program? It might be something
simple that we can fix. Just having lots of threads shouldn't be a
performance problem per se, we have benchmarks that create millions of
threads without any problems.

That's all the code you need, along with the cml package from Hackage.
Put the above few lines into GoodGrief.hs (the reply has munged the
indentation slightly), and do:

cabal install cml
ghc --make -threaded GoodGrief.hs
./GoodGrief +RTS -s

That got me the listed results on GHC 6.12.1 (I did use -threaded but
not -N as I was on a single-core machine; I believe the same problem
occurs without -threaded). The problem is in the CML library that the
above code uses.


Yes, I see what the problem is.  Removing a thread from the queue 
attached to an MVar is a O(n) operation, and in this case you have 
thousands of threads attached to MVars and the system wants to clean 
them all up before exiting, hence things go O(n^2).  Threads only need 
to be removed from the queue when


 - they are the target of throwTo from another thread

 - the system is shutting down, and deleting threads

 - the thread is unreachable and needs to be woken up to be sent
   the BlockedIndefinitelyOnMVar exception (this is probably why
   you sometimes get the 60s GC just after your benchmark has
   finished, but before shutdown).

So as it happens Simon PJ and I were discussing some changes yesterday 
that will eventually make removing a thread from a queue an O(1) 
operation.  Hopefully 6.14.1 will be better in this regard.


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


[Haskell-cafe] Hackage vs. legacy support in Cabal files

2010-03-05 Thread John D. Ramsdell
I'd like to support Hackage and GHC 6.8 with one source distribution.
The enclosed Cabal file would do the trick if Hackage would simply
evaluate the Cabal file using the default flag values.  Instead, it
chokes on a hack required to support GHC 6.8.  The directory
containing the autogen files has to be on the source path.

  if flag(old)
Hs-Source-Dirs: src dist/build/autogen
  else
Hs-Source-Dirs: src

Is there a way to force Hackage to respect flag values?

John


cpsa.cabal
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Anyone up for Google SoC 2010?

2010-03-05 Thread iquiw
On Fri, Mar 5, 2010 at 4:07 PM, Johan Tibell johan.tib...@gmail.com wrote:
 I think I would use the module system for namespacing rather than using
 function prefixes. Like so:
 import Text.Html as E
 import qualified Text.Html.Attribute as A
 E.html ! [A.class_ my-class] (... more combinators ...)

 (Assuming that ! is used to introduce attributes.)
 This allows you to use the element names and/or the attribute names
 unclassified if you so desire.
 html ! [class_ my-class] (... more combinators ...)

 Function names in the 'html' library are unpredictable from
 corresponding element/attribute names...
  (head, base, a = header, thebase, anchor)

 I'm of the same opinion. The combinators should match the element/attribute
 names as far as possible. The rule that I had in mind was that the
 combinators should have exactly the same name as the corresponding
 element/tag except when the name collides with a keyword (e.g. class). If
 the name collides with a keyword we could e.g. always append a _.

That's fine.
However, I think no one uses unqualified import actually because of
conflict with basic functions (head, id, map) and existent of
single character functions (a, b, i, p).

Anyway, I like the project.

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


[Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-05 Thread Achim Schneider
Johan Tibell johan.tib...@gmail.com wrote:

 = A high-performance HTML combinator library using Data.Text =


May I add

* Conceptual compatiblity with the W3C DOM. The library shoud be
  designed in a way that allows a thin / automatically generated
  wrapping layer to support DOM operations, where applicable.

?

It is a keep that in mind, not absolute, requirement.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


[Haskell-cafe] Re: GPL answers from the SFLC

2010-03-05 Thread Achim Schneider
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:

 For example, see the license for cpphs [1]; on Hackage it's listed as
 LGPL whereas the library is LGPL and the program is GPL.

Output from GPL programs is licensed under whatever license its input
is licensed under (that is, the GPL doesn't say anything and forbids
additional usage restrictions), I think the most prominent example is
gcc, which you may use to develop closed-source programs.

It's common to see programs under GPL and standard library code that is
included by default under less restrictive licenses: If GHC was GPL,
chances would be high that the RTS, itself, would still be licensed
under BSD or similar. Doing otherwise just invites either forks or a
community that is completely lacking any commercial members, both of
which are usually not intended, at all.

...but that doesn't answer why cpphs is GPL/LGPL (as it does not
inject any standard library code into its output[1]). I think it's the
usual reason: The author generally wants GPL, but doesn't mind if anyone
develops another program that does something the library part can be
used for.

[1] At least in Germany, there's no way in hell you could claim
copyright on injected {-# LINE #-} pragmas (Schaffungshoehe). I
will pity you if that's possible under your legislation

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


Re: [Haskell-cafe] Re: New OpenGL package: efficient way to convert datatypes?

2010-03-05 Thread Nick Bowler
On 14:30 Fri 05 Mar , Achim Schneider wrote:
 Nick Bowler nbow...@elliptictech.com wrote:
  I meant to say that fromRational . toRational is not appropriate for
  converting values from one floating point type to another floating
  point type.
 
 It gets even worse: My GPU doesn't know about doubles and its floats
 aren't IEEE, at all (not that Haskell Doubles are guaranteed to be IEEE
 iirc)

AFAIK, GLDouble is a newtype wrapper around CDouble, though, and doesn't
correspond to a GPU-internal type.  Even if it did, if we are converting
to a type that doesn't support infinities, then is is reasonable for the
conversion to not support them, either.  I'd want to see a call to error
in this case, but perhaps allowing unsafe optimisations (see below).

 I think the situation calls for a split interface: One to satisfy the
 numericists / scientific IEEE users, and one to satisfy performance.

I think this is a job for the compiler rather than the interface.  For
example, GCC has -ffinite-math-only, -fno-signed-zeros, etc., which
allow the compiler to make assumptions about the program that would not
normally be valid.

Nevertheless, for the issue at hand (Double=CDouble=GLDouble), there
is a conversion interface that should satisfy everyone (both fast and
correct): the one that compiles to nothing at all.

-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Books for advanced Haskell

2010-03-05 Thread Heinrich Apfelmus
Stephen Tetley wrote:

 To work with monads in Haskell its not ignoble simple to decide what
 effect or combination of effects you want and use the relevant monad
 (for a single effect) or build a transformer (for multiple effects).

... or use the free term algebra approach outlined in

  http://apfelmus.nfshost.com/articles/operational-monad.html

when the semantics of the effects are a bit tricky to fit into existing
transformers. My package operational

  http://projects.haskell.org/operational/

contains a bunch of examples.


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] How to put data from a string to a tuple

2010-03-05 Thread Pradeep Wickramanayake
As luke requested

 

Here is the codes and some more brief explanation. Please help me

 

 getItemFile :: IO String

 getItemFile  = 

 do

 test - readFile
input.txt

 return test

 

im taking a file data to a string 

 

it contains string like hello,world,I,am,a,new,developer

 

so I need to put these each to a tuple. Because the content have Integers
and Strings

 

sortList2 :: String - String

sortList2 (x:xs) 

| x == ',' = 

| otherwise = [x] ++ sortList2 xs

 

Im breaking word by word from this above function

 

Now I need to send it to a tuple. Can someone help me how to do it. Is this
possible. Using recursion im checking each word till , occurs

And taking that string and passing it to the tuple. 

 

Can someone please help me to do it. 

 

Please 

 

 

 

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


Re: [Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-05 Thread Johan Tibell
On Fri, Mar 5, 2010 at 3:46 PM, Achim Schneider bars...@web.de wrote:

 Johan Tibell johan.tib...@gmail.com wrote:

  = A high-performance HTML combinator library using Data.Text =
 

 May I add

 * Conceptual compatiblity with the W3C DOM. The library shoud be
  designed in a way that allows a thin / automatically generated
  wrapping layer to support DOM operations, where applicable.

 ?

 It is a keep that in mind, not absolute, requirement.


I'm not quite sure I understand what you have in mind. Do you mean that
given a value of type Html you can e.g. query by ID to find children?

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


Re: [Haskell-cafe] vector stream fusion, inlining and compilation time

2010-03-05 Thread stefan kersten
 This is a general problem when working with RULES-based
 optimisations. Here is an example of what happens: suppose we have
 
 foo :: Vector Int - Vector Int
 foo xs = map (+1) xs
 
 Now, GHC will generate a nice tight loop for this but if in a
 different module, we have something like this:
 
 bar xs = foo (foo xs)
 
 then this won't fuse because (a) foo won't be inlined and (b) even if
 GHC did inline here, it would inline the nice tight loop which can't
 possibly fuse instead of the original map which can. By slapping an
 INLINE pragma on foo, you're telling GHC to (almost) always inline the
 function and to use the original definition for inlining, thus giving
 it a chance to fuse.

thanks for the insight, roman!

 the downside after adding the INLINE pragmas is that now some of my modules 
 take
 _really_ long to compile (up to a couple of minutes); any ideas where i can
 start looking to bring the compilation times down again?
 
 Alas, stream fusion (and fusion in general, I guess) requires what I
 would call whole loop compilation - you need to inline everything into
 loops. That tends to be slow. I don't know what your code looks like
 but you could try to control inlining a bit more. For instance, if you
 have something like this:
 
 foo ... = ... map f xs ...
   where
 f x = ...
 
 you could tell GHC not to inline f until fairly late in the game by adding
 
   {-# INLINE [0] f #-}
 
 to the where clause. This helps sometimes.

thanks, i'll check it out.

 I'm surprised -Odph doesn't produce faster code than -O2. In any
 case, you could try turning these flags on individually (esp.
 -fno-method-sharing and the spec-constr flags) to see how they affect
 performance and compilation times.

in the end it turned out that i had forgotten another INLINE pragma and in my
crude benchmarks -O2 and -Odph give basically the same results, -O2 being a
little faster. i hope i'll have time next week to do proper benchmarks, and i
also want to try ghc HEAD with the llvm patches.

conv_1  conv_2  conv_3
-Odph   1.004   2.715   1.096
-O2 1.000   2.710   1.097

i'm still curious, though, why my three versions of direct convolution perform
so differently (see attached file). in particular, i somehow expected conv_3 to
be the slowest and conv_2 to perform similar to conv_1. any ideas? i haven't had
a look at the core yet, mainly because i'm lacking the expertise ...

sk
import   Data.Vector.Generic (Vector, (!))
import qualified Data.Vector.Generic as V

conv_1, conv_2, conv_3 :: (Num a, Vector v a) = v a - v a - v a
{-# INLINE conv_1 #-}
conv_1 h x = V.generate (l+m) f
where
m = V.length h - 1
l = V.length x
{-# INLINE f #-}
f n = g 0 n (max 0 (n-l+1)) (min n m)
g y n m k = if m = k
then let y' = y + (h ! m) * (x ! (n-m))
 in y' `seq` g y' n (m+1) k
else y
{-# INLINE conv_2 #-}
conv_2 h x = V.generate (l+m) f
where
l = V.length x
m = V.length h - 1
{-# INLINE f #-}
f n = let j = max 0 (n-l+1)
  k = (min n m) - j + 1
  in V.sum (V.zipWith (*) (V.slice j k h) (V.reverse (V.slice (n - 
j - k + 1) k x)))
{-# INLINE conv_3 #-}
conv_3 h x = V.generate (l+m-1) f
where
m   = V.length h
l   = V.length x
p   = V.replicate (m-1) 0
x'  = p ++ x ++ p
{-# INLINE f #-}
f i = V.sum (V.zipWith (*) (V.reverse h) (V.slice i m x'))
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-05 Thread Gregory Collins
Ozgur Akgun ozgurak...@gmail.com writes:

 Does this release include a new Haskell Platform for Snow Leopard as
 well?

It should, yes.

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: Anyone up for Google SoC 2010?

2010-03-05 Thread Achim Schneider
Johan Tibell johan.tib...@gmail.com wrote:

 On Fri, Mar 5, 2010 at 3:46 PM, Achim Schneider bars...@web.de
 wrote:
 
  Johan Tibell johan.tib...@gmail.com wrote:
 
   = A high-performance HTML combinator library using Data.Text =
  
 
  May I add
 
  * Conceptual compatiblity with the W3C DOM. The library shoud be
   designed in a way that allows a thin / automatically generated
   wrapping layer to support DOM operations, where applicable.
 
  ?
 
  It is a keep that in mind, not absolute, requirement.
 
 
 I'm not quite sure I understand what you have in mind. Do you mean
 that given a value of type Html you can e.g. query by ID to find
 children?
 
The overall idea is that if we chose to write a browser in Haskell,
which will come with an ECMAscript implementation in Haskell, it'd be
nice if that HTML library could be developed into something that can be
used as internal DOM representation (and messed with from the
ECMAscript side) without breaking the already existing Haskell
interface.

Also, web developers that know DOM inside out shouldn't be alienated by
Haskell doing things in a way that isn't compatible with their
intuition about how DOM/HTML works.

That is, the library should show potential to be queryable (with some
generics library) with the same semantics as DOM, meaning that the
information necessary to do that should be present.

...I don't mean that the library as implemented for the SoC must
support such queries, but that e.g. a (to be written) library with the
same haskell combinators that spews out an ADT instead of a string
should be.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


Re: [Haskell-cafe] How to put data from a string to a tuple

2010-03-05 Thread Ozgur Akgun
Let's first discuss what a tuple is.
Here[1] it says, A tuple is a fixed-size collection of values, where each
value can have a different type.

So they are of fixed-size and they can have values of different types. I am
guessing the reason you want to use a tuple os that you want your collection
object to be able to handle different types. But what about the fixed size
bit?

If you want to just have those values in a collection, the easiest thing you
can do is putting them into a list. The problem with lists is that the
elements in them need to be of same type. If you just want every word, as a
string, it is easy. If you want to have _either strings or ints_ within the
list, then you need to define a data type which holds either strings or
ints, and have a list of this type.

Just an example,

import Data.Char(isDigit)

testString = hello world 13 i am a new 37 developer 82

data StringOrInt = S String | I Int
deriving (Eq,Ord,Show)

readInt :: String - Int
readInt = read

toStringOrInt :: String - StringOrInt
toStringOrInt x
| all isDigit x = I (readInt x)
| otherwise = S x


test = map toStringOrInt (words testString)

-- Output: [S hello,S world,I 13,S i,S am,S a,S new,I 37,S
developer,I 82]



Note: I changed the separator from commas to spaces, for the sake of
easiness and understandablity. Hope this helps in some way.


[1] http://book.realworldhaskell.org/read/types-and-functions.html

On 5 March 2010 15:52, Pradeep Wickramanayake prad...@talk.lk wrote:

  As luke requested



 Here is the codes and some more brief explanation. Please help me



  getItemFile :: IO String

  getItemFile  =

  do

  test - readFile
 input.txt

  return test



 im taking a file data to a string



 it contains string like “hello,world,I,am,a,new,developer”



 so I need to put these each to a tuple. Because the content have Integers
 and Strings



 sortList2 :: String - String

 sortList2 (x:xs)

 | x == ',' = 

 | otherwise = [x] ++ sortList2 xs



 Im breaking word by word from this above function



 Now I need to send it to a tuple. Can someone help me how to do it. Is this
 possible. Using recursion im checking each word till “,” occurs

 And taking that string and passing it to the tuple.



 Can someone please help me to do it.



 Please








 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 4918 (20100305) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com

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




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


Re: [Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-05 Thread Thomas Schilling
If it uses only one type for elements and perhaps another for
attributes, Uniplate should fit any traversal needs perfectly.  E.g.,
getElementByID:

  listToMaybe [ e | e - universe doc, elemID e == target_id ]

or similar.  This is doing essentially a depth-first search, so if
this is a common operation, you'd need some further optimisation, but
then I'm not convinced raw HTML is a good internal representation
anyway.

On 5 March 2010 16:20, Achim Schneider bars...@web.de wrote:
 Johan Tibell johan.tib...@gmail.com wrote:

 On Fri, Mar 5, 2010 at 3:46 PM, Achim Schneider bars...@web.de
 wrote:

  Johan Tibell johan.tib...@gmail.com wrote:
 
   = A high-performance HTML combinator library using Data.Text =
  
 
  May I add
 
  * Conceptual compatiblity with the W3C DOM. The library shoud be
   designed in a way that allows a thin / automatically generated
   wrapping layer to support DOM operations, where applicable.
 
  ?
 
  It is a keep that in mind, not absolute, requirement.
 

 I'm not quite sure I understand what you have in mind. Do you mean
 that given a value of type Html you can e.g. query by ID to find
 children?

 The overall idea is that if we chose to write a browser in Haskell,
 which will come with an ECMAscript implementation in Haskell, it'd be
 nice if that HTML library could be developed into something that can be
 used as internal DOM representation (and messed with from the
 ECMAscript side) without breaking the already existing Haskell
 interface.

 Also, web developers that know DOM inside out shouldn't be alienated by
 Haskell doing things in a way that isn't compatible with their
 intuition about how DOM/HTML works.

 That is, the library should show potential to be queryable (with some
 generics library) with the same semantics as DOM, meaning that the
 information necessary to do that should be present.

 ...I don't mean that the library as implemented for the SoC must
 support such queries, but that e.g. a (to be written) library with the
 same haskell combinators that spews out an ADT instead of a string
 should be.

 --
 (c) this sig last receiving data processing entity. Inspect headers
 for copyright history. All rights reserved. Copying, hiring, renting,
 performance and/or quoting of this signature prohibited.


 ___
 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] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Robert Greayer
Pending an explicit response from the SFLC, I decided to ask the FSF
themselves what they thought of the Hackage/cabal situation.
Specifically, I asked this:

 There is a website, 'Hackage' (http://hackage.haskell.org) that hosts
 source code packages for Haskell libraries and programs.  The site
 hosts *only* source code, along with (text) descriptions of the
 packages.  Each package hosted by the site is either source code for a
 library, for a program, or for both.

 In the package description, a package author specifies what license
 applies to the source code, the common choices being LGPL, GPL, or
 BSD3.  The package author also specifies what other packages in the
 repository the package may require to compile successfully.

 The controversy in the community of users who use Hackage is whether
 or not it is a violation of the GPL for a package to be uploaded to
 Hackage specifying (for example) a BSD3 license for the code in the
 package, but also specifying that another package is a requirement for
 compilation, where that other package has been uploaded specifying (a
 version of) the GPL as its license.

 The opinion of many in the community is that since Hackage hosts only
 source code, and does not in any way combine packages (any combination
 of packages is created when a user chooses to download and compile and
 link the individual packages) there is no problem: there are no
 'derived works' combining GPL and non-GPL being distributed on the
 site.

 Others believe that having a non-GPL package have as a dependency a
 GPL package is a problem for both the package author and for Hackage;
 that this in some way violates the GPL.

 I don't believe this sort of situation is clearly addressed in your
 FAQ (at least not to the satisfaction of the Hackage user community).
 There's a certain amount of fear, uncertainty and doubt being spread
 about usage of the GPL on Hackage, which it would be great to dispel
 (or, confirm, as necessary).


Someone from the FSF responded as follows:

 A work which extends or requires a GPL work will generally also need to
 be released under the GPL, unless the GPL work provides a specific
 exception for that case. You are already familiar with the FAQ; however,
 please note http://www.fsf.org/licensing/licenses/gpl-faq.html#OOPLang
 and http://www.fsf.org/licensing/licenses/gpl-faq.html#MereAggregation .
 There is no magic to the act of linking, compiling, or a function
 invocation; these are not defining moments. It is the level of
 integration and dependency which will define whether one work is a
 derivative of another.

 Ultimately, the decision that one work is a derivative of another is a
 legal one which a court may have to decide for a particular case; a
 lawyer can give you a legal opinion. However, a good rule of thumb would
 be: if P is a GPL work, and Q is a work that would not function without
 P, then Q is probably a derivative of P and should only be conveyed to a
 third party or the public under a GPL license, in compliance with the
 license for P.

 I hope that helps.

 Thank you for your interest in free software!
 I am not a lawyer and the above is not legal advice.
 The opinions expressed above do not constitute an official position of
 the Free
 Software Foundation.

 Luigi Bai
 FSF Associate Member
 Volunteer, licens...@gnu.org

Of course, given the disclaimer at the bottom, this opinion is officially no
better than any of our opinions on the matter.  Nevertheless, I would at
least believe based on the above that this is what the FSF *wants* the GPL
to mean, and, by extension, would assume, barring other evidence that
this is what someone who chooses the GPL *wants* it to mean, and in
licensing any software that I write that depends on someone else's GPL'd
software, I'd respect those desires (without at all suggesting that this has
any bearing on how the GPL would actually be interpreted in court).

There's still a lot of gray area here -- the mere existence of a dependency
doesn't imply that a software package is useless without the dependency,
so there are many situations in which P could depend on Q and not be
a derivative of Q, because the dependency can be disabled in some way
and the software would still function.  As an example -- pandoc can be
built with or without highlighting-kate, and is useful either way.  They're both
GPL and by the same author, so there's no issue, but were that not the
case it would seem obvious that pandoc isn't derivative of -kate, and
thus could (by this reasoning) be released independently under different
terms.  The same may not be true of the hakyll / pandoc situation which
sparked this controversy.

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


[Haskell-cafe] Re: GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Tom Tobin
On Thu, Mar 4, 2010 at 11:34 AM, Tom Tobin korp...@korpios.com wrote:
 After politely pestering them again, I finally heard back from the
 Software Freedom Law Center regarding our GPL questions (quoted
 below).

 I exchanged several emails to clarify the particular issues; in short,
 the answers are No, No, N/A, and N/A.  The SFLC holds that a
 library that depends on a GPL'd library must in turn be GPL'd, even if
 the library is only distributed as source and not in binary form.
 They offered to draft some sort of explicit response if we'd find it
 useful.

Several people expressed interest in a more explicit and official
response from the SFLC, so I'm going to ask them if it would be
possible to receive one that the Haskell community could use to help
us resolve GPL licensing questions.  I'll follow up again once I
receive that.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Job Vranish
This seems really confusing.

It would imply that if I write a library that is designed to talk to some
part of the linux kernel API (which is GPL'd) then I'd have to release my
library under the GPL. And anything that used my libraries API would need to
be GPL'd too, etc...
Which would mean that everything run in linux would need to be GPL'd, which
is just silly.

- Job

On Fri, Mar 5, 2010 at 12:22 PM, Robert Greayer robgrea...@gmail.comwrote:

 Pending an explicit response from the SFLC, I decided to ask the FSF
 themselves what they thought of the Hackage/cabal situation.
 Specifically, I asked this:

  There is a website, 'Hackage' (http://hackage.haskell.org) that hosts
  source code packages for Haskell libraries and programs.  The site
  hosts *only* source code, along with (text) descriptions of the
  packages.  Each package hosted by the site is either source code for a
  library, for a program, or for both.

  In the package description, a package author specifies what license
  applies to the source code, the common choices being LGPL, GPL, or
  BSD3.  The package author also specifies what other packages in the
  repository the package may require to compile successfully.

  The controversy in the community of users who use Hackage is whether
  or not it is a violation of the GPL for a package to be uploaded to
  Hackage specifying (for example) a BSD3 license for the code in the
  package, but also specifying that another package is a requirement for
  compilation, where that other package has been uploaded specifying (a
  version of) the GPL as its license.

  The opinion of many in the community is that since Hackage hosts only
  source code, and does not in any way combine packages (any combination
  of packages is created when a user chooses to download and compile and
  link the individual packages) there is no problem: there are no
  'derived works' combining GPL and non-GPL being distributed on the
  site.

  Others believe that having a non-GPL package have as a dependency a
  GPL package is a problem for both the package author and for Hackage;
  that this in some way violates the GPL.

  I don't believe this sort of situation is clearly addressed in your
  FAQ (at least not to the satisfaction of the Hackage user community).
  There's a certain amount of fear, uncertainty and doubt being spread
  about usage of the GPL on Hackage, which it would be great to dispel
  (or, confirm, as necessary).


 Someone from the FSF responded as follows:

  A work which extends or requires a GPL work will generally also need to
  be released under the GPL, unless the GPL work provides a specific
  exception for that case. You are already familiar with the FAQ; however,
  please note http://www.fsf.org/licensing/licenses/gpl-faq.html#OOPLang
  and http://www.fsf.org/licensing/licenses/gpl-faq.html#MereAggregation .
  There is no magic to the act of linking, compiling, or a function
  invocation; these are not defining moments. It is the level of
  integration and dependency which will define whether one work is a
  derivative of another.

  Ultimately, the decision that one work is a derivative of another is a
  legal one which a court may have to decide for a particular case; a
  lawyer can give you a legal opinion. However, a good rule of thumb would
  be: if P is a GPL work, and Q is a work that would not function without
  P, then Q is probably a derivative of P and should only be conveyed to a
  third party or the public under a GPL license, in compliance with the
  license for P.

  I hope that helps.

  Thank you for your interest in free software!
  I am not a lawyer and the above is not legal advice.
  The opinions expressed above do not constitute an official position of
  the Free
  Software Foundation.

  Luigi Bai
  FSF Associate Member
  Volunteer, licens...@gnu.org

 Of course, given the disclaimer at the bottom, this opinion is officially
 no
 better than any of our opinions on the matter.  Nevertheless, I would at
 least believe based on the above that this is what the FSF *wants* the GPL
 to mean, and, by extension, would assume, barring other evidence that
 this is what someone who chooses the GPL *wants* it to mean, and in
 licensing any software that I write that depends on someone else's GPL'd
 software, I'd respect those desires (without at all suggesting that this
 has
 any bearing on how the GPL would actually be interpreted in court).

 There's still a lot of gray area here -- the mere existence of a dependency
 doesn't imply that a software package is useless without the dependency,
 so there are many situations in which P could depend on Q and not be
 a derivative of Q, because the dependency can be disabled in some way
 and the software would still function.  As an example -- pandoc can be
 built with or without highlighting-kate, and is useful either way.  They're
 both
 GPL and by the same author, so there's no issue, but were that not the
 case it would seem obvious 

Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Rafael Almeida
On Fri, Mar 5, 2010 at 2:59 PM, Job Vranish job.vran...@gmail.com wrote:
 This seems really confusing.

 It would imply that if I write a library that is designed to talk to some
 part of the linux kernel API (which is GPL'd) then I'd have to release my
 library under the GPL. And anything that used my libraries API would need to
 be GPL'd too, etc...
 Which would mean that everything run in linux would need to be GPL'd, which
 is just silly.

Linux license specifically single that case out of the license
restrictions. From the COPYING file in linux's source:

   NOTE! This copyright does *not* cover user programs that use kernel
 services by normal system calls - this is merely considered normal use
 of the kernel, and does *not* fall under the heading of derived work.
 Also note that the GPL below is copyrighted by the Free Software
 Foundation, but the instance of code that it refers to (the Linux
 kernel) is copyrighted by me and others who actually wrote it.

 Also note that the only valid version of the GPL as far as the kernel
 is concerned is _this_ particular version of the license (ie v2, not
 v2.2 or v3.x or whatever), unless explicitly otherwise stated.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread John Meacham
On Fri, Mar 05, 2010 at 12:29:15PM +, Malcolm Wallace wrote:
 Background: X is a library distributed under the terms of the GPL. Y 
 is another library which calls external functions in the API of X, 
 and requires X to compile.  X and Y have different authors.

 1) Can the author of Y legally distribute the *source* of Y under a  
 non-GPL license, such as the 3-clause BSD license or the MIT license?

 I believe the answer you got from SFLC (no) contradicts what the  
 authors of the GPL say about this case.  viz:

 http://www.gnu.org/licenses/gpl-faq.html#LinkingWithGPL


Yes, to my knowledge what the SFLC said is also incorrect. Perhaps they
just erred on the side of 'just GPL it'. In any case, I wouldn't want
cabal/hackage to worry about such things for random uploaded packages,
it can't know if the GPL licenses have special exceptions or whatnot.
Unless of course someone where to write a formal combinator
language for expressing legal contracts.. :).

John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Simon Michael

Hi Kevin,

I just wanted to say that's a very nice analogy. Thanks!

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


Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Matthias Kilian
Hi,

On Fri, Mar 05, 2010 at 01:16:18AM +0300, Bulat Ziganshin wrote:
  [...] The SFLC holds that a
  library that depends on a GPL'd library must in turn be GPL'd, even if
  the library is only distributed as source and not in binary form.
 
  Was this a general statement
 
 yes. it's soul of GPL idea, and it's why BG called GPL a virus :)

Oh, BSD3 or ISC licensed code is viral as well, but only on the
source code level ;-)

(if you redistribute the sources, you have to leave the license and
the copyright marker intact)

Anyway, I really think the SFLC people are telling lies here (or,
as someone else wrote in this thread, are telling what they whish
the GPL to imply).

Applying some common sense tells me: If you write some code (library
or program) that depends on  some GPL licensed library, you can
still redistribute your *source code* under whatever license you
want, as long as your source code distribution does not contain
copies (original or modified) from the GPL'd stuff it depends on.

For binary products created from such a library combo, you have to
apply the GPL, which should be fine if *your* code is BSD3 or ISC
or something similar. But nobody can force you to apply a specific
license to your *source code*, even if the binary (links against/calls
functions provided by) a GPL'd library.

Oh, and for the discussion about wether APIs may be license-worth, which
also popped up in this thread;

/*
 * Copyright (c) 2010 Matthias Kilian k...@outback.escape.de
 *
 * All rights reserverd.
 */
extern int foo(double bar);

If you ever dare to write some C function `foo' that takes a double and
returns an int, I'll sue you to death ;-)

Yes, there are APIs more inventive than that example above, but
they're just *interfaces*. There has to be a lot of brain used on
some interface to make it a creative work. (Oh, monads jump to mind)

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


Re: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-05 Thread Thomas Schilling
GHC 6.12 changed the format of the internal package database.  Only
cabal-install 0.8 can read this format properly.  Version 0.8 is only
available on Hackage, the binaries available are cabal-install 0.6.2.
I assume part of the platform release effort is to create new
cabal-install binaries.

On 4 March 2010 18:41, Andrew Coppin andrewcop...@btinternet.com wrote:
 Peter Verswyvelen wrote:

 Using GHC 6.12.1 on Windows currently is hard, since one must compile
 the latest version of cabal-install, which is a nightmare to do for a
 typical windows user

 Out of curiosity, why do you need to compile the latest version of
 cabal-install? Why can't you use the precompiled one?

 ___
 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] How to obtain unique integers

2010-03-05 Thread Thomas Schilling
The value-supply package [1] provides means to generate unique values
of any kind.  It uses IORefs under the hood, but provides a pure
interface for it (an infinite tree).  Because of this, you need to be
a bit careful how you construct your supply when using multiple
threads.  The same techniques are used in GHC as well (for better or
worse.)

Note that the IDs you get are essentially non-deterministic -- they
rely on evaluation order.

I'm not sure why you need these uniques in the Show instances, though.
 Can't you just store the IDs with your data?

[1]: http://hackage.haskell.org/package/value-supply

On 5 March 2010 12:14, Robert Rothenberg rob...@gmail.com wrote:
 I'm implementing a variant of Prolog in Haskell (yes, I know others
 already exist...) and am looking to solve the following issues:

 (1) I need to translate anonymous variables _ into unique variable
 names.  Data.Unique does not give me a printable identifier. Is there
 another package that does this?

 (2) Is there a cabal package similar to the Atom.hs module form ginsu,
 that associates strings with unique hashes?

 The alternative of course is to maintain state variables and pass them
 along to display and parsing functions, but that makes it difficult to
 make the terms instances of Read/Show without reference to a global
 variable anyhow.

 Thanks,
 Rob
 ___
 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] Re: Gut Build System

2010-03-05 Thread Achim Schneider
Matthias Kilian k...@outback.escape.de wrote:

 On Fri, Mar 05, 2010 at 09:26:08PM +, Simon Marlow wrote:
  Switching GHC to a completely new build system written completely
  in Haskell would be the most stupid idea ever. (You know why)
  
  You're referring to bootstrapping, I presume?
 
 Yes.
 
As it stands, GHC can't be bootstrapped without a GHC, anyway. I'd love
to see GHC bootstrapping from C, e.g. via hugs, though. (A man is
allowed to dream)

  I did think about mentioning that.  Of course any Haskell build
  system would have to support cross-compilation or some other
  bootstrapping method, e.g.  generation of a build script.
 
 That's a noble goal. But it has to be kept in mind.
 
This may be fairly easy, if the generated script does not have to come
with major build-system capabilities: Leaving out most of dependency
analysis and support -- at the utmost -- restarting a failed build from
the rule whose source file has last recently changed, otherwise
compiling in a linear order deduced at script generation time should
reduce the problem to serializing the actions generated for a clean
build to a shell script.



I'm cross-posting this to the cafe and suggest that most if not all of
this discussion be done there as most of it doesn't specifically relate
to GHC. And there might be volunteers amidst the crowd.



That said, I'd very much like to see a make-replacement done in
Haskell, there's not only place for a properly-scriptable make, but
also sufficient room for general innovation: 

Omake[1] would be even better if it wasn't scripted in some ad-hoc,
impure, incomplete ocaml dialect but in a decently pure functional
language;

IBB[2] sound like a feature we'd definitely want to have (thanks for
the link, Thomas)

I'd also like to point to Nix[3] and Cabal[4] for ideas, and I bet most
of the dependency analysis could be ripped from the latter.


I think we can do vastly better than the whole SCons/CMake/Jam crowd.


[1] http://omake.metaprl.org/index.html
[2]http://chadaustin.me/2010/03/your-version-control-and-build-systems-dont-scale-introducing-ibb/
[3] http://nixos.org/nix/
[4] You know where.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


Re: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-05 Thread Peter Verswyvelen
Well the precompiled one provided on doesn't seem to work with GHC
6.12.1, you get an error.

So yes, it would be nice to at least update the precompiled version on
the website :-)

On Thu, Mar 4, 2010 at 7:41 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
 Peter Verswyvelen wrote:

 Using GHC 6.12.1 on Windows currently is hard, since one must compile
 the latest version of cabal-install, which is a nightmare to do for a
 typical windows user

 Out of curiosity, why do you need to compile the latest version of
 cabal-install? Why can't you use the precompiled one?

 ___
 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: Gut Build System

2010-03-05 Thread Malcolm Wallace
I'd also like to point to Nix[3] and Cabal[4] for ideas, and I bet  
most

of the dependency analysis could be ripped from the latter.


Hrrm, sadly Cabal has no dependency analysis at all - everything must  
be specified by the author of the .cabal file, both modules and  
packages.


Regards,
Malcolm

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


[Haskell-cafe] Re: Using Haskell's FFI to send ancillary data over Unix domain sockets

2010-03-05 Thread Maurí­cio CA

 For me, this presents a few problems. I don't know where to get
 the SCM_CREDENTIALS constant, I have no idea what flags to use
 (does the Network module help with that?), I don't know how to
 get from a list of file descriptors or a tuple to a Ptr, and
 perhaps most importantly, I have no idea how to get the lengths
 of pid_t, uid_t, gid_t, and socklen_t.

The basic answer is that you can use tools like hsc2hs, c2hs or
greencard.

I also wrote this package that may be of help:

  http://hackage.haskell.org/package/bindings-posix

You may want to look at the source code to see how to apply the
idea to your needs. Note that this package uses a lot of macros
I wrote myself (see package bindings-DSL), so you should not use
them if you want to stick with standard tools.

Best,

Maurício

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


Re: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-05 Thread Andrew Coppin

Thomas Schilling wrote:

GHC 6.12 changed the format of the internal package database.  Only
cabal-install 0.8 can read this format properly.  Version 0.8 is only
available on Hackage, the binaries available are cabal-install 0.6.2.
I assume part of the platform release effort is to create new
cabal-install binaries.
  


Ah, OK. Just so long as there's a reason. :-)

Is there a reason why a new precompiled binary can't be put up for download?

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


Re: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-05 Thread Ivan Lazar Miljenovic
Andrew Coppin andrewcop...@btinternet.com writes:
 Is there a reason why a new precompiled binary can't be put up for
 download?

I would assume because no-one has supplied one (Duncan doesn't use
Windows; don't know about the rest of the cabal-install developers).

-- 
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] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Wolfgang Jeltsch
Am Donnerstag, 4. März 2010 18:57:03 schrieb MightyByte:
 Interesting.  It seems to me that the only solution for the
 BSD-oriented haskell community is to practically boycott GPL'd
 libraries.  From what I understand, this is exactly what the LGPL is
 for.  I've known the basic idea behind the GPL/LGPL distinction for
 quite awhile, but I didn't realize that mistaking the two had such
 far-ranging consequences.  Since GPL seems to be the big elephant in
 the room, it seems very easy to make this mistake.  At the very least
 we should try to educate the community about this.

To my knowledge, the LGPL only allows *linking* with non-(L)GPL software. But 
GHC doesn’t just link but performs massive cross-module inlining. So in my 
opinion, LGPL is not a solution, too. Use BSD3!

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


[Haskell-cafe] Re: Gut Build System

2010-03-05 Thread Achim Schneider
Malcolm Wallace malcolm.wall...@cs.york.ac.uk wrote:

  I'd also like to point to Nix[3] and Cabal[4] for ideas, and I bet  
  most
  of the dependency analysis could be ripped from the latter.
 
 Hrrm, sadly Cabal has no dependency analysis at all - everything
 must be specified by the author of the .cabal file, both modules and  
 packages.
 
...with analysis I mean figuring out what needs to be done, with that
data as the basis. You're right, of course.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


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


Re: [Haskell-cafe] Re: Gut Build System

2010-03-05 Thread Don Stewart
malcolm.wallace:
 I'd also like to point to Nix[3] and Cabal[4] for ideas, and I bet  
 most
 of the dependency analysis could be ripped from the latter.

 Hrrm, sadly Cabal has no dependency analysis at all - everything must be 
 specified by the author of the .cabal file, both modules and packages.

I could imagine a 'cabal inspect' command that checks the .cabal file
against what the repo actually needs might be somewhat useful.

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


[Haskell-cafe] Re: GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Maurí­cio CA

 To my knowledge, the LGPL only allows *linking* with non-(L)GPL
 software. But GHC doesn't just link but performs massive
 cross-module inlining. So in my opinion, LGPL is not a solution,
 too. Use BSD3!

But that massive cross-module inlining happens at your computer,
where the rights allowed by GPL for private use applies.

So, as long as you distribute the GPL/LGPL code separate from your
BSD/proprietary code, no restrictions should apply. (I believe
this applies even with GPL, as all you'll be using in your code is
the API which, as far as I know, can't be copyrighted, like any
kind of interface -- even hardware interface. But I can't find a
source on that.)

Best,

Maurício

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


[Haskell-cafe] Re: GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Maciej Piechotka
On Sat, 2010-03-06 at 00:28 +0100, Wolfgang Jeltsch wrote:
 Am Donnerstag, 4. März 2010 18:57:03 schrieb MightyByte:
  Interesting.  It seems to me that the only solution for the
  BSD-oriented haskell community is to practically boycott GPL'd
  libraries.  From what I understand, this is exactly what the LGPL is
  for.  I've known the basic idea behind the GPL/LGPL distinction for
  quite awhile, but I didn't realize that mistaking the two had such
  far-ranging consequences.  Since GPL seems to be the big elephant in
  the room, it seems very easy to make this mistake.  At the very least
  we should try to educate the community about this.
 
 To my knowledge, the LGPL only allows *linking* with non-(L)GPL software. But 
 GHC doesn’t just link but performs massive cross-module inlining. So in my 
 opinion, LGPL is not a solution, too. Use BSD3!
 
 Best wishes,
 Wolfgang

IANAL but it means you cannot distribute binaries using LGPL library
compiled with GHC without providing sources as LGPL explicitly ask that
the user have to have capability of relinking against new version of
library.

I.e.:
- If you use other compiler which did not use massive cross-module
inlining if is OK to use library.
- If you publish sources - on any licence as long as the user can
compile them against different version of library - it is OK (it does
not have to be open source). It can have any ND licenses etc. you want.
- If you prevent in any way the massive cross-module inlining then it is
OK as well

Regards

PS. There is also GPL-with-linking-exception which allows linking etc.
but does not require relinking capability. I'd believe that in such case
the cross-module inlining is not a problem since it is 'linking' for
compiler.



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


[Haskell-cafe] Re: Real-time garbage collection for Haskell

2010-03-05 Thread Simon Cranshaw
For settings we are using -N7 -A8m -qg.

I don't know if they are really the optimal values but I haven't found a
significant improvement on these yet.  I tried -qb but that was slow.  I
tried larger values of A but that didn't seem to make a big difference. Also
-N6 didn't make much difference.  Specifying H values didn't seem to make
much difference.  I have to admit I don't fully understand the implications
of the values and was just experimenting to see what worked best.  Please
let me know if there's anything you suggest I should try.  That said, we
have already got it to a speed where it's working so I'm ok with what we
now.

On Fri, Mar 5, 2010 at 9:38 PM, Simon Marlow marlo...@gmail.com wrote:


 What settings are you using, out of interest?

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