Re: [Haskell-cafe] Question on a common pattern

2011-03-15 Thread Achim Schneider
tsuraan tsur...@gmail.com wrote:
 Is there a more concise way to do this?

I use 

someIO = f where
  f Opt1 = ...

If it's a common pattern, you can even do

opts f _ _ (Opt1 x) = f x
opts _ g _ (Opt2 x) = g x
opts _ _ h (Opt3 x) = h x

. Functions are easier to mess around with than case expressions.

-- 
(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: Data Structures GSoC

2010-03-31 Thread Achim Schneider
Nathan Hunter enfer...@gmail.com wrote:

 -What Data Structures in the current libraries are in most dire need
 of improvement?
 -How necessary do you think a Containers Library revision is?
 -Should I attempt to build on the work Jamie Brandon did with Map as
 generalised tries, or is that beyond the scope of this project

As I see it, the most dire need is a unified interface to everything,
as well as instance selection, think

type instance MapOf Int = IntMap
type instance MapOf (a,b,c) =Tuple3Map(MapOf a)(MapOf b)(MapOf c) a b c

(gmap is very, very handy in every other aspect)


We have a lot of useful interfaces (e.g. ListLike, Edison), but they
don't seem to enjoy wide-spread popularity.

There's some lack when it comes to hashtables (I'd like to see a
Haskell implementation of perfect hashing, as that's sometimes jolly
useful) as well as cache-obliviousness (which is a can of worms:
Ensuring data layout requires using mutable Arrays, which sucks, so
what we actually need is a gc/allocator that can be told to allocate in
van Emde Boas layout), but in general, the implementation side is fine.

I would also like to be able to match on the left head of Data.Sequence
in the same way I can match on Lists (see e.g. [1]), but I guess
there'd have to me more commutity backing for that to become reality.


[1] http://hackage.haskell.org/trac/ghc/ticket/3583

-- 
(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: Are there any female Haskellers?

2010-03-30 Thread Achim Schneider
Richard O'Keefe o...@cs.otago.ac.nz wrote:

 I grant you that driving cars is recent (:-) (:-)!

And shoes! Never leave home with them. Well, at least spring till fall.

-- 
(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: More Language.C work for Google's Summer of Code

2010-03-30 Thread Achim Schneider
Stephen Tetley stephen.tet...@gmail.com wrote:

 Much of the behaviour of CPP is not defined and  often inaccurately
 described, certainly it wouldn't appear to make an ideal one summer,
 student project.
 
If you get

http://ldeniau.web.cern.ch/ldeniau/cos.html

to work, virtually everything else should work, too.

Macro languages haven't been in fashion in the last decades, so you
have to locate a veritable fan to work on this.

There are, after all, still people writing TeX macros. There's got to
be some CPP zealots, out there.


-- 
(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: Performance question

2010-03-19 Thread Achim Schneider
Arnoldo Muller arnoldomul...@gmail.com wrote:

 Right now, the bottleneck of my program is in binarySearch', the
 function must be called a few billion times.
 
 Do you have any ideas on how to improve the performance of this
 function?

The fastest way to do a binary search is to reify it into code using
TH, in Van Emde Boas layout if it's a big enough search (so that you
get less cache misses)

This might of course get tricky if your tree isn't compile-time static,
but if you're really doing gazillions of lookups, occasionally
compiling+dynamically linking code might well be worth it.

-- 
(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: Space leak

2010-03-15 Thread Achim Schneider
Ketil Malde ke...@malde.org wrote:

 Lazy IO always worked well for me, so althouhg I feel I should look
 more deeply into real solutions, like Iteratee, my half-hearted
 attemts to do so have only resulted in the conclusion that it was
 more complicated, and thus postponed for some rainy day... lazy IO
 for lazy programmers, I guess. 

If you have a huge data set and a large address space (say, a 64-bit
processor), you may want to use bytestring-mmap.

-- 
(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: First time haskell - parse error!

2010-03-14 Thread Achim Schneider
Sebastian Fischer s...@informatik.uni-kiel.de wrote:

 (Choosing names that are  
 misleading or flat out wrong is of course always a bad idea.)

foo = f . g . h where
f x = ...
g x = ...
h x = ...

Sometimes laziness is just the clearest option.

-- 
(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: 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: 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


[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


[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


[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


[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


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

2010-03-04 Thread Achim Schneider
Tom Tobin korp...@korpios.com wrote:

 Maybe it would be useful if Cabal had some sort of licensing check
 command that could be run on a .cabal file, and warn an author if any
 libraries it depends on (directly or indirectly) are GPL'd but the
 .cabal itself does not have the license set to GPL.

Or are dual-licensed under GPL. That is, the license field in .cabals
should take a list or even bool ops, and cabal sdist should utterly
fail (as well as hackage) if code that depends on GPL isn't marked as
GPL.

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.

-- 
(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: Prelude.undefined

2010-03-03 Thread Achim Schneider
Tom Hawkins tomahawk...@gmail.com wrote:

 The debugger was not that helpful, so I may have to resort to this.
 
 Is there any work being done to improve reporting for these type of
 errors?  It seems to be a fairly common problem.

http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack

-- 
(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: native threads vs. -threaded

2010-02-28 Thread Achim Schneider
Donn Cave d...@avvanta.com wrote:

 I imagine I'm at fault somewhere in this, since I am also responsible
 for the GHC port to Haiku, but just wondering if this suggests an
 obvious course of inquiry to anyone.  I assume it's not working as
 intended, as from the documentation I would rather have guessed that
 -thread would be required in this situation.
 
Could it be that Haiku is expecting BeOS threads but you give it UNIX
processes? It might be that all threads serving a GUI app must be part
of the same team.

-- 
(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: listing mountpoints and getting their properties in Haskell

2010-02-27 Thread Achim Schneider
Eugene Dzhurinsky b...@redwerk.com wrote:

 Hello!
 
 I need to list all currently mounted filesystems and get some stats
 like total space, free space, mount point and physical device.
 
 Is there any library capable of obtaining such information from OS
 itself? Parsing output of 'df' is locale-dependent and error-prone
 (because of locale settings, output settings etc).
 
 Thank you in advance.
 
There's mount, which I think has a portable output format, and my df
comes with the -P option to switch to POSIX output.



-- 
(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: View patterns

2010-02-27 Thread Achim Schneider
Andrew Coppin andrewcop...@btinternet.com wrote:

 Ozgur Akgun wrote:
  A humble suggestion: Have a *lazy* to list method for
  your /lists, arrays, sets, etc./ and use the nice list-only version.
 
 Yeah, that works quite nicely.
 
 It won't work for arbitrarily complex structures, however. My main
 point was that if you make the constructors abstract and provide
 functions to query the structure, now you can't pattern match against
 it.

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

...I think the issue just has to be nailed down precisely, and then
someone has to volunteer implementing it.

-- 
(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: Proposal: TypeDirectedNameResolution

2009-07-30 Thread Achim Schneider
Jason Dagit da...@codersbase.com wrote:

 My biggest fear is that of usability.
 
 If I understand you correctly, then as you change module imports you
 change the meaning of the code in potentially non-obvious ways.  So
 this isn't too different than using unqualified imports and flipping
 between two modules that export the same function.  Except that as
 you increase the 'automatic'ness of it, it has the potential to trip
 up people.

My biggest fear is seeing it actually implemented as a language switch,
resulting in chaotic inferance behaviour as soon as imports change. 

I think the Right Place to do this is on the editor/ide level: Help the
programmer to use the right function by scanning through types, leave
the display uncluttered (but make precise information about what
function is referenced easily available) and save the source code fully
qualified.

Source code is not only made for human consumption but also as fodder
for batch processes, re-compilation with other compilers etc, so we
shouldn't put anything into it that can break way too easily, be it
because type inferance changes in subtle ways or some library merely
happens to export an additional function. 

Thus is the way of Malbolge,
be ye warned, ye who construeth
isomorphic brainb0rkz0rage.


| Book 4 - Coding
|
| Thus spake the master programmer:
|
| ``A well-written program is its own heaven; a poorly-written program
| is its own hell.'' 
| 
 [...]
| A program should follow the `Law of Least Astonishment'. What is this
| law? It is simply that the program should always respond to the user
| in the way that astonishes him least.
| 
| A program, no matter how complex, should act as a single unit. The
| program should be directed by the logic within rather than by outward
| appearances.
| 
| If the program fails in these requirements, it will be in a state of
| disorder and confusion. The only way to correct this is to rewrite
| the program. 
|
 [...]

etc. pp. qed.

-- 
(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: How to pretty print code efficiently

2009-07-03 Thread Achim Schneider
John Ky newho...@gmail.com wrote:

 Hi,
 
 Currently I'm pretty printing code by building arrays of strings and
 calling indent.  For example:
 
 instance JavaPrintableNamed AST.EnumeratedType where
javaLinesNamed parentName (AST.EnumeratedType memberDefinitions) =
   [ public enum  ++ asJavaId(parentName)
   , {
   ] ++ memberCodeLines ++
   [ }
   , 
   ]
   where
  memberCodeLines = indent $ javaLines memberDefinitions
 
 The indent function takes a list of strings and adds an indent to the
 beginning of every line.
 
 I can imagine this to be very inefficient as it builds many strings
 and concatenates them.
 
Yes and no. When concatenating two lists, only the first one is
rebuild, the second one is reused, due to sharing. So if you
concatenate short strings to the front of a long string you're quite
fine. But then, that isn't the answer you hoped for.

 In Ruby, I might do the same thing like this:
 
 class EnumeratedType  JavaPrintableNamed
def writeTo(writer)
   writer.print public enum 
   writer.puts self.asJavaId
   writer.puts {
   writer.indent do
  self.memberDefinitions.writeTo(writer)
  writer.puts
   end
 
 where above, the writer.indent takes care of the indent, and
 everything is appended to a stream, which doesn't seem so bad in
 terms of efficiency.
 
 I'm looking for a way to do something similar in Haskell.
 
 Anyone can give me a hand?
 
As data structure use Data.ByteString.Lazy: concatenating two lazy
bytestrings doesn't involve rebuilding the first string byte-by-byte,
but constructs a superstructure denoting the concatenation.

As for how to express it in code: I'd recommend a combination of a State
monad to track the indentation, and the underused[1] Applicative
interpretation of lists to concatenate stuff. = would function as
concatenation of lines, getting the state, while the indent function
would first set it to the new level, then execute the passed
sub-action, and finally reset it to the old level. You're going to need
a way to concatenate two strings without doing a line-break, too, of
course.

All in all, it's a splendid exercise in how to write custom monads.


[1] Lists as ordered collections, not possibilities, that is, see e.g.
the typeclassopedia 
( http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf )

-- 
(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: How to pretty print code efficiently

2009-07-03 Thread Achim Schneider
Achim Schneider bars...@web.de wrote:

 As for how to express it in code: I'd recommend a combination of a
 State monad to track the indentation, and the underused[1] Applicative
 interpretation of lists to concatenate stuff. = would function as
 concatenation of lines, getting the state, while the indent function
 would first set it to the new level, then execute the passed
 sub-action, and finally reset it to the old level. You're going to
 need a way to concatenate two strings without doing a line-break,
 too, of course.

Make that Reader Monad and execute the passed sub-action with the
new level inside a new monad

-- 
(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: Strange type error with associated type synonyms

2009-05-28 Thread Achim Schneider
Bulat Ziganshin bulat.zigans...@gmail.com wrote:

 Hello Achim,
 
 Thursday, May 28, 2009, 1:34:55 AM, you wrote:
 
  Error: type of x is Integer
   while type of read argument should be String
  
  The problem with this is that the compiler can't know whether or not
  the type of arguments to read should be a String, as someone could
  have messed up read's signature.
 
 i don't understood what you mean, can you give an example?
 
Error : type of x is String
  while the type of an argument to read should be Integer

, given that, somewhere, you have

read :: Integer - a

, which is, of course, wrong, and that's the point.


-- 
(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: Error message reform (was: Strange type error with associated type synonyms)

2009-05-28 Thread Achim Schneider
John Dorsey hask...@colquitt.org wrote:

 As another native English speaker, I found expected/inferred very
 intuitive when I was new to GHC, and to Haskell.  I even think that
 expected/inferred helped me form my intuition about Haskell's type
 inference.

First off, me too, and I'm not a native speaker.

OTOH, while expected is not ambiguous, inferred is: After all, both
types are inferred.

I opt for

expected/encountered

-- 
(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: Strange type error with associated type synonyms

2009-05-27 Thread Achim Schneider
Bulat Ziganshin bulat.zigans...@gmail.com wrote:

 while we are here - i always had problems understanding what is
 inferred and what is expected type. may be problem is just that i'm
 not native speaker

The shape of the brick you are trying to push through a hole is
analysed (inferred) by the universe from the brick's overall
properties, while the hole certainly can be said to expect a certain
shape of block.

The actual universe might very well do pixel-based collision, not
something as elaborate as what I described, though. YMMV.

-- 
(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: Strange type error with associated type synonyms

2009-05-27 Thread Achim Schneider
Bulat Ziganshin bulat.zigans...@gmail.com wrote:

 Error: type of x is Integer
  while type of read argument should be String
 
The problem with this is that the compiler can't know whether or not
the type of arguments to read should be a String, as someone could
have messed up read's signature. Granted, you have to have a knack for
semantic bickering to not just glance over the imprecision. 


-- 
(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: the problem of design by negation

2009-05-25 Thread Achim Schneider
Conal Elliott co...@conal.net wrote:

 I gather that some people are terribly uncomfortable
 without certainty.  If you take away their certainty, they demand an
 immediate replacement!

This is a very important observation, vast areas of human psychology
can be explained in terms of feeling certain or not[1]: It's the most
powerful and most basic influence of behaviour there is. As my
observation goes, people are uniformly drilled to perform, which, due
to its methods, induces a social taboo on failure, which, in turn,
explains why uncertainty can, so often, act unconsciously. 
People can't fix what they can't see, so SNAFU: Passing on the
short straw of not-knowing is the only way to safe face / feel safe.

You have to make sure not to trigger fear of mockery, segregation and
failing class (i.e. getting fired) while handing out F's, that is...
which is why the Socratic method is so darn effective when it comes to
dealing with people.

[1] Freud, Jung, Leary, amongst others, take your pick.

-- 
(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: the problem of design by negation

2009-05-25 Thread Achim Schneider
Michael Mossey m...@alumni.caltech.edu wrote:

 Based on a previous reply, I think some people think this sounds like
 vapid cheerleading, but I think you would agree with me that life
 (and software) always offers more possibilities when we engage our
 imagination with hope and energy, not giving up too soon, being
 willing to sit with problems for a time without a definite conclusion.

With the burden that this behaviour and state of mind is a result of a
foundational state of mind: Merely practising the symptoms is even less
effective than being a grouch.

So, yes, I _do_ think that it sounds like vapid cheerleading ;)

-- 
(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: OT: Languages

2009-05-12 Thread Achim Schneider
wren ng thornton w...@freegeek.org wrote:

 That is, the distinction between agglutinative vs
 fusional is typological rather than theoretical.
 
 Though yes, the distinction is most clearly observed by looking at 
 verbal inflections. And now we're really far off topic :)

No, we aren't. A couple of days ago, I considered replacing a couple of
highly regular function definitions by three lists and two calls to
*, but didn't do it as I would still have to name the resulting
functions by hand, to use them, and TH seemed utter overkill.

-- 
(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: Inferred typing?

2009-05-12 Thread Achim Schneider
michael rice nowg...@yahoo.com wrote:

 In the code below, is the type returned by the return functions
 inferred from the result type in the function type signature, i.e.,
 just change the result type to Maybe Int and the code will return a
 Maybe monad, (Just 4), instead of a List monad?
 
Yes.

Prelude :m Control.Monad
Prelude Control.Monad let fn l = mzero `mplus` (return (head l))
  `mplus` (return (last l)) 
Prelude Control.Monad fn [1,3] :: Maybe Int 
Just 1
Prelude Control.Monad fn [1,3] :: Maybe Float
Just 1.0
Prelude Control.Monad fn [1,2,3] :: [Int]
[1,3]

-- 
(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: applicative challenge

2009-05-04 Thread Achim Schneider
Conor McBride co...@strictlypositive.org wrote:

 Remember folks: Missiles need miffy!
 
H. Iff you have something like CoPointed or Foldable, you can
thread your own, Applicative, tail back into yourself and decide what
you are by inspecting it.

That makes foldr the join of Hask itself, or something. Bear with me,
I'm merely attempting to delurk our resident category theorists by
giving them headaches.

-- 
(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: A brief note on n_k patterns and Hackage

2009-05-04 Thread Achim Schneider
John Van Enk vane...@gmail.com wrote:

 Which package?

More importantly, is it a recent version, that's still live? Does it
compile with ghc  5.2? 

-- 
(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: gcd

2009-05-03 Thread Achim Schneider
Nathan Bloomfield nblo...@gmail.com wrote:

 The greatest in gcd is not w.r.t. the canonical ordering on the
 naturals; rather w.r.t. the partial order given by the divides
 relation.

This, to defend myself, was not how it was explained in high school.

-- 
(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: gcd

2009-05-02 Thread Achim Schneider
Steve stevech1...@yahoo.com.au wrote:

 It is useful to define gcd(0, 0) = 0 and lcm(0, 0) = 0 because then
 the natural numbers become a complete distributive lattice with gcd
 as meet and lcm as join operation. This extension of the definition
 is also compatible with the generalization for commutative rings
 given below.
 
Ouch. Speak of mathematicians annoying programmers by claiming that 0
isn't divisible by any of [1..], and further implying that 0 is bigger
than all of those, not to mention justifying all that with long words.

Damn them buggers.

-- 
(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: Estimating the time to garbage collect

2009-05-01 Thread Achim Schneider
Neil Davies semanticphilosop...@googlemail.com wrote:

 Ignoring, at least for the moment, all the issues of paging,
 processor cache occupancy etc, what are the complexity drivers for
 the time to GC?

It largely depends on the GC implementation, especially when you
interpret time to GC as time until you get control back, in
contrast to e.g. time to claim back (at least) X bytes (because you
want to allocate something).

There's GC schemes that are usable in hard realtime systems, but I
_very_ much doubt ghc's gc is. If you want to go real-time, you might
want to have a look at Timber.

-- 
(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: Help from C libraries experts

2009-04-30 Thread Achim Schneider
Maurício briqueabra...@yahoo.com wrote:

 bindings-agar

http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/51478


-- 
(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: Converting IO [XmlTree] to [XmlTree]

2009-04-28 Thread Achim Schneider
Jason Dusek jason.du...@gmail.com wrote:

 2009/04/21 Manlio Perillo manlio_peri...@libero.it:
  Luke Palmer ha scritto:
  And many other permutations, with differing degrees of
  laziness and parametericity.
 
  As long as you stricly read a string from the socket, this is
  ok. But you can not read a string lazily.
 
   Why not? It changes the way in which the program fails (if it
   does) but it does not change the result.
 
Reading a socket lazily has exactly the same result as strictly reading
a socket that isn't sent any data. In network programming, you
continuously have to drain your input.


-- 
(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: Cabal's default install location

2009-04-24 Thread Achim Schneider
Richard O'Keefe o...@cs.otago.ac.nz wrote:

 I have never thought, stated, or implied, that only people
 without superuser access count!  It's just that I and for that
 matter, the sysadmin I talk to most are heartily fed up with the
 assumption that everyone is a sysadmin.

Yes, but I thought you implied exactly that, because I thought you were
asking Are the ten people not having root access even worth the
bother?. I didn't _mean_ to imply it, either, I _assumed_ you did,
because, frankly, I would have written the same question in a way that
wouldn't have me made that assumption. Not looking at your name before
replying did the rest.

Truth is a three-edged sword, and misunderstandings are great fun.

-- 
(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: Is 78 characters still a good option? Was: breaking too long lines

2009-04-24 Thread Achim Schneider
Xiao-Yong Jin xj2...@columbia.edu wrote:

 Gwern Branwen gwe...@gmail.com writes:
 
  I was cabalizing a package once, and I chucked into the
  build-depends 'ghc' and made it build. About 30 seconds later, it
  occurred to me that this was a geometry library and what the heck
  was it doing with the GHC API? So I go looking, and I find a module
  of utility functions. It's importing GHC.Base.
  I remove the import and scroll down to see the error.
 
  It turns out that 20 megabytes of GHC code was being linked into
  this program for one function.
  I took the quick way out and typed into the module: 'isJust Nothing
  = False; isJust (Just a) = True'.
 
 Probably I'm missing something, but why didn't you just
 import Data.Maybe?  I believe both 'isJust' and 'isNothing'
 is defined in the module.

...and that's TRWTF.

-- 
(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: Cabal's default install location

2009-04-24 Thread Achim Schneider
Edward Middleton emiddle...@bebear.net wrote:

 Could you add this[1] link too, because it highlights the problem with
 user installs[1]. i.e. you either have to have root access to install
 the dependencies, or install non-haskell dependencies in your home
 directory.
 
 Edward
 
 1. http://haskell.org/pipermail/haskell-cafe/2009-April/060441.html

I really, really don't think messed up global installs are an issue
that cabal should worry about. A messed up OpenGL is more than enough
reason to bug your admin, and a missing, say, libXML, is a thing you
either have to deal with yourself or find a well-disposed admin. In any
case, the cost of installing/fixing the install greatly outweights the
--user/--global issue.

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-23 Thread Achim Schneider
Daniel Fischer daniel.is.fisc...@web.de wrote:

 Well, if it doesn't implement the full standard, perhaps it should
 rather be called UVNABNQHC (Utrecht very nearly, almost but not quite
 Haskell compiler)?

Ha! Haskellâ„¢!

I said it first, and rule that...

I don't care what you use the name for. Everyone is free to make a fool
of themselves if they stick it on their language, be it PHP or H98-n+k.

-- 
(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: Is 78 characters still a good option? Was: breaking too long lines

2009-04-23 Thread Achim Schneider
Maurí­cio briqueabra...@yahoo.com wrote:

 Maybe we could learn with them: what about if Haskell Weekly
 News had a section on code review, like many newspapers have
 book review sections?

The weekly WTF?

-- 
(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: Non-atomic atoms for type-level programming

2009-04-22 Thread Achim Schneider
Tillmann Rendel ren...@cs.au.dk wrote:

 Hi Claus,
 
 thanks for your elaborations. I'm still not convinced that a common
 name (e.g. TT :. Tr :. Tu :. Te) is a better interface than a common
 import (e.g. TypeLevel.Bool.True). In both cases, the authors of all
 modules have to actively collaborate, either to define common names,
 or to define common imports.
 
 But I begin to see how type-level atoms could help to, e.g.,
 implement more advanced module system as type-level embedded DSLs in
 Haskell.
 
  Standard ML's answer to that kind of issue is type sharing.
 
 Does type sharing help with making modules retroactively compatible?
 

map (\i - rot13 i) import Foo

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-22 Thread Achim Schneider
Richard O'Keefe o...@cs.otago.ac.nz wrote:

 On 21 Apr 2009, at 11:36 pm, Achim Schneider wrote:
 
  Richard O'Keefe o...@cs.otago.ac.nz wrote:
   
  Some of the right questions are
   - how many potential whatever users would need to have  
 whatever installed on _some_ machine they do NOT have  
 administrator access to?
   
  Irrelevant.  
 
 How van the question that is the very heart of this thread
 be irrelevant?
 
 This is precisely the situation I'm in, and it's precisely
 the class of users I'm arguing for.
 
 I'm encouraged by the constructive suggestions of package
 tools (nix, portage) that are said to address some of these
 issues.  Except of course that I have to install them first...

It's irrelevant, because I _do_ have root access to my machine, but
don't want to get forced into using it by a question that implies that
if you have access, you're going to use it. I didn't mean to nit pick,
though, I thought you were arguing for the other side...

I think the right question is how many people prefer user installs
over system installs, wrt. their hackage packages?. 

I estimate that, concerning developers, who are used to install
still-buggy, self-written libraries, as well as install things while
working, the percentage is very, very high: At least I don't want my
workflow to be broken to deal with the formal requirements of a global
install while developing, and I guess many others feel the same way.[1]

Endusers, of course, might have other preferences, but cabal doesn't
(IMHO) cater to them, directly: It caters to distribution packages (or
windows installers, or whatever), so cabal's default behaviour is quite
irrelevant for those cases.

[1] Thinking of it... is there a way to tell cabal to pretend a package
is installed by giving the path to it's source directory? Just like
include directories, but with packages.

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) --first release

2009-04-22 Thread Achim Schneider
Claus Reinke claus.rei...@talk21.com wrote:

 [...]

+1. That, and better error messages: A Verbose-Consequences flag in the
config (on by default), resulting in strings like Binaries have been
installed to $HOME/.cabal/bin and _not_ symlinked. $HOME/.cabal/bin is
not in your $PATH: You will not be able to call them directly from the
command line, and programs depending on them might be unable to locate
them, resulting in failure or limited functionality.

Hell, I never thought I'd ever advertise the usage of disclaimers...

Gentoo does this, too, btw: Remember, you have to be in the group
games to play games, You chose to build firefox with official
branding, distributing the binary (even in your local network) might
result in legal problems with the Mozilla Foundation. 

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-22 Thread Achim Schneider
Richard O'Keefe et all wrote:

 [n+k patterns]
 
I'd like to add my two cents: Assuming that UHC's roadmap strives to be
H'-compilant in the future, and n+k patterns aren't going to be in H',
why bother implementing them?

Also, assuming that current H98 code will be ported to H', shouldn't
n+k patterns be removed from existing code, anyway?

-- 
(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: Is 78 characters still a good option? Was: breaking too long lines

2009-04-22 Thread Achim Schneider
Jason Dusek jason.du...@gmail.com wrote:

   Really, the whole thing makes me wish we had blasphemy laws.
 
 If any person, in speaking or in writing, shall indicate
 a preference for column widths other than 80 or indent
 characters other than spaces (`0x20`) they shall be
 compelled to present some science or be subject to
 imprisonment.
 
I'll definitely add it to the list of questions should I ever conduct a
job interview. Just to test how much backing people have for their zeal.


-- 
(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: Overriding a Prelude function?

2009-04-22 Thread Achim Schneider
michael rice nowg...@yahoo.com wrote:

 OK, I changed the operator from () to (~). When I try to use it I
 get this:
 
 [mich...@localhost ~]$ ghci rand
 GHCi, version 6.10.1: http://www.haskell.org/ghc/__ :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling Main ( rand.hs, interpreted )
 Ok, modules loaded: Main.
 *Main rollDie ~ (rollDie ~ rollDie)  
 
 interactive:1:0:
 __ No instance for (Show (Seed - (Int, Seed)))
 __ arising from a use of `print' at interactive:1:0-32
 __ Possible fix:
 __ add an instance declaration for (Show (Seed - (Int, Seed)))
 __ In a stmt of a 'do' expression: print it

Well, you obviously need an initial seed:

rollDie 0xdeadbeef ~ (rollDie ~ rollDie)

-- 
(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: Cabal's default install location

2009-04-21 Thread Achim Schneider
Thomas Davie tom.da...@gmail.com wrote:

 There seems to be an assumption amongst the community that a user's  
 home directory is the most useful place for cabal to install to by  
 default.  A few people have challenged that.  I wanted to find out  
 which one most people do actually prefer, so please go and vote on  
 this poll.
 
 http://noordering.wordpress.com/2009/04/21/cabals-default-install-location/
 
 It's no more than a straw poll, I don't know how protected it is  
 against ballot stuffing, but I'm pretty confident that Haskellers
 are trustworthy enough not to play with it that way.
 
 I'll tell you all the result next week.

alias cabal='cabal --global'


-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Achim Schneider
Richard O'Keefe o...@cs.otago.ac.nz wrote:

  This is good advice (/usr/local is fine though).  
 
 Actually, no, it isn't.
 To start with, these days it's chock full of stuff
 which is hardly less critical for system operation
 than anything you'll find in /bin.

More importantly, /usr/local is a bugger to manage by hand, even if the
sources came with uninstall capabilities, chances are they're not
around, anymore, or messed up.

I prefer to have stuff in /opt/package name, with links to the
binaries in /opt/bin. Manual user installs go into ~/opt, one-file
stuff (mostly self-written) into ~/bin. There's also some scripts in
~/dos to start some games with dosbox, but those don't count.

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Achim Schneider
Edward Middleton emiddle...@bebear.net wrote:

  ghc 6.8.3 is /usr/bin/ghc on my office Mac, but nothing in the world
  prevents there being some other program called ghc that would also
  like to be there.  Only by painstaking verification of a whole
  bunch of applications together can one be confident of safety.  
 
 Well then I guess we agree,  so the question becomes who should do the
 painstaking verification.  I think distribution maintainers should do
 this, you think end users who can't compile source packages should do
 this.

Not the maintainers, but the tool. Portage doesn't install stuff if it
would overwrite other things, records changes to files in e.g. /etc to
be merged later (interactively, with diffs), and records every file it
ever installed by having the package install itself in
/var/portage/package/version. You are _completely_busted_ if your
install script doesn't support that: The script runs sandboxed.

Portage even registers every installed package into an empty ghc
package database, and merges them later. It knows what it does.

I can switch between different versions of packages, or different
implementations of the same functionality (say, java-sun vs.
java-blackdown) with eselect.

In short: Don't write your own install scripts, you're bound to get it
wrong, and/or be vastly inferior, compared to portage.

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Achim Schneider
Richard O'Keefe o...@cs.otago.ac.nz wrote:

 Some of the right questions are
   - how many potential whatever users would need to have
 whatever installed on _some_ machine they do NOT have
 administrator access to?

Irrelevant.

   - if people find Mac and Windows installers that show you where
 something is going to be put and offer you the chance to change
 it acceptable, why exactly would that be unacceptable under
 Linux or Solaris?

It's perfectly acceptable, even required, but, for the love of UNIX,
take that path as a parameter, don't do a GUI. If you want a GUI, write
it in terms of that script.

   - since we know install-anywhere binary releases are possible,
 and since we know that an installer _can_ probe to see whether
 installation in /usr/local (or any other standard place) is
 possible, why not do it?

I really, really don't like the idea of a program behaving differently
based on the permissions it has, short of failing to do what I told it
to do.

OTOH, quickly checking whether the user has write permissions to / and
failing with you need root right to do that, did you mean to call this
script with --user? instead of failing with access denied errors is a
Good Thing.[1]

Echoing binaries were installed in $HOME/.cabal/bin, and checking the
user's $PATH and displaying a warning if that directory isn't in it is
a Good Thing, too. I guess it's also the main problem those not
literate in UNIX have with cabal.


[1] Does install --user check whether configure was called with --user,
too? I hope so...

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Achim Schneider
Edward Middleton emiddle...@bebear.net wrote:

 Achim Schneider wrote:
  Edward Middleton emiddle...@bebear.net wrote:
 

  ghc 6.8.3 is /usr/bin/ghc on my office Mac, but nothing in the
  world prevents there being some other program called ghc that
  would also like to be there.  Only by painstaking verification of
  a whole bunch of applications together can one be confident of
  safety. 
  Well then I guess we agree,  so the question becomes who should do
  the painstaking verification.  I think distribution maintainers
  should do this, you think end users who can't compile source
  packages should do this.
  
 
  Not the maintainers, but the tool. Portage doesn't install stuff if
  it would overwrite other things, records changes to files in
  e.g. /etc to be merged later (interactively, with diffs), and
  records every file it ever installed by having the package install
  itself in /var/portage/package/version. You are
  _completely_busted_ if your install script doesn't support that:
  The script runs sandboxed.
 
  Portage even registers every installed package into an empty ghc
  package database, and merges them later. It knows what it does.
 
  I can switch between different versions of packages, or different
  implementations of the same functionality (say, java-sun vs.
  java-blackdown) with eselect.
 
  In short: Don't write your own install scripts, you're bound to get
  it wrong, and/or be vastly inferior, compared to portage.

 
 But who writes the ebuild[1] ?  That said, on the various system I
 run I have over 100 custom ebuilds that I maintain.  I can do this
 because most applications have standard sane build systems that
 install things in the regular places.
 
Yes, usually it's just a matter of writing inherit distutils and
figuring out (still missing) dependencies. While I utterly loathe
autoconf, it has its merit... being widely used.

-- 
(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: Is 78 characters still a good option? Was: breaking too long lines

2009-04-21 Thread Achim Schneider
Dusan Kolar ko...@fit.vutbr.cz wrote:

 Dear all,
 
   reading that
 
  according the several style guides, lines shouldn't be too long
  (longer than 78 characters).
 
  http://www.cs.caltech.edu/courses/cs11/material/haskell/misc/haskell_style_guide.html
  http://www.haskell.org/haskellwiki/Programming_guidelines

 I would like to know, whether 78 characters bound still makes a
 sense... Even if I connect to my linux box with text terminal, it is
 not a 80x24 characters HW text terminal, but a window emulating this
 in whatever else OS, thus, I can usually extend this to see longer
 lines easily.
 
 Or is the reason much deeper? Or, is the bound set to 78 characters
 just because it is as good number as any other?
 
I can fit two 63-character terminals side by side on my screen, so
that's the size I usually use. The width also corresponds to an
portrait a4 page w/o margins, so I can usually read code by just moving
my eyes vertically. I think the best shape for code is approximates
1:sqrt(2), landscape : you shouldn't go 78 characters before you've hit
a function length of 55.154328932550705 lines or such.

This is Haskell, of course. With Java, I tend to sit at least a meter
further apart from the screen and have the console span both monitors,
after all, you somehow have to fit at least a single identifier on a
line...

-- 
(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: General function to count list elements?

2009-04-20 Thread Achim Schneider
Lennart Augustsson lenn...@augustsson.net wrote:

 On Sun, Apr 19, 2009 at 10:43 PM, Peter Verswyvelen
 bugf...@gmail.com wrote:
  For example, suppose you have a predicate a - Bool, and a list of
  these predicates [a - Bool], but you want to remove all functions
  that are obviously equal in the C way from the list for
  optimization... Okay big hack, and one could do this already with
  reallyUnsafePtrEquality# I guess... 

 And when the need gets big enough you pull out StablePtr and use
 that. :)
 
Waaagh! Don't give him ideas, he's going to do it... Make yourself an
enum, generate your list, nub it, then transform it to a list of
functions. Always do everything with the least information sanely
feasible, and a function is more information than a value, even if you
can't get at it, anymore.


-- 
(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: breaking too long lines

2009-04-20 Thread Achim Schneider
Christian Maeder christian.mae...@dfki.de wrote:

 [...]

All very fine, but what about simply moving code into a top-level
binding or a function-level let/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


[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Achim Schneider
Don Stewart d...@galois.com wrote:

 This means that 'cabal
 install' works out of the box on every system, without needing
 admin/root privs (esp. important for students).

...and people who were bitten by sanity and thus never, ever touch /usr
manually, only through their distribution's package manager.

Then there's those that work in an environment with network-mounted
home directories, and even if the admins judged you responsible and
skillful enough to award you local root rights, you still want your
working environment to be available on any machine you log on.


In short: If you don't need the package available for _every_ user, or
your distribution comes with a pre-packaged version, don't even think
to install it globally: it's an abomination to UNIX. Deal with it, OSX
users aren't running a graphic shell on steroids, any more, and, yes,
even Windoze users stopped running on top of that hacked-up program
loader named DOS.

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Achim Schneider
Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote:

 a...@cs.uu.nl writes:
 
  Utrecht Haskell Compiler -- first release, version 1.0.0
  
 
 
  The UHC team is happy to announce the first public release of the
  Utrecht Haskell Compiler (UHC). UHC supports almost all Haskell98
  features
 
 Why? Is there something about Haskell 98 that's hard to
 implement?
 
Insanity. I doubt anyone is going to miss n+k patterns:

http://www.cs.uu.nl/wiki/bin/view/Ehc/LanguageFeatures



-- 
(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: General function to count list elements?

2009-04-19 Thread Achim Schneider
Peter Verswyvelen bugf...@gmail.com wrote:

 Sometimes I do miss the pragmatic C solution:- two function pointers
 that are equal surely represent the same functions (although in C
 nothing is really sure ;)

In haskell, they would, but C doesn't give you the same guarantee:

int evil = 0;

int wicked( int i_dare_you ) {
return i_dare_you + (++evil);
}

Clearly, wicked and wicked are the same function, but they surely
aren't indistinguishable, at least if you happen to call them.

-- 
(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: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-18 Thread Achim Schneider
Antoine Latter aslat...@gmail.com wrote:

 On Sat, Apr 18, 2009 at 4:38 PM, Thomas Davie tom.da...@gmail.com
 wrote:
 
  This looks like the same error I got ___ see bug report 1 in the bug
  database ___ the configure script reports that you have uuagc even if
  you don't ___ cabal install it, reconfigure, and you should be on
  your way.
 
  Second thing to watch for ___ it depends on fgl, but this isn't
  caught by the configure script.
 
 
 Apparently a user install of uuagc and fgl isn't good enough.  Fun
 to know.
 
Do you have your $PATH set to include $HOME/.cabal/bin ?

-- 
(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: Looking for the fastest Haskell primes

2009-04-16 Thread Achim Schneider
Eugene Kirpichov ekirpic...@gmail.com wrote:

 The parameterless version is a top-level definition and won't get
 garbage-collected, IIRC.
 So, if you evaluate primes!!1000, you'll end up with a
 1000-element list hanging in memory forever.
 If you evaluate (primes' ()) !! 1000, you won't.
 

{-# CAF foo #-}
{-# NOCAF foo #-}

-- 
(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: Looking for the fastest Haskell primes

2009-04-16 Thread Achim Schneider
Jason Dusek jason.du...@gmail.com wrote:

 2009/04/16 Achim Schneider bars...@web.de:
  {-# CAF foo #-}
  {-# NOCAF foo #-}
 
   Where do I find docs for these pragmas?
 
...in your friendly bug tracker, under the label missing feature

-- 
(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: ANN: Elerea, another FRP library

2009-04-15 Thread Achim Schneider
Patai Gergely patai_gerg...@fastmail.fm wrote:

 ...

I don't think using dirty tricks to implement FRP deserves flak, at
all, from my POV, it sounds like complaining that the IO monad is
implemented using C... meaning that if you're that close to bare
thunks, you have every right to use any means necessary to make them
behave properly.

-- 
(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: Best text editor

2009-04-15 Thread Achim Schneider
Jeff Wheeler j...@nokrev.com wrote:

 As one of the Yi developers, I'd love to hear some more specific
 feedback on this. Do you remember any specific Vim features that were
 missing?

Nope, but I'll be writing bug reports next time, at the very least.

-- 
(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: ANN: Elerea, another FRP library

2009-04-15 Thread Achim Schneider
Patai Gergely patai_gerg...@fastmail.fm wrote:

 Am I right thinking that the
 NOINLINE pragma on unsafeDupablePerformIO prevents the problem of
 multiple evaluation discussed yesterday?

From what I know and experienced, yes. Each individual unsafePerformIO
only ever evaluates its action once, and if they are prevented from
duplicating, things should work out as intended.

-- 
(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: Data.ByteString woes

2009-04-15 Thread Achim Schneider
David Carter david.m.car...@gmail.com wrote:

 I then thought I might work around the problem by converting lazy
 ByteStrings to strict ones in order to do the regex match.

strictBS :: LB.ByteString - B.ByteString
strictBS = B.concat . LB.toChunks

lazyBS :: B.ByteString - LB.ByteString
lazyBS = LB.fromChunks . pure

-- 
(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: ANN: Elerea, another FRP library

2009-04-15 Thread Achim Schneider
Peter Verswyvelen bugf...@gmail.com wrote:

 The reason why I'm talking about examples and not semantics is
 because the latter seems to be pretty hard to get right for FRP?

There's a difference between those two? I've heard much, but never
anyone complaining about specifications overlapping in a compatible
way.

-- 
(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: Maybe off-topic -- Writing contracts or software specifications

2009-04-14 Thread Achim Schneider
Richard O'Keefe o...@cs.otago.ac.nz wrote:

 If you have a low level of trust, you'll need a great level of
 detail, and it still won't help.

Heh. Keep your friends close, your enemies closer.

Freelancing, I was always paid per hour, not per feature. From my
experience, writing something like The contractor will work closely
with an employee designated by Foo to ensure formal and informal, known
or yet to be discovered, specifications are implemented is the best
thing you can do. If you have it, mention your QA and its guidelines.
If you don't have it, get both. [1]

It's more than enough to boot a bad teamplayer out of his contract,
doesn't induce frowns in top coders (SNAFU, as those are the ones you
want to hire), does not risk mis-specifying requirements (which, with
legal backing, is also SNAFU) and doesn't take longer and/or cost more
to work out than the program itself (SNAFU, again). Be sure that not
only bugs are fixed, but the reasons they appeared in the first place,
too: That's the secret people writing space shuttle control software and
similar use.


[1] Even if it's just one guy working out things like Every function
must be documented and me getting a bug report saying Help text
does not mention how to display help text.
-- 
(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: Best text editor

2009-04-14 Thread Achim Schneider
FFT fft1...@gmail.com wrote:

 Has anyone tried Yi?
 
Yes, and I figured I'd have to edit the keymap to get productive. While
it features a fully functional subset of vim that's more than enough to
efficiently edit files, it's not the subset I use... and then I was too
lazy to actually do it.

Documentation is badly lacking, too, it's like trying to configure
xmonad without xmonad-contrib and all the docs.


-- 
(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: Best text editor

2009-04-14 Thread Achim Schneider
Melanie_Green jac_legend_...@hotmail.com wrote:

 
 Hi I would like to follow the crowd and find out what text editor
 everyone uses for haskell on windows.
 
Have you considered using leksah? While it doesn't focus on being an
editor, it's still a darn fine way to edit Haskell.


-- 
(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: Converting IO [XmlTree] to [XmlTree]

2009-04-14 Thread Achim Schneider
rodrigo.bonifacio rodrigo.bonifa...@uol.com.br wrote:

 Dear Sirs,
 
 I guess this is a very simple question. How can I convert IO
 [XmlTree] to just a list of XmlTree?
 
unsafeCoerce.

Seriously, you just don't, you weld stuff together using =. It takes
an 'IO a' and a function 'a - IO b' and returns you an 'IO b', thus
preventing you from launching nuclear missiles while you're standing in
front of the exhaust jets. You don't want to be able to.

do-notation is a convenient short-hand:

foo = (\bar - return $ baz bar)

do 
  bar - foo
  return $ baz bar


= doesn't only work with IO, but with any monad, that's why it's type,

(=) :: Monad m = m a - (a - m b) - m b

might look intimidating, but actually isn't.


For more info, have a look at Real World Haskell[1], and, after
that, the Typeclassopedia[2].


As a final notice, don't listen to the others: Those are just desperate
people, vainly trying to convince themselves they'd understand monads.
If you see monads being compared to space suits, nuclear waste
processing plants, or burritos, run far, run fast, but run. If you see
them compared to applicative functors, get curious.


[1]http://book.realworldhaskell.org/read/
[2]http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-feedback/


-- 
(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: Converting IO [XmlTree] to [XmlTree]

2009-04-14 Thread Achim Schneider
Cristiano Paris fr...@theshire.org wrote:

 I was a bit surprised by the strong reaction about my citation of
 unsafePerformIO. Maybe it'd useful, for the future, to write a
 document explaining how to help newbies properly, maybe putting it in
 the mailing list charter.

1) Tell them about interact.
2) If they're not satisfied, or already spoiled by the functions they
   want to use, explain bind wrt. IO, then do-notation. You don't want
   them to get puzzled by missing returns, or think that it's a keyword.
3) Let them catch up on monads by themselves, there's no need to
   confuse people with explanations of things they already understand.


In other words:

1) Explain Pointed
2) Explain Functor
3) Explain Applicative
4) Explain Monad

-- 
(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: Types and hashes of hashes, trouble for a Java-programmer...

2009-04-13 Thread Achim Schneider
John Smith smithsno...@gmail.com wrote:

 Yes, I see. Good points in both answers, but I still would like to see
 how to do it with the mutable hash, if possible...


test = do
h - H.new (==) id
h1 - H.new (==) id
H.insert h 3 h1
H.insert h1 1 1000
inner - H.lookup h 3
case inner of
Nothing - return Nothing
Just outer - H.lookup outer 1000

you forgot to lift the Nothing into the IO monad. I like this one:

lookup' :: key - b - HashTable key (HashTable b val) - IO (Maybe val)
lookup' k l h = 
H.lookup h k = maybe (return Nothing) ((flip H.lookup) l)


test' = do
h - H.new (==) id
h1 - H.new (==) id
H.insert h 3 h1
H.insert h1 1 1000
lookup' 3 1000 h


-- 
(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: compilation related questions

2009-04-10 Thread Achim Schneider
minh thu not...@gmail.com wrote:

 On a related note, I have another question. Say we have some data
 structure, for instance a list, some functions on this data structure
 (probably defined with some well known functions, such as map or
 fold), and a program using them. Is there any research trying to
 rewrite the program, and the data structure, to optimize them ?
 
Yes. The most advanced approach that I know of is Dons'
stream-fusion[1]. I guess the technique of transforming a program so
that Y-combinators are at their outermost possible position (and fused,
in the process) could be generalised.

 A contrived example is the length of a list : instead of traversing a
 list to know its length, the list can have an additional field which
 is incremented at each cons.

Well, that's not a list anymore, at least not with some additional
ingenuity to deal with infinite ones. Statically-lengthed lists can be
done with some type trickery, see e.g. [2], if that helps.


[1] http://www.cse.unsw.edu.au/~dons/papers/CLS07.html
[2] http://article.gmane.org/gmane.comp.lang.haskell.general/13561

-- 
(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: compilation related questions

2009-04-10 Thread Achim Schneider
minh thu not...@gmail.com wrote:

 But for some functions, it can be seen clearly that such information
 could have been constructed at the same time that the data structure.
 
 So it is related to fusion techniques, but with the additional
 possibility of adding fields to the original data structure.

Well, the point fusion is about is _not_ to construct lists.

consider

naiveDropEnd xs = take (length xs - 1) xs

, which, due to length being a catamorphism, traverses xs twice.

It can be, in fact, reduced to the more sensible

dropEnd (x:[]) = []
dropEnd (x:xs) = x:dropEnd xs

, but that requires getting rid of the fold by replacing Integers
with Peanos: 

length' = map (\_ - ())
pred = tail
succ = (():)
zarroo = []

Now we can write

notSoNaiveDropEnd xs = take' (pred $ length' xs) xs

, which can be fused into a single y-combinator. 


Morale of the story: Folds are the bane of laziness. Having some magic
in place than can choose a lazily constructed (and fused) Peano
instance for Num in the right places would be awesomely cool.

-- 
(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: Announcement: Beta of Leksah IDE available

2009-03-31 Thread Achim Schneider
J__rgen Nicklisch-Franken j...@arcor.de wrote:

 So I please the members of the community to pause for a moment and try
 out Leksah with a benevolent attitude.

I did (the previous version, tbh), and couldn't find anything to
seriously bicker about... a few problems regarding metadata generation,
but that was dealt with as soon as I RTFM'ed. Ah, yes, you shouldn't be
able to close the toolbar by pressing on one of its buttons that
incidentally looks just like the one to close a file.

Completition already rocks, the interface is nicely configurable
(although I resorted to editing config and session files instead of
using gui commands[1]), project management worked out fine (after I
figured out that I had to manually configure leksah to pass --user to
cabal), all in all it's an impressive piece of code that radiates later
uberness instead of lacking features. Last, but not least, it's _fast_,
_way_ more zappy than eclipse. As far as basic IDE features are
concerned, it's also complete.


The one thing that keeps me from switching to it, right now, is the
editor not being a vi. While gtksourceview might be, in theory,
a usable editor, my muscle memory tells me otherwise. It'd be like
switching to autoconf for C development instead of just copying over my
beloved OMakefile.


Providing refactoring support would make it irresistible... maybe it's
time to add a plugin layer, so that things like vacuum or a wrapper
around hp2ps can register themselves with leksah, without giving up
their identity as stand-alone projects. Plugability is the one feature
that made eclipse big, and it won't hurt leksah, either.


[1] I utterly failed to figure out how to do stuff[2], seriously.
Eclipse has a really nice dragdrop interface with visual feedback
to rearrange stuff, but I'm not the kind of guy who drops a program
for lacking such bellswhistles.
[2] Stuff being rearranging divisions such that it's first split
horizontally, the console/type view etc. taking up the bottom part
and the upper part being split vertically into source view/module
browser. I just can't stand wrapped lines on the console. Somehow,
I think it should be the default arrangement.

-- 
(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: Exception handling in numeric computations

2009-03-29 Thread Achim Schneider
Henning Thielemann schlepp...@henning-thielemann.de wrote:

 Actually, I really object to have exception handling built into IO
 monad.

I couldn't agree more. If I want to write non-recovering code, I can
always just say

(Right foo) - readLine

, and hope that the RTS is smart enough to print the error message in
the left constructor should that match fail.

-- 
(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: Darcs - dependencies between repositories (aka forests)

2009-03-29 Thread Achim Schneider
Peter Verswyvelen bugf...@gmail.com wrote:

 To me, any version control system should be able to track dependencies
 between repositories. Something similar like Cabal's dependency
 system.
 
 So my question is really, how do you solve the dependency tracking
 between several Darcs repositories?

Shouldn't this be done by cabal, not darcs? i.e. cabal update querying
a list of repositories for info about available versions (think
standardised tags): cabal install can then figure out what to pull.

-- 
(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: about Haskell code written to be too smart

2009-03-27 Thread Achim Schneider
Colin Adams colinpaulad...@googlemail.com wrote:

 2009/3/27 Achim Schneider bars...@web.de:
  wren ng thornton w...@freegeek.org wrote:
 
  Colin Adams wrote:
   A reference to a research paper is fine to show where the ideas
   came from, but that is not where the library documentation
   should be.
 
  Yeah, that's bad. 'Documentation' like that should be corrected
  with Extreme Prejudice.
 
 I think I agree with that (I say I think, as I'm not sure what Extreme
 Prejuidice means).
 
Shoot err... rewrite before asking. If in doubt, annihilate.
Considering all options, just do it. Pity is a thing for judges, not
hackers. Something along those lines.

 
  The main problem with research papers as documentation is the papers
  usually being outdated wrt. the current library version: Literate
  Haskell is utterly underused.
 
 
 That's surely a problem, and a significant one.
 
 But what irks me is the time taken to find one small piece of
 information (how to use a single function).
 I would guess on average about the time to read 1/3 of the paper
 (since the back matter needn't be examined).

Hm. Yes. OTOH, I very much appreciate background information, it
usually contains very insightful information about the overall idea and
behaviour of a library. I'm by no means a domain expert for any
and every library I want to use.

In school, we were required to write both user[1] as well as
developer[2] documentation alongside to commenting our code. I tended
to loathe it, but it's very, very sensible in retrospect.

There was some discussion a while back here on the cafe about enabling
users to write additional documentation into a wikised hackage;
together with an #haskell-doc-tutor irc channel, we could have an
excellent solution to both lacking documentation as well as newbies
not being sure were to start and/or intimidated by pointless usage of
(.). Additionally, you get the chance of earning credits and naming and
shaming Haskell's godfathers[1].


[1] In the sense of using the code, either as app or library
[2] In the sense of editing/reading the code. Understanding [2] usually
involves understanding [1].
[3] Judging from his code, I guess dons' apartment looks just like
mine: Lots of left-over bits lying around that you tend to stumble
over and are unsure about why they are still there. I swear, someday
I'm going to use those two 5 1/4 floppy drives...

-- 
(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: about Haskell code written to be too smart

2009-03-26 Thread Achim Schneider
wren ng thornton w...@freegeek.org wrote:

 Colin Adams wrote:
  2009/3/25 wren ng thornton w...@freegeek.org:
  when I look up the Haddock-generated documentation for a function, I
  DON'T appreciate it if that is in the form of a hyperlink to a
  research paper.
  And that occurs in several of the libraries shipped with GHC for
  instance.
  
  A reference to a research paper is fine to show where the ideas came
  from, but that is not where the library documentation should be.
 
 Yeah, that's bad. 'Documentation' like that should be corrected with 
 Extreme Prejudice.
 
The main problem with research papers as documentation is the papers
usually being outdated wrt. the current library version: Literate
Haskell is utterly underused.


-- 
(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: about Haskell code written to be too smart

2009-03-25 Thread Achim Schneider
Alberto G. Corona  agocor...@gmail.com wrote:

 However, reusability of source code and maintainability has never
 been taken seriously by haskell programmers, simply because there are
 no industrial projects in Haskell with dozens of people with
 different skills that come and go.

Now that's a claim.

In the sense that I don't do commercial haskell coding, but know what
maintainability is, anyway: I've maintained everything from utterly
atrocious to mindboggingly elegant java code for a living. I can tell
you with 110% confidence that maintainability is about composibility,
_on_every_level_: Not just on statement-level. Otherwise, I wouldn't
have cussed that much. Curiously enough, as soon as the code
didn't make you whince, it was easily maintainable. This is closely
related to Linus' observation that good [imperative] code is
data-structure centred, and Greenspun's Tenth Rule.


With Haskell, there's finally a language that makes large-scale changes
as easy as small-scale changes without having to resort to implement an
interpreter for a functional language. As the position of changes tends
to travel upwards in a bottom-up approach and small-scale changes are
easy to pull off (you already understand what you need to do since
otherwise you wouldn't have identified the need for a small-scale
change and continued to add onion layers), caring about editability on
function level just doesn't pay off.


That's why I don't care whether or not I have to re-write a whole
function to change it: If it's going to change, which isn't all that
likely, I can cope with renaming it and write another say 160
characters directly below it. Adding a proper quickcheck property (if
it didn't exist, yet, or the semantics changed) is usually more work:
You don't only need to get the preposition right, but also the test
case generator.


-- 
(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: a cabal package with both a library and executable programs

2009-03-25 Thread Achim Schneider
Manlio Perillo manlio_peri...@libero.it wrote:

 Should I fill a feature request ticket, or this is how it is supposed
 to work?

I would like to be able to do that, too. I also don't want cabal to
recompile a thousand modules just for a demo program, and don't want to
see hackage being polluted by thousands of foo-lib and foo-bin packages
to circumvent the current behaviour, either.

That is, feel yourself seconded.

-- 
(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: about Haskell code written to be too smart

2009-03-25 Thread Achim Schneider
Manlio Perillo manlio_peri...@libero.it wrote:

 The main problem, here, is that:
 - recursion and pattern matching are explained in every tutorial about
functional programming and Haskell.
 
This is the reason why I find them more natural.
 
Well, you're going to have a hard time writing a BASIC tutorial without
mentioning GOTO. While surely it has to be there, for the sake of
completeness of fundamentals, I completely agree that...

 - high level, Haskell specific, abstractions, are *not* explained in
normal tutorials or books.
The libraries where these concepts are implemented, are not well
documented.
Most of the documentation is in research papers, and a normal
programmer don't want to read these papers.
 
Only in the recent Real World Haskell, all these high level
abstraction have been properly documented

...GOTO alone doesn't teach you how to write a loop, trust me, I was
stuck there for a good while, eons ago.

The prelude, as well as commonly used functions that should be in
there, utterly lack accompanying documentation. There should be no
function without a usage, as in foldl/sum/product, and no usage without
explanation why foldl is chosen over foldl' and foldr. Think of a
Preludopedia, accompanying the Typeclassopedia: Documentation where you
don't have to snatch understanding out of assem^H^H^H^H^H^H code
written using primitive recursion, to make it a bit easier to see the
wood despite of all those trees.

PS: Shouldn't zipWith be defined in terms of zip, uncurry and map
instead of 
zipWith f (a:as) (b:bs) = f a b : zipWith f as bs
zipWith _ _  _  = []
?

-- 
(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: Data Structures with Haskell

2009-03-25 Thread Achim Schneider
Rohit Agrawalla son...@gmail.com wrote:

 I am a beginner haskell programmer. I am interested  in data
 structures implementation (all from basic ones like stack, queues
 etc. to advance ones like balanced binary trees, graphs etc.)  in
 haskell. It would be really helpful if someone can point some good
 references for the same.
 
The fgl paper[1] is highly readable. It explains and solves the issues a
functional approach has to overcome that an imperative approach can
simply hack around and gave me many important insights into how to
think in a functional way as I was starting to learn Haskell. YMMV, but
if you're a decent imperative coder and/or got any kind of scheme or
ocaml experience most of it shouldn't be too hard to follow.


[1] http://web.engr.oregonstate.edu/~erwig/papers/abstracts.html#JFP01

-- 
(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: [OT] Japanese (was: Re: about Haskell code written to be too smart)

2009-03-25 Thread Achim Schneider
wren ng thornton w...@freegeek.org wrote:

 All natural languages are Thinking-complete.

No, they aren't. Falsifying the Saphir-Worph thesis, I quite often find
myself incapable of expressing a certain thought, or if I succeed,
come up with two or more versions in multiple different languages that
mean slightly different things, and, in retrospect, all don't fit the
thought. 

On another scale, it's just a waste of time: Why should I spend minutes
figuring out how to spell out Even though X - Y and X - nonsense, 
(Z - Y) - nonsense does not necessarily hold when I already figured
that one out.

All thoughts are fundamentally ineffable: Therefore, all languages are
thinking-incomplete.

-- 
(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: Are there performant mutable Arrays in Haskell?

2009-03-24 Thread Achim Schneider
Brettschneider, Matthias brettschnei...@hs-albsig.de wrote:

 Thx for your hints, I played around with them and the performance
 gets slightly better. But the major boost is still missing :) 
 
 I noticed, that one real bottleneck seems to be the conversion of the
 array back into a list. The interesting part is, if I use the elems
 function (Data.Array.Base) the performance is about 4x better then
 with my own function. So I thought, I write my own version of elems,
 (that just converts a part of the array to a list) and I fall back
 into the same performance as my first approach. 
 
 To make a long story short, here is the library code: 
 elems arr = case bounds arr of
   (_l, _u) - [unsafeAt arr i | i - [0 .. numElements arr - 1]
 
 And my version:
 boundedElems arr = case bounds arr of
   (_l, _u) - [unsafeAt arr i | i - [1737 .. 1752]]
 
 Is there a reason, why the library version is 4 times faster, than
 mine?

Uhhhmmm... I've got no idea. But as the list is constructed lazily, you
shouldn't expect a real speedup by being lazy manually, anyway. You
might want to try the stream-fusion list implementation of lists, or
get rid of lists, alltogether.

-- 
(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: Hugs on iPhone

2009-03-24 Thread Achim Schneider
John A. De Goes j...@n-brain.net wrote:

 
 Go ahead sell your GPL application. I'll get your code, build the  
 application, and sell it for less than half of what you're selling
 it for.
 
I don't think you can go below 0.79 in the Apple store, and I guess
you'll have a hard time convincing Apple to list your identical program
alongside with the original version.

 How exactly will you make your money, then?
 
Selling tapes, not software. Unless you invent something like the
internet that gets rid of time needed write tapes and packageshipment
costs, you're going to have a very, very hard time being cheaper than
anybody else unless you live on a different continent, and an
incredibly hard time financing the advertisement you need to place your
product more prominently than RMS can do simply by being himself.

 When people say, You can't make commercial software with GPL code,  
 they don't mean it's not legally possible to sell GPL code, only
 that it's not commercially viable.
 
Oh, it is. Id is still selling Quake I data files, and you'll be
surprised how much you're allowed to do since the GPL isn't the Affero
GPL.

-- 
(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: Hugs on iPhone

2009-03-24 Thread Achim Schneider
John A. De Goes j...@n-brain.net wrote:

 You simply can't make a living selling GPL software. If the
 software's complicated enough and you know your way around it, then
 you can sell support  maintenance. However, those conditions doesn't
 apply to consumer software, because consumers don't want complicated
 software.

Sure, times have changed. Still, go to a campus, figure out who doesn't
have internet access (personally, back then I bought a 100mb zip drive
to get my software). You might not be able to earn a living burning
Debian CD's, but you're going able to finance your beer consumption.
Not only because you're bound to get some free beer while helping
people to install it.

OTOH, magazines still come with CDs or DVDs, which means that there's a
demand for hard-copies of software. People _will_ buy your 1000 best
open source games collection. The costs of setting up distribution and
manufacturing will prevent others from doing the same: They'd rather
distribute other OSS software, avoiding competition that's only going
to lessen their own profits. Additionally to the physical medium,
you're providing the service of compiling the compilation, in the
first place: I can tell you it's a bugger to rummage through OSS games
to find out what's cool. 

Surely, it's not a big market and won't make you a millionaire, but no
source of income can be used by everyone without breaking down.


Just to make things clear: I wouldn't hand out venture capital to such
an endeavour, either.

-- 
(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: The votes are in!

2009-03-24 Thread Achim Schneider
Eelco Lempsink ee...@lempsink.nl wrote:

 My preference  
 would be to have one person with sense of (and education in, if  
 possible) design make some nice looking variations and have a second  
 (final) round of voting, but, we could also do the wiki-thing again ;)
 
That was the plan, yes. This time 'round, we should nitpick about
half-a-point-off layouts, as well as require sanely-written svg's or
even metapost, so we have clearly defined proportions of linewith vs.
gapwidth and so on.

I'm not sure whether it's good to deal with layout and colour in one
voting, the bickering about the last vote suggests it's better to do
multiple votes with a smaller quantity of options.

I'd say the next round is about triples of monochrome a) logo
appearance, b) logo with Haskell c) logo with Haskell and slogan.

...the problem being, we don't have an official slogan, yet. Maybe
there shouldn't be one and the candidates should just give example
layouts for a short, medium and long slogan.

Colour can be dealt with later, and t-shirt manufacturers can already
now begin to print variations that don't qualify for letter-heads, like
lambda-bind shaped quines and stuff.

-- 
(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: Equations for `foo' have different numbers of arguments

2009-03-24 Thread Achim Schneider
Manlio Perillo manlio_peri...@libero.it wrote:

 Hi.
 
 There is a limitation, in Haskell, that I'm not sure to understand.
 Here is an example:
 
 module Main where
 
 divide :: Float - Float - Float
 divide _ 0 = error division by 0
 divide = (/)
 
 main = do
print $ divide 1.0 0.0
print $ divide 4.0 2.0
 
 
 
 With GHC I get:
 Equations for `divide' have different numbers of arguments
 
 With HUGS:
 Equations give different arities for divide
 
 
 However the two equations really have the same number of arguments.
 
 What's the problem?
 
Equations not being what you think they are. They aren't the symbol
'divide' equals that function but lhs of '=', '=', and rhs of '='.
The problem is mostly syntactical, in the sense that most occurrences of
definitions with a different number of arguments are plain typos. The
other might be implementation issues: it makes pattern match rules
more complex.

-- 
(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: Equations for `foo' have different numbers of arguments

2009-03-24 Thread Achim Schneider
Martijn van Steenbergen mart...@van.steenbergen.nl wrote:

 f x y = bam x y

This would introduce another matching of x on the outside of bam, and I
don't know if this works without significantly messing with e.g.
strictness.

-- 
(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: SOC idea ticket: Rendering Engine

2009-03-23 Thread Achim Schneider
Csaba Hruska csaba.hru...@gmail.com wrote:

 svn checkout
 *http*://lambdacube.googlecode.com/svn/trunk/lambdacube-read-only
 
I think you mean
svn co http://lambdacube.googlecode.com/svn/trunk

I didn't do anything yet, except running the sample program. I get to
see an ogre head and this:

8

k...@solaris trunk % ./example1
[.,..,car,.svn,packs,materials,models]
[.,..,.svn,toonf2.frag,toonf2.vert,Example_CelShading.frag,Example_CelShading.vert,texturemapping.frag,texturemapping.vert,diffuse.frag,diffuse.vert,ambient.frag,ambient.vert]
 
[.,..,.svn,todo,Ogre.material,jaiqua.material,Scene.material,ogrehead.material,Robot.material,RZR-002.material]

   
load:
Ogre.material load:
jaiqua.material load:
Scene.material load:
ogrehead.material load:
Robot.material load:
RZR-002.material
[.,..,.svn,cel_shading_diffuse.png,r2skin.jpg,RZR-002.png,cel_shading_specular.png,cel_shading_edge.png,GreenSkin.jpg,spheremap.png,WeirdEye.png,dirt01.jpg,blue_jaiqua.jpg]
[.,..,.svn,Cube.mesh.xml,ogrehead.mesh.xml,athene.mesh.xml,ninja.mesh.xml,Suzanne.mesh.xml,RZR-002.mesh.xml,facial.mesh.xml,robot.skeleton.xml,robot.mesh.xml,jaiqua.mesh.xml]
[.,..,.svn,scooby_body.mesh.xml,scooby_body.material,ventanas.jpg,chasis.jpg,chasis_a.jpg]
load: scooby_body.material creating entity: OgreHead from mesh:
ogrehead.mesh.xml parsing XML
file
[Ogre/Tusks,Ogre/Earring,Ogre/Skin,Ogre/Eyes] compiling
material: Ogre/Eyes WeirdEye.png
loaded resolution = 256 x 256, 3 bytes per
pixel compiling material:
Ogre/Skin GreenSkin.jpg
loaded resolution = 256 x 256, 3 bytes per
pixel compiling material:
Ogre/Earring spheremap.png
loaded resolution = 256 x 256, 3 bytes per
pixel compiling material:
Ogre/Tusks dirt01.jpg
loaded resolution = 96 x 96, 3 bytes per
pixel
done creating entity: Robot from mesh:
robot2.mesh.xml parsing XML
file
[Examples/Robot] compiling material:
Examples/Robot r2skin.jpg
loaded resolution = 512 x 512, 3 bytes per
pixel Compiling program: (Just Examples/AmbientShadingVP,Just
Examples/AmbientShadingFP) Shader info log for
'Examples/AmbientShadingVP':


Shader info log for 'Examples/AmbientShadingFP':


Program info log:


 done
creating entity: Car from mesh: scooby_body.mesh.xml
parsing XML file
[Ac3d/Scooby_Body/Mat001_Tex03,Ac3d/Scooby_Body/Mat001_Tex02,Ac3d/Scooby_Body/Mat001_Tex01]
compiling material: Ac3d/Scooby_Body/Mat001_Tex01
chasis.jpg loaded
resolution = 512 x 512, 3 bytes per pixel
compiling material: Ac3d/Scooby_Body/Mat001_Tex02
ventanas.jpg loaded
resolution = 512 x 512, 3 bytes per pixel
compiling material: Ac3d/Scooby_Body/Mat001_Tex03
chasis_a.jpg loaded
resolution = 128 x 256, 3 bytes per pixel
 done
1 frames in 13.45548 seconds = 7.431916215549353e-2 FPS
zsh: abort  ./example1


8


I _think_ example1 is killed by SIGABRT, but I could be wrong, I've
never seen this before. Anyway, it's a strange thing.

OpenGL vendor string: NVIDIA Corporation 
OpenGL renderer string: GeForce 7600 GS/PCI/SSE2 
OpenGL version string: 2.1.2 NVIDIA 177.82 
OpenGL shading language version string: 1.20 NVIDIA via Cg compiler

X.Org X Server 1.5.3

Linux solaris 2.6.28-tuxonice-r1 #20 PREEMPT Tue Mar 10 19:07:36 CET
2009 x86_64 AMD Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux

The Glorious Glasgow Haskell Compilation System, version 6.10.1

-- 
(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: SOC idea ticket: Rendering Engine

2009-03-23 Thread Achim Schneider
Csaba Hruska csaba.hru...@gmail.com wrote:

  I _think_ example1 is killed by SIGABRT, but I could be wrong, I've
  never seen this before. Anyway, it's a strange thing.
   
 Does the program exit immediatly after the first rendered frame?

Usually yes, sometimes I'm seeing the ogre being rotated before
SIGABRT. At first I thought it might be the app getting confused by
xmonad resizing it, but switching to twm or kwm didn't help. I'm going
to investigate a bit further as soon as I figured out why xmonad
doesn't use xinerama(again) after re-compilation.

-- 
(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: Ease of Haskell development on OS X?

2009-03-22 Thread Achim Schneider
Colin Adams colinpaulad...@googlemail.com wrote:

 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include
 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
 -c _hashopenssl.c -o build/temp.macosx-10.3-i386-2.5/_hashopenssl.o
 unable to execute -DNDEBUG: No such file or directory

That's just flags, preceded by no command (or, rather, -DNDEBUG is
interpreted as a command, which doesn't make much sense). My crystal
ball says that the build script is dodgy and just tries to execute
$(CC) or something, which isn't set. You can investigate the script
and fix it, or complain with the python (or macports, whatever is
appropriate) guys.

-- 
(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: Completely confused by cabal

2009-03-22 Thread Achim Schneider
Colin Paul Adams co...@colina.demon.co.uk wrote:

 Why does cabal install nearly everything in the user repository rather
 than the global repository?


uh... because you're a mere user and don't have the rights to do so?

try su -, then cabal update to fill root's $HOME/.cabal with the
needed info, then proceed as usual.

TBH, though, I wouldn't use cabal as root, directly, use your distro's
package management system instead. Installing programs with your user
account, inside your home directory, is perfectly acceptable (and
traditional) under unix.

-- 
(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: Completely confused by cabal

2009-03-22 Thread Achim Schneider
Colin Paul Adams co...@colina.demon.co.uk wrote:

 Achim uh... because you're a mere user and don't have the rights
 Achim to do so?
 
 No, I own the machine.

Well, but it neither knows nor cares, unless you log in as root.
colin isn't allowed to write to /usr/local/lib/ghc-6.11.20090319/ .
root's and colin's home directories are distinct, as well, that's why
both need to do cabal update to install stuff: Users can't read root
(or any other user's) home directories; root could read colin's home
directory, but musn't trust any data in it, as colin could use that
trust to weasel root access.

 I can't. It doesn't provide up-to-date ghc and things.
 
insert snappy switch-to-gentoo comment here

 Achim programs with your user account, inside your home
 Achim directory, is perfectly acceptable (and traditional) under
 Achim unix.
 
 But it means I have to install everyhting twice - once as --user, once
 as --global.

No, you don't, the database ghc uses to compile stuff is a union of
both databases, user installs overriding global installs. Assuming that
you're the machine's only user, you only ever need to install stuff as
that user:

k...@solaris ~ % ghc-pkg list
/usr/lib64/ghc-6.10.1/./package.conf:
Cabal-1.6.0.1, HTTP-3001.1.4, QuickCheck-1.2.0.0,
QuickCheck-2.1.0.1, X11-1.4.4, X11-xft-0.3, array-0.2.0.0,
base-3.0.3.0, base-4.0.0.0, binary-0.4.4, bytestring-0.9.1.4,
cairo-0.10.0, containers-0.2.0.0, directory-1.0.0.2,
editline-0.2.1.0, filepath-1.1.0.0, filepath-1.1.0.1, gconf-0.10.0,
(ghc-6.10.1), ghc-paths-0.1.0.5, ghc-prim-0.1.0.0, glade-0.10.0,
glib-0.10.0, gtk-0.10.0, gtkglext-0.10.0, gtksourceview2-0.10.0,
haddock-2.4.1, haskell-src-1.0.1.3, haskell98-1.0.1.0, hpc-0.5.0.2,
html-1.0.1.2, integer-0.1.0.0, mozembed-0.10.0, mtl-1.1.0.2,
network-2.2.0.1, old-locale-1.0.0.1, old-time-1.0.0.1,
packedstring-0.1.0.1, parsec-3.0.0, pretty-1.0.1.0,
process-1.0.1.0, random-1.0.0.1, readline-1.0.1.0,
regex-base-0.93.1, regex-compat-0.92, regex-posix-0.93.2, rts-1.0,
soegtk-0.10.0, stm-2.1.1.2, svgcairo-0.10.0, syb-0.1.0.0,
template-haskell-2.3.0.0, unix-2.3.1.0, utf8-string-0.3.3,
zlib-0.5.0.0
/home/ksf/.ghc/x86_64-linux-6.10.1/package.conf:
MemoTrie-0.4.3, bytestring-mmap-0.2.0, bytestring-trie-0.1.4,
extensible-exceptions-0.1.1.0, ipprint-0.3, iteratee-0.1.1,
mmap-0.2, regex-posix-0.72.0.3

I basically did emerge cabal-install to bootstrap my installation, then
emerge gtk2hs as it's not available via hackage. Then, I install what
I need to hack as user using cabal install. (I recently nuked my
~/.cabal and ~/.ghc, that's why the user database is that small).

Installing ghc as user works equally well.

-- 
(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: Completely confused by cabal

2009-03-22 Thread Achim Schneider
Colin Paul Adams co...@colina.demon.co.uk wrote:

 So why doesn't it find packages then, when they are installed?

I've got no idea, what exactly are you trying to do, and how?

-- 
(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: Function to cast types

2009-03-22 Thread Achim Schneider
Anonymous Anonymous temp.pub...@gmail.com wrote:

 Hello,
 
 I'm new to haskell, I'm wondering how can you write a function that
 will do the following:
 
 fromIntToString :: Int - String
 
 this is a cast function to cast an Int to a String. I know such
 function exist, however let's assume it didn't exist. How would I
 write such function? 

I have no Idea, but this one works:

intOfChar c | c = '0'  c = '9' = fromEnum c - fromEnum '0'
intOfChar _ = undefined

intOfString = sum . map (uncurry (*)) . zip (map (10^) [0..]) 
. map intOfChar . reverse

...assuming that 0..9 are consecutive in the Char Enum, which they are.

Reading intOfString backwards, you get: reverse the string, change each
digit to its integer value, pair it up with the right power of 10,
multiply those pairs, and finally sum everything up.

You can replace map f . zip with zipWith f , but that doesn't change
much.

-- 
(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: Function to cast types

2009-03-22 Thread Achim Schneider
Achim Schneider bars...@web.de wrote:

 Anonymous Anonymous temp.pub...@gmail.com wrote:
 
  fromIntToString :: Int - String
  
 intOfString = sum . map (uncurry (*)) . zip (map (10^) [0..]) 
 . map intOfChar . reverse
 
/me hides under a stone and tries again, this time with the correct
problem:

import Data.List

charOfInt :: Int - Char
charOfInt c | c = 0  c = 9 = toEnum (c + fromEnum '0')
charOfInt _ = undefined

stringOfInt :: Int - String
stringOfInt =
let f (-1) = Nothing
f n = let (r,c) = n `divMod` 10
  in Just $ if r == 0 then (c, (-1)) else (c, r)
in map charOfInt . reverse . unfoldr f

That -1 thing is clearly inelegant, but I don't feel like struggling
with off-by-one errors, right now. Negative numbers are left as an
exercise.

-- 
(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


  1   2   3   4   5   6   >