Re: [Haskell-cafe] Re: Data.Binary Endianness

2007-09-11 Thread Sven Panne
On Monday 10 September 2007 21:02, apfelmus wrote:
 [...]
class Put a endian where
  put :: endian - a - Put
 [...]
 Oh, and the 8,16,32 and 64 are good candidates for phantom
 type/associated data types, too.

I think that using any non-H98 feature like MPTC or associated data types for 
such a generally useful and basic package would be a *big* mistake.  Let's 
follow the KISS principle here. Everybody is free to make a nicer, but 
non-portable wrapper...

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Sven Panne
On Monday 10 September 2007 19:50, Thomas Schilling wrote:
 [...]
 instance Binary MP3 where
   get = MP3 $ getHeader * getData -- [*]
 where getHeader = do magic - getWord32le
case magic of
...

Of course this works in the sense that it compiles, but Binary is 
conceptually the wrong class to use.

 to read a (IEEE) double you use

   do x - (get :: Double); ...

:Where is IEEE mentioned in the docs? Does it use LE/BE/host order? Plain 
get/put on Float/Double are useless for reading IEEE floating numbers.

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Don Stewart
sven.panne:
 On Monday 10 September 2007 19:50, Thomas Schilling wrote:
  [...]
  instance Binary MP3 where
get = MP3 $ getHeader * getData -- [*]
  where getHeader = do magic - getWord32le
   case magic of
 ...
 
 Of course this works in the sense that it compiles, but Binary is 
 conceptually the wrong class to use.

I wouldn't go as far as saying `wrong', for protocol-specific data types it 
seems reasonable for the Haskell serialisation to use an agreed-upon external
format, via a Binary instance.

It's cute, anyway.

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Sven Panne
On Tuesday 11 September 2007 08:14, Don Stewart wrote:
 sven.panne:
  On Monday 10 September 2007 19:50, Thomas Schilling wrote:
   [...]
   instance Binary MP3 where
 get = MP3 $ getHeader * getData -- [*]
   where getHeader = do magic - getWord32le
  case magic of
  ...
 
  Of course this works in the sense that it compiles, but Binary is
  conceptually the wrong class to use.

 I wouldn't go as far as saying `wrong', for protocol-specific data types it
 seems reasonable for the Haskell serialisation to use an agreed-upon
 external format, via a Binary instance.

The question is: What is the *human reader* suggested when he sees a signature 
like foo :: Binary a = ... - a - ...? This should probably mean foo is 
using some portable (de-)serialization, but doesn't care about the actual 
representation, at least this is how I understand Binary's contract from the 
Haddock docs. The example above means something completely different, so I 
propose to add another class (e.g. ExternalBinary, better name needed) to 
the binary package for such uses. This class wouldn't have any instances in 
the package itself, but at least it would set a standard, so things are 
crystal clear when one sees a signature like blah :: ExternalBinary a 
= ... - a - 

This situation is very similar to the OO-world, where class inheritance is 
often overused, just because it looks so handy when written initially and 
delegation/aggregation/... would be the conceptually right way (i.e. 
implementation hierarchy vs. interface hierarchy).

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Sven Panne
On Monday 10 September 2007 19:26, Don Stewart wrote:
 Yep, just send a patch. Or suggest what needs to happen.

OK, I'll see what I can do next weekend, currently I'm busy with 
packaging/fixing GHC. I have similar code lying around in various places, and 
it would be nice if there was a more officially sanctioned place to put this.

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Don Stewart
sven.panne:
 On Monday 10 September 2007 19:26, Don Stewart wrote:
  Yep, just send a patch. Or suggest what needs to happen.
 
 OK, I'll see what I can do next weekend, currently I'm busy with 
 packaging/fixing GHC. I have similar code lying around in various places, and 
 it would be nice if there was a more officially sanctioned place to put this.
 

Just in case people didn't see, the `binary' package lives on

http://darcs.haskell.org/binary/

However, Lennart Kolmodin, Duncan and I are actively maintaining and reviewing
patches, so send them to one (or all) of us for review.

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


Re: [Haskell-cafe] Re: Data.Binary Endianness

2007-09-11 Thread Lutz Donnerhacke
* apfelmus wrote:
 It's not that related, but I just got struck by an obvious idea, namely
 to put the endianness in an extra parameter

data Endianness = Little | Big | Host
putInt32 :: Endianness - Int - Put

Please add the endianess to the state of the monad Put.
  setendianess :: Endianness - Put

And for convinience please add the Network constructor to the type
Endianness. ,-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread clisper
haskell is greate
but i don't know how to start.

2007-09-11 



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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Ketil Malde
On Tue, 2007-09-11 at 09:10 +0200, Sven Panne wrote:
 foo :: Binary a = ... - a - ...? This should probably mean foo is
 using some portable (de-)serialization, but doesn't care about the
 actual representation, 

I'm probably missing something, but:

How can the format be portable if the representation isn't unambigously
defined?  And if it is unabmigously defined, what's wrong with using it
for externally defined data formats?

-k


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


[Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Peter Verswyvelen
The way I see it as a newcomer, Haskell shifts the typical imperical 
programming bugs like null pointers and buffer overruns towards 
space/time leaks, causing programs that either take exponentially long 
to complete, stack overflow, or fill up the swap file on disc because 
they consume gigabytes of memory. Other bugs I found are incomplete 
pattern matches at runtime, but I already got an email of how to fix 
this using an external tool, although it would be nice if this is part 
of the compiler/linker itself.


How well and how can a Haskell program be tested to make sure it does 
not cause these space/time bugs?  What tools are typically used?


Thanks,
Peter

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


Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Neil Mitchell
Hi Peter,

 The way I see it as a newcomer, Haskell shifts the typical imperical
 programming bugs like null pointers and buffer overruns towards
 space/time leaks, causing programs that either take exponentially long
 to complete, stack overflow, or fill up the swap file on disc because
 they consume gigabytes of memory.

Time bugs are quite rare - usually a simple profiling will fix them
up, and they are exactly the same sorts of bugs that exist in an
imperative programming language. Usually its a case of picking a
better algorithm, or thinking clever thoughts.

Space leaks are much more tricky - there are profiling tools, but I've
never got enough experience using them to say anything more than that.

 Other bugs I found are incomplete
 pattern matches at runtime, but I already got an email of how to fix
 this using an external tool

Did the email suggest using Catch? http://www-users.cs.york.ac.uk/~ndm/catch/

If you care enough about pattern matching, you can eliminate them all
statically.

Thanks

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


Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Peter Verswyvelen
Because I had a background in videogame development, I purchased The
Haskell School of Expression. I found this a great book, but it has a
fast pace, so be prepared.

To me, Haskell was a bit like climbing a mountain which is largely
covered by fog; you don't see anything until you've climbed high enough,
and then the view is really beautiful ;-)

Peter

clisper wrote:
 haskell is greate
 but i don't know how to start.
 2007-09-11
 
 clisper
 

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

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


[Haskell-cafe] Licenses and Libraries

2007-09-11 Thread H .
Hello,

I have some questions connected more with the licenses and libraries as the 
language itself:


Is it possible to:
- publish Haskell source code under the BSD3 license 
  - provide an executable binary together with the code including (compiled 
e.g. with 'ghc --make') standard (in the ghc compiler download) libraries of 
the base and/or other packages
- publish Haskell source code under the BSD3 license which will work with GTK2HS
  - provide an executable binary together with the code compiled with 'ghc --
make'

- does there have to be any special flags set to do so
- does there have to be included further notes about the libraries and/or there 
license 


--
Thanks in advance,
H.


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


Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Peter Verswyvelen
Well, I actually meant more something like the imperative equivalences 
of code coverage tools and unit testing tools, because I've read 
rumors that in Haskell, unit testing is more difficult because lazy 
evaluation will cause the units that got tested to be evaluated 
completely different depending on how they are used. In strict 
languages, this is not the case.



Neil Mitchell wrote:

Hi Peter,

  

The way I see it as a newcomer, Haskell shifts the typical imperical
programming bugs like null pointers and buffer overruns towards
space/time leaks, causing programs that either take exponentially long
to complete, stack overflow, or fill up the swap file on disc because
they consume gigabytes of memory.



Time bugs are quite rare - usually a simple profiling will fix them
up, and they are exactly the same sorts of bugs that exist in an
imperative programming language. Usually its a case of picking a
better algorithm, or thinking clever thoughts.

Space leaks are much more tricky - there are profiling tools, but I've
never got enough experience using them to say anything more than that.

  

Other bugs I found are incomplete
pattern matches at runtime, but I already got an email of how to fix
this using an external tool



Did the email suggest using Catch? http://www-users.cs.york.ac.uk/~ndm/catch/

If you care enough about pattern matching, you can eliminate them all
statically.

Thanks

Neil


  


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


Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Dougal Stanton
On 11/09/2007, Peter Verswyvelen [EMAIL PROTECTED] wrote:
 To me, Haskell was a bit like climbing a mountain which is largely
 covered by fog; you don't see anything until you've climbed high enough,
 and then the view is really beautiful ;-)

Either that or: the foothills are glorious, but as soon as you get
into the higher altitudes you can fall down a monad and not be able to
escape...

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


Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Neil Mitchell
Hi

 Well, I actually meant more something like the imperative equivalences
 of code coverage tools and unit testing tools,

hpc and HUnit cover these two things pretty perfectly. hpc will be in
GHC 6.8, and its really cool :-)

 because I've read
 rumors that in Haskell, unit testing is more difficult because lazy
 evaluation will cause the units that got tested to be evaluated
 completely different depending on how they are used. In strict
 languages, this is not the case.

That's a really weird statement, and one that goes completely opposite
to my view of things. Do you have sources for these rumours? In a pure
language, if you evaluate some code it will do exactly the same thing
every time - there is no different behaviour. If you test the code,
then run it again later, you'll get the same result. Compare that to
something like C where:

int breakRandomly = 0;

int return42()
{
   breakRandomly = !breakRandomly;
   return (breakRandomly ? 666 : 42);
}

In C you can test this, and it will work, then you can test it twice
with identical values, and it will break.

Lazy evaluation can hide bugs if you only demand some small portion of
the output, but if your property/test is constructed properly, you
shouldn't have any problem.

Thanks

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


Re[2]: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Bulat Ziganshin
Hello Sven,

Tuesday, September 11, 2007, 11:10:17 AM, you wrote:

 Haddock docs. The example above means something completely different, so I
 propose to add another class (e.g. ExternalBinary, better name needed) to

this looks correct form theoretical POV but don't forget that then you
will need to redefine each and every function working on Binary instances
-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Jules Bean

Ketil Malde wrote:

On Tue, 2007-09-11 at 09:10 +0200, Sven Panne wrote:

foo :: Binary a = ... - a - ...? This should probably mean foo is
using some portable (de-)serialization, but doesn't care about the
actual representation, 


I'm probably missing something, but:

How can the format be portable if the representation isn't unambigously
defined?  And if it is unabmigously defined, what's wrong with using it
for externally defined data formats?


It's portable because it works on other machines also running that exact 
version of Data.Binary, regardless of their CPU architecture (in 
particular, word size or endianness). That is the precise sense of 
'portable' used here.


The actual format used by Data.Binary is not explicitly described in any 
standard (although in most cases it's moderately obvious, and anyone can 
read the code), and it's not formally guaranteed that it will never 
change in a later version (although the maintainers will no doubt try 
very hard to ensure it doesn't); nor does it contain any automatic 
support for version-stamping to ensure backwards compatibility in the 
face of later unlooked-for format changes.


For these reasons, although it is very cool, I don't think it can be 
recommended as a basis for long-term file format definitions.


(All of the above speaks of the 'high-level' Data.Binary not the 
'low-level'.)


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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Ketil Malde
On Tue, 2007-09-11 at 12:01 +0100, Jules Bean wrote:

  How can the format be portable if the representation isn't unambigously
  defined?  And if it is unabmigously defined, what's wrong with using it
  for externally defined data formats?

 It's portable because it works on other machines also running that exact 
 version of Data.Binary, regardless of their CPU architecture (in 
 particular, word size or endianness). That is the precise sense of 
 'portable' used here.

Okay.  Data.Binary is not for persistence, then (since the format may
change between versions of the library, and presumably between different
compilers/RTS), but merely for transient serializing, as over a network
connection.

This isn't so obvious from the documentation (I myself have blatantly
used it for persistence and for reading in externally specified data),
and the functions involving FilePaths also tend confusing the issue
here.  Perhaps it could be made clearer?

Another way to avoid abuse of Data.Binary would be to add a unique magic
number to each stream, and throw an exception when a mismatching magic
number is encountered.

-k


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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Jules Bean

Ketil Malde wrote:

On Tue, 2007-09-11 at 12:01 +0100, Jules Bean wrote:


How can the format be portable if the representation isn't unambigously
defined?  And if it is unabmigously defined, what's wrong with using it
for externally defined data formats?


It's portable because it works on other machines also running that exact 
version of Data.Binary, regardless of their CPU architecture (in 
particular, word size or endianness). That is the precise sense of 
'portable' used here.


Okay.  Data.Binary is not for persistence, then (since the format may
change between versions of the library, and presumably between different
compilers/RTS), but merely for transient serializing, as over a network
connection.


I probably came over stronger than I intended. It is intended for 
persistence, too. My point is that, should a bug be discovered in 
Data.Binary, the maintainers may be forced to change the format and 
there is no mechanism in place for coping with that.





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


RE: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Peter Verswyvelen
 That's a really weird statement, and one that goes completely opposite
 to my view of things. Do you have sources for these rumours? In a pure
 language, if you evaluate some code it will do exactly the same thing
 every time - there is no different behaviour. If you test the code,

Sorry, I did not express myself correctly I guess. I did not mean different
behavior regarding the results that are computed (because that's the great
thing about Haskell; this is called referentially transparent isn't it?),
but I meant different time/space behavior. I'm not sure where I read this
rumor, but if I recall correctly, it had to do with FRP (functional
reactive programming), where it was stated that is was really difficult to
make sure that no space/time leaks occurred when the user started combining
functions in some way. But I might have understood it incorrectly; after
all, I'm still in the learning process.

Peter









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


RE: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread bf3
LOL! 

Another problem is that I always have to descend again for my main job which
involves C#/C++, and all that climbing up and down is *very* tiersome.

Peter

-Original Message-
From: Dougal Stanton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 11, 2007 12:44 PM
To: [EMAIL PROTECTED]
Cc: clisper; Haskell-Cafe
Subject: Re: [Haskell-cafe] Can somebody give any advice for beginners?

On 11/09/2007, Peter Verswyvelen [EMAIL PROTECTED] wrote:
 To me, Haskell was a bit like climbing a mountain which is largely
 covered by fog; you don't see anything until you've climbed high enough,
 and then the view is really beautiful ;-)

Either that or: the foothills are glorious, but as soon as you get
into the higher altitudes you can fall down a monad and not be able to
escape...

D.

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Brandon S. Allbery KF8NH


On Sep 11, 2007, at 7:01 , Jules Bean wrote:

The actual format used by Data.Binary is not explicitly described  
in any standard (although in most cases it's moderately obvious,  
and anyone can read the code), and it's not formally guaranteed  
that it will never change in a later version (although the  
maintainers will no doubt try very hard to ensure it doesn't); nor  
does it contain any automatic support for version-stamping to  
ensure backwards compatibility in the face of later unlooked-for  
format changes.


I will just point out that, while this is one extreme, the other  
extreme is ASN.1.  I think we want to walk the middle path instead


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


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


[Haskell-cafe] Re: Tiny documentation request

2007-09-11 Thread Simon Marlow

Sven Panne wrote:


2. Could we make is so all items are collapsed initially? (Currently
they're all expended initially - which makes it take rather a long time
to find anything.)


Again this depends on the use case: I'd vote strongly against collapsing the 
list initially, because that way the incremental search in Firefox won't work 
without un-collapsing everything.


This is exactly why the list is expanded by default.  At first I made it 
default to collapsed, and people complained (possibly Sven, in fact :-).


When the index is generated with a more recent Haddock, you get a search 
field, which does an incremental search, so this might perhaps be more what 
you are looking for.


A more aesthetical note: We should really get rid of the ugly table/CSS layout 
mixture, the lower part of the page renders a bit ugly and varies between 
browsers. Switching to pure CSS should be safe in 2007, I guess.


Please, please, someone do this for me.  I tried, and failed, to get the 
layout right for the contents list in all browsers at the same time.  The 
semantics of CSS is beyond my comprehension.


Cheers,
Simon

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


Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Brent Yorgey
On 9/11/07, clisper [EMAIL PROTECTED] wrote:

  haskell is greate
 but i don't know how to start.


A good place to start is the Haskell wiki:

http://haskell.org/haskellwiki/Haskell

On the left, look under Learning Haskell -- there's all kinds of great
stuff linked from there.  I would also suggest hanging out in the #haskell
IRC channel on irc.freenode.net -- it's a great place to learn and ask
questions.

If you give us more information about your programming/mathematics
background, why you're learning Haskell, what you hope to get out of it,
etc. I'm sure people could also give you some more specific suggestions.

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


[Haskell-cafe] Re: Tiny documentation request

2007-09-11 Thread Simon Marlow

Thomas Schilling wrote:


However, regarding the modules list.  I think it should be easy to have
optional javascript functionality to toggle the visibility of the module
tree.  The default visibility could be customized using a cookie.


I don't know how to make cookies work purely in Javascript - presumably 
there's a way, though.  I'm accepting patches!


Cheers,
Simon

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


Re: [Haskell-cafe] Tiny documentation request

2007-09-11 Thread Jules Bean

Andrew Coppin wrote:
OTOH, I recently discovered that GHCi has the ability to show you what's 
defined in a given module without me having to wait 40 seconds for 
Firefox to start... Shame you can't scroll its output. (And still no 
help if you're not sure of the module name.)


!!!

Run ghci in an environment with a scroll buffer then? Like a 
non-braindead terminal application, or emacs? (The latter even gives you 
convenient reverse-incremental-search to search through the info you 
just printed)


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


[Haskell-cafe] haskell and reflection

2007-09-11 Thread Greg Meredith
Haskellians,

Am i wrong in my assessment that the vast majority of reflective machinery
is missing from Haskell? Specifically,

   - there is no runtime representation of type available for
   programmatic representation
   - there is no runtime representation of the type-inferencing or
   checking machinery
   - there is no runtime representation of the evaluation machinery
   - there is no runtime representation of the lexical or parsing
   machinery

Best wishes,

--greg

-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
505 N 72nd St
Seattle, WA 98103

+1 206.650.3740

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


Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread David Roundy
On Tue, Sep 11, 2007 at 01:59:40PM +0200, Peter Verswyvelen wrote:
  That's a really weird statement, and one that goes completely opposite
  to my view of things. Do you have sources for these rumours? In a pure
  language, if you evaluate some code it will do exactly the same thing
  every time - there is no different behaviour. If you test the code,
 
 Sorry, I did not express myself correctly I guess. I did not mean different
 behavior regarding the results that are computed (because that's the great
 thing about Haskell; this is called referentially transparent isn't it?),
 but I meant different time/space behavior. I'm not sure where I read this
 rumor, but if I recall correctly, it had to do with FRP (functional
 reactive programming), where it was stated that is was really difficult to
 make sure that no space/time leaks occurred when the user started combining
 functions in some way. But I might have understood it incorrectly; after
 all, I'm still in the learning process.

Yeah, that makes sense.  Space leaks are tricky, and unit testing can only
verify that under particular usage scenarios they don't occur, but in
another case they might pop up.  Generally, strict data types can help a
lot in preventing space leaks, but can't always solve the problems.  I long
for a Data.Map.Strict, for instance, because it's so hard to use Data.Map
without producing memory leaks...
-- 
David Roundy
Department of Physics
Oregon State University
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskell and reflection

2007-09-11 Thread Neil Mitchell
Hi

 there is no runtime representation of type available for programmatic
 representation

Data.Typeable.typeOf :: Typeable a = a - TypeRep

 there is no runtime representation of the type-inferencing or checking
 machinery

Pretty much, no. The GHC API may provide some.

 there is no runtime representation of the evaluation machinery

Yhc provides some representation with the Yhc API.

 there is no runtime representation of the lexical or parsing machinery

lex provides some of this. There are various Haskell parsers out there
in packages for us.


I wouldn't have considered these things reflection - certainly the
Java/C# use of the word reflection is quite different. Data.Generics
does provide many of the reflection capabilities of Java.

Thanks

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


Re: [Haskell-cafe] haskell and reflection

2007-09-11 Thread Greg Meredith
Neil,

Thanks very much for the detailed response. When we did Rosette, a
reflective actor-based language, back in the late '80's and early '90's, we
were very much influenced by Brian Cantwell Smith's account of reflection in
3-Lisp and similarly by Friedman and Wand's Mystery of the Tower Revealed.
Our analysis suggested the following breakdown

   - Structural reflection -- all data used in the evaluation of programs
   has a programmatic representation
   - Procedural reflection -- all execution machinery used in the
   evaluation of programs has a programmatic representation

The Java notion of reflection is restricted entirely to the first case and
then only to the data used once a normalized representation has been
achieved. In fact, lexing and parsing are of considerable interest and
complexity in the evaluation of programs and reflective access is extremely
useful.

Likewise, access to the evaluation machinery itself is of more than
theoretical interest. For example, in an ATM network management system i
wrote in Rosette, i used reflective methods -- where the evaluation itself
could be captured, stored and manipulated, much like a 1-shot continuation
-- to make a polling interface of an external trouble-ticketing system we
were required by business constraints to interface with look like an
interrupt-driven interface to the Rosette-based clients.

Best wishes,

--greg

On 9/11/07, Neil Mitchell [EMAIL PROTECTED] wrote:

 Hi

  there is no runtime representation of type available for programmatic
  representation

 Data.Typeable.typeOf :: Typeable a = a - TypeRep

  there is no runtime representation of the type-inferencing or checking
  machinery

 Pretty much, no. The GHC API may provide some.

  there is no runtime representation of the evaluation machinery

 Yhc provides some representation with the Yhc API.

  there is no runtime representation of the lexical or parsing machinery

 lex provides some of this. There are various Haskell parsers out there
 in packages for us.


 I wouldn't have considered these things reflection - certainly the
 Java/C# use of the word reflection is quite different. Data.Generics
 does provide many of the reflection capabilities of Java.

 Thanks

 Neil




-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
505 N 72nd St
Seattle, WA 98103

+1 206.650.3740

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


Re: [Haskell-cafe] haskell and reflection

2007-09-11 Thread Jules Bean

Greg Meredith wrote:

Haskellians,

Am i wrong in my assessment that the vast majority of reflective 
machinery is missing from Haskell? Specifically,


* there is no runtime representation of type available for
  programmatic representation
* there is no runtime representation of the type-inferencing or
  checking machinery
* there is no runtime representation of the evaluation machinery
* there is no runtime representation of the lexical or parsing
  machinery 



As far as they go, those are true.

Haskell compiler are permitted to erase types and GHC does so. There is 
no need to check types at runtime; that's the point of the system! There 
is no evaluator, or parser, built in to the standard libraries. (The 
lexer, or a version of it, is embedded in actual fact but that's not 
very exciting).


However, one should not draw too strong negative conclusions from this. 
It is possible to get suprisingly far with more powerful, more typesafe 
techniques without surrendering the the pure dynamism of languages that 
lack compile-time guarantees. Deriving Typeable and Data is one tool 
which is useful.


It is quite possible to embed a haskell compiler, see hs-plugins.

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Neil Davies
So the answer for persistence is Data.Binary - ASN.1 converter that
can be used in extrema?

On 11/09/2007, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:

 On Sep 11, 2007, at 7:01 , Jules Bean wrote:

  The actual format used by Data.Binary is not explicitly described
  in any standard (although in most cases it's moderately obvious,
  and anyone can read the code), and it's not formally guaranteed
  that it will never change in a later version (although the
  maintainers will no doubt try very hard to ensure it doesn't); nor
  does it contain any automatic support for version-stamping to
  ensure backwards compatibility in the face of later unlooked-for
  format changes.

 I will just point out that, while this is one extreme, the other
 extreme is ASN.1.  I think we want to walk the middle path instead

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


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

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


Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Justin Bailey
On 9/11/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:
 How well and how can a Haskell program be tested to make sure it does
 not cause these space/time bugs?  What tools are typically used?

I've been fighting this myself. I had an especially nasty
stack-overflow that took me weeks to track down. Of course, when I
did, I used the tried-and-true divide-and-conquer approach. I found a
case where my program consistently crashed, then I added output to see
what was executed just before hand (luckily I was already in the IO
monad). Finally, I wrote a test program that crashed the same way and
was able to fix the bug. ANd, of course, it turned out to be my usage
of foldr' - which is what I should have focused on first. Oh well.

As for memory usage, I've been using the heap profiling tools in GHC
quite a bit. They are scary at first, because they require you to
compare postscript graphs, but once you spend some time with them they
are actually very useful.

This article describes an early version of the tools in GHC:

  http://citeseer.ist.psu.edu/runciman96heap.html

And a web search using Heap profiling for space efficiency in
functional programs gives some nice results.

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


[Haskell-cafe] Re: Tiny documentation request

2007-09-11 Thread manu


On Sep 11, 2007, Simon Marlow wrote:


Please, please, someone do this for me.  I tried, and failed, to  
get the
layout right for the contents list in all browsers at the same  
time.  The

semantics of CSS is beyond my comprehension.

Cheers,
Simon


Hi Simon,

On the page http://www.haskell.org/ghc/docs/latest/html/libraries/ 
index.html, you only need tables to display the foldable lists of  
modules (HTML tables were commonly used to display many things on a  
same line), but they can be replaced by nested lists with a bit of CSS :


Check this page out : http://la.di.da.free.fr/haddock/

I can help further, if need be.

Emmanuel


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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Bryan O'Sullivan

Jules Bean wrote:

For these reasons, although it is very cool, I don't think it can be 
recommended as a basis for long-term file format definitions.


Indeed, the authors have never claimed that this is what it's for. 
Unfortunately, because the authors haven't *disclaimed* this as a 
purpose, people have fairly reasonably assumed that this *is* the intent 
of the package.


In conversations with Don and Duncan, they've always been quite clear 
that Data.Binary is intended to shovel bits rapidly and with a 
reasonable interface.  All of the things of which you speak, and more 
useful ones such as RTTI and representation of cyclic data, ought to 
live in a higher-level library.  Said library merely hasn't been written 
yet.


(All of the above speaks of the 'high-level' Data.Binary not the 
'low-level'.)


Data.Binary *is* the low-level Data.Binary :-)

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Jules Bean

Bryan O'Sullivan wrote:
(All of the above speaks of the 'high-level' Data.Binary not the 
'low-level'.)


Data.Binary *is* the low-level Data.Binary :-)


I was distinguishing between these two levels:

(1) High-level = Binary typeclass. Contains instances for many, many 
useful common types, the internals of which you don't need to understand 
to use them. But then you wont' understand the format used. Which 
doesn't matter if all you want to do is pipe stuff around.


(2) Low-level = Get and Put typeclasses. Allow you to shovel bytes as 
you wish, including bundling them up into words of various sizes with 
explicit endian-ness control. You can sensibly use this to define file 
formats precisely with some reasonable expectation of speed. You could 
for example write a TIFF reader (and writer [*]) using these primitives.


Jules

[*] - exercise for the reader: Can you write a TIFF reader and writer 
simultaneously, in the sense that you define the file format once and 
get Get and Put instances for free?

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


Re: [Haskell-cafe] haskell and reflection

2007-09-11 Thread Greg Meredith
Jules,

Thanks for these comments. i wouldn't judge Haskell solely on the basis of
whether it embraced reflection as an organizing computational principle or
as a toolbox for programmers. Clearly, you can get very far without it. And,
it may be that higher-order functional gives you enough of the 'programs
that build programs' capability that 80% of the practical benefits of
reflection are covered -- without having to take on the extra level of
complexity that reflection adds to typing. i was really just seeking
information.

Best wishes,

--greg

On 9/11/07, Jules Bean [EMAIL PROTECTED] wrote:

 Greg Meredith wrote:
  Haskellians,
 
  Am i wrong in my assessment that the vast majority of reflective
  machinery is missing from Haskell? Specifically,
 
  * there is no runtime representation of type available for
programmatic representation
  * there is no runtime representation of the type-inferencing or
checking machinery
  * there is no runtime representation of the evaluation machinery
  * there is no runtime representation of the lexical or parsing
machinery


 As far as they go, those are true.

 Haskell compiler are permitted to erase types and GHC does so. There is
 no need to check types at runtime; that's the point of the system! There
 is no evaluator, or parser, built in to the standard libraries. (The
 lexer, or a version of it, is embedded in actual fact but that's not
 very exciting).

 However, one should not draw too strong negative conclusions from this.
 It is possible to get suprisingly far with more powerful, more typesafe
 techniques without surrendering the the pure dynamism of languages that
 lack compile-time guarantees. Deriving Typeable and Data is one tool
 which is useful.

 It is quite possible to embed a haskell compiler, see hs-plugins.

 Jules




-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
505 N 72nd St
Seattle, WA 98103

+1 206.650.3740

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


[Haskell-cafe] Re: Can somebody give any advice for beginners?

2007-09-11 Thread Gracjan Polak
clisper clisper at 163.com writes:

 
 
 haskell is greate
 but i don't know how to start.
  

Don't!

Learning Haskell will change your world! For worse! Really! Don't do that, 
you still have time to go back! Or be damned like all of us here...

Referential transparency will suck up your soul. You'll think about monads 
as your warm and fuzzy friends. You'll wash your hands after doing IO 
because you'll feel that your purity suffered.

You'll consider unit testing a downgraded form of static typing. When your
programs finally compile, they will magically just work. You'll write 
less and less KLOC, doing more at the same time.

Your C#/C++/Java code will look like higher order code after first order
transformation done by hand. Your co-workers and friends will not understand 
what you wrote any more. You'll be like a wizard from another planet for them.

You will know the difference between foldl and foldr.

All your data structures will be infinite in size. Space leaks will bite you
hard. Your functions will be not lazy enough in some arguments and not strict
enough in some others at the same time. And even seq will not help you.

You'll know what MPTCs and GADTs are. You'll actually understand olegs posts.
You'll wonder, what was that OO thing again? You'll take out Java from your CV.

Take a friendly advice: go back and forget that you ever heard about Haskell!

-- 
Gracjan


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


Re: [Haskell-cafe] Re: Can somebody give any advice for beginners?

2007-09-11 Thread Jonathan Cast
On Tue, 2007-09-11 at 16:55 +, Gracjan Polak wrote:
 clisper clisper at 163.com writes:
 
  
  
  haskell is greate
  but i don't know how to start.
   
 
 Don't!
 
 Learning Haskell will change your world! For worse! Really! Don't do that, 
 you still have time to go back! Or be damned like all of us here...
 
 Referential transparency will suck up your soul. You'll think about monads 
 as your warm and fuzzy friends. You'll wash your hands after doing IO 
 because you'll feel that your purity suffered.
 
 You'll consider unit testing a downgraded form of static typing. When your
 programs finally compile, they will magically just work. You'll write 
 less and less KLOC, doing more at the same time.
 
 Your C#/C++/Java code will look like higher order code after first order
 transformation done by hand. Your co-workers and friends will not understand 
 what you wrote any more. You'll be like a wizard from another planet for them.
 
 You will know the difference between foldl and foldr.

And never to use either one.  Long live foldl'!

 All your data structures will be infinite in size. Space leaks will bite you
 hard. Your functions will be not lazy enough in some arguments and not strict
 enough in some others at the same time. And even seq will not help you.
 
 You'll know what MPTCs and GADTs are. You'll actually understand olegs posts.
 You'll wonder, what was that OO thing again? You'll take out Java from your 
 CV.
 
 Take a friendly advice: go back and forget that you ever heard about Haskell!

jcc


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


Re: [Haskell-cafe] haskell and reflection

2007-09-11 Thread Lauri Alanko
On Tue, Sep 11, 2007 at 07:33:54AM -0700, Greg Meredith wrote:
 Our analysis suggested the following breakdown
 
- Structural reflection -- all data used in the evaluation of programs
has a programmatic representation
- Procedural reflection -- all execution machinery used in the
evaluation of programs has a programmatic representation
 
 The Java notion of reflection is restricted entirely to the first case

Then what would you call ClassLoader.defineClass?

As for Haskell, there are various tools for both (at least
Data.Typeable and hs-plugins), but neither are truly type-safe: it is
possible to write code that uses these libraries and type-checks, yet
crashes. Static typing makes reflection very difficult to support
safely.

You might be interested in my MS thesis, where I explored these issues
in some more length: http://www.cs.helsinki.fi/u/lealanko/alanko04types.pdf


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


[Haskell-cafe] Basic FFI with GHC

2007-09-11 Thread Ronald Guida

How do I create C-libraries that I can load into GHCi?  I am trying to
do some basic FFI, and it's not working.

Here's the background.  I created three files, foo.h, foo.cpp, and
test_foo.lhs. (source code below)

Note: I am using MinGW/Msys under Windows XP.

If I compile foo.cpp and then try to load test_foo into GHCi, I get an
error.  OTOH, if I compile test_foo with GHC, it works.  I just don't
understand why it works one way and not the other.

What am I doing wrong?

-- Ron

--
Shell commands
--

$ gcc -c foo.cpp

$ ghci test_foo.lhs foo.o
  ___ ___ _
 / _ \ /\  /\/ __(_)
/ /_\// /_/ / /  | |  GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Loading object (static) foo.o ... done
final link ... done
[1 of 1] Compiling Main ( test_foo.lhs, interpreted )

During interactive linking, GHCi couldn't find the following symbol:
 foo
This may be due to you not asking GHCi to load extra object files,
[snip]

$ ghc --make test_foo.lhs foo.o
[1 of 1] Compiling Main ( test_foo.lhs, test_foo.o )
Linking test_foo.exe ...

$ test_foo.exe
Entering main
y = 22
Exiting main

$ ar rcs libfoo.a foo.o

$ ghc --make test_foo.lhs -lfoo

$ test_foo.exe
Entering main
y = 22
Exiting main

$ ghci test_foo.lhs -lfoo
  ___ ___ _
 / _ \ /\  /\/ __(_)
/ /_\// /_/ / /  | |  GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Loading object (dynamic) foo ... failed.
Dynamic linker error message was:
  addDLL: unknown error
Whilst trying to load:  (dynamic) foo
Directories to search are:
: user specified .o/.so/.DLL could not be loaded.

--
Source code
--

// foo.h

extern C
{
 __stdcall int foo(int x);
}

--

// foo.cpp
#include foo.h

__stdcall int foo(int x)
{
 return 3 * x + 1;
}

--

test_foo.lhs

 {-# OPTIONS_GHC -fglasgow-exts #-}
 module Main
 where
 import Foreign
 import Foreign.C

 foreign import stdcall unsafe foo
   c_Foo :: Word32 - IO Word32

 main = do
   putStrLn Entering main
   let x = 7::Word32
   y - c_Foo(x)
   putStrLn $ y =  ++ show y
   putStrLn Exiting main


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


Re: [Haskell-cafe] Re: Tiny documentation request

2007-09-11 Thread Miguel Mitrofanov
When the index is generated with a more recent Haddock, you get a  
search field, which does an incremental search, so this might  
perhaps be more what you are looking for.
A more aesthetical note: We should really get rid of the ugly  
table/CSS layout mixture, the lower part of the page renders a bit  
ugly and varies between browsers. Switching to pure CSS should be  
safe in 2007, I guess.


Please, please, someone do this for me.  I tried, and failed, to  
get the layout right for the contents list in all browsers at the  
same time.  The semantics of CSS is beyond my comprehension.


Well, I'm not a web designer, but I did work with few of them, and it  
seems to me that you either create a table design in two hours or  
spend three days trying to create a CSS one and THEN create a table  
design in two hours.

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


Re: [Haskell-cafe] haskell and reflection

2007-09-11 Thread Reinier Lamers


Op 11-sep-2007, om 18:43 heeft Greg Meredith het volgende geschreven:
Thanks for these comments. i wouldn't judge Haskell solely on the  
basis of whether it embraced reflection as an organizing  
computational principle or as a toolbox for programmers. Clearly,  
you can get very far without it. And, it may be that higher-order  
functional gives you enough of the 'programs that build programs'  
capability that 80% of the practical benefits of reflection are  
covered -- without having to take on the extra level of complexity  
that reflection adds to typing. i was really just seeking information.
Template Haskell [1] is a system that lets you write programs that  
get executed at *compile time*, and that produce parts of the Haskell  
program to be compiled by manipulating a representation of the  
program as structured data. It's a form of reflection restricted to  
compile time, if you'd ask me.


Regards,
Reinier

[1] http://www.haskell.org/haskellwiki/Template_Haskell
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Don Stewart
bf3:
 The way I see it as a newcomer, Haskell shifts the typical imperical 
 programming bugs like null pointers and buffer overruns towards 
 space/time leaks, causing programs that either take exponentially long 
 to complete, stack overflow, or fill up the swap file on disc because 
 they consume gigabytes of memory. Other bugs I found are incomplete 
 pattern matches at runtime, but I already got an email of how to fix 
 this using an external tool, although it would be nice if this is part 
 of the compiler/linker itself.
 
 How well and how can a Haskell program be tested to make sure it does 
 not cause these space/time bugs?  What tools are typically used?

Stress testing is good for catching performance bugs. 
And space leaks are rare, and usually glaringly obvious.

Incomplete pattern matches you can avoid with -Wall and Neil's tool 'Catch'.
QuickCheck should also be employed liberally.

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


Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Don Stewart
bf3:
 Well, I actually meant more something like the imperative equivalences 
 of code coverage tools and unit testing tools, because I've read 
 rumors that in Haskell, unit testing is more difficult because lazy 
 evaluation will cause the units that got tested to be evaluated 

We have full control over evaluation though, with bang patterns, seq and deep 
seq. 

Generally unit testing is generalised to property testing with QuickCheck, 
though.

For code coverage, combined with testing, use HPC, the program coverage tool 
now in GHC head.

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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Andrew Coppin

Don Stewart wrote:


Just in case people didn't see, the `binary' package lives on

http://darcs.haskell.org/binary/

However, Lennart Kolmodin, Duncan and I are actively maintaining and reviewing
patches, so send them to one (or all) of us for review.
  


Right. And this is the real binary package then? (I've seen references 
to seemingly half a dozen binary packages, some obsolete, some not... 
It's rather confusing out there!)


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


Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Andrew Coppin

Dougal Stanton wrote:

On 11/09/2007, Peter Verswyvelen [EMAIL PROTECTED] wrote:
  

To me, Haskell was a bit like climbing a mountain which is largely
covered by fog; you don't see anything until you've climbed high enough,
and then the view is really beautiful ;-)



Either that or: the foothills are glorious, but as soon as you get
into the higher altitudes you can fall down a monad and not be able to
escape...
  


At the risk of being told to STHU again... somebody should collect these 
things and keep them somewhere!


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


Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Dan Piponi
On 9/11/07, Andrew Coppin [EMAIL PROTECTED] wrote:
 you can fall down a monad and not be able to
  escape...

It's not so bad. It's in the nature of monads that after you've fallen
in once, you can never get trapped any deeper.
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Ronald Guida

Dan Piponi wrote:
 On 9/11/07, Andrew Coppin [EMAIL PROTECTED] wrote:
 you can fall down a monad and not be able to escape...

 It's not so bad. It's in the nature of monads that after you've fallen
 in once, you can never get trapped any deeper.

But you can climb higher...
(Note: Best viewed in mono-space!)


Programmer's
 Nirvana plane
 ---
   Categoric plane
 ---
  Co-Monadic plane
(Co- everything)
 -
  Applicative plane
--
  Pointless-pointfree plane
--
  Monadic plane  (don't get trapped)
------
  Functional plane  (Haskell et al!)
------
  Imperative plane  ASM, C#, Java :)
------
  Physical plane  (e.g. Silicon)


-- Ron

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


Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread David Menendez
On 9/11/07, Andrew Coppin [EMAIL PROTECTED] wrote:
 Dougal Stanton wrote:
  On 11/09/2007, Peter Verswyvelen [EMAIL PROTECTED] wrote:
 
  To me, Haskell was a bit like climbing a mountain which is largely
  covered by fog; you don't see anything until you've climbed high enough,
  and then the view is really beautiful ;-)
 
 
  Either that or: the foothills are glorious, but as soon as you get
  into the higher altitudes you can fall down a monad and not be able to
  escape...
 

 At the risk of being told to STHU again... somebody should collect these
 things and keep them somewhere!

The logical place would be http://haskell.org/haskellwiki/Humor.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tiny documentation request

2007-09-11 Thread Adrian Hey

Jules Bean wrote:

Andrew Coppin wrote:
OTOH, I recently discovered that GHCi has the ability to show you 
what's defined in a given module without me having to wait 40 seconds 
for Firefox to start... Shame you can't scroll its output. (And still 
no help if you're not sure of the module name.)


!!!

Run ghci in an environment with a scroll buffer then? Like a 
non-braindead terminal application, or emacs? (The latter even gives you 
convenient reverse-incremental-search to search through the info you 
just printed)


I don't know if Andrew is a windows user, but if so he might not be
aware that even with the (otherwise braindead) command window the
number of lines buffered is a configurable property (on WinXP at least).
I have it set to 1000 lines.

The other thing I've found that makes the use of command line tools
a lot less painful than it would otherwise be in windows is the
Open Command Window Here Power Toy..

http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

It's still nowhere near as good as the old XTree though :-(

Regards
--
Adrian Hey




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


Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Don Stewart
andrewcoppin:
 Don Stewart wrote:
 
 Just in case people didn't see, the `binary' package lives on
 
  http://darcs.haskell.org/binary/
 
 However, Lennart Kolmodin, Duncan and I are actively maintaining and 
 reviewing
 patches, so send them to one (or all) of us for review.
   
 
 Right. And this is the real binary package then? (I've seen references 
 to seemingly half a dozen binary packages, some obsolete, some not... 
 It's rather confusing out there!)

Yep. Look on hackage to get a sense of what is current.

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


Re: [Haskell-cafe] Licenses and Libraries

2007-09-11 Thread Don Stewart
h._h._h._:
 Hello,
 
 I have some questions connected more with the licenses and libraries as the 
 language itself:
 
 
 Is it possible to:
 - publish Haskell source code under the BSD3 license 
   - provide an executable binary together with the code including (compiled 
 e.g. with 'ghc --make') standard (in the ghc compiler download) libraries 
 of 
 the base and/or other packages
 - publish Haskell source code under the BSD3 license which will work with 
 GTK2HS
   - provide an executable binary together with the code compiled with 'ghc --
 make'
 
 - does there have to be any special flags set to do so
 - does there have to be included further notes about the libraries and/or 
 there 
 license 
 

You should feel entirely free to do whatever you wish with the language.

Particular tools and libraries are licensed individually, and most are BSD, or
more rarely LGPL or GPL licensed. BSD is preferred, and required for foundation
libraries.

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


[Haskell-cafe] GraphicsMagick binding for Haskell

2007-09-11 Thread Tim Chevalier
As a Hackathon project, I'm thinking of trying to write a Haskell
binding for the GraphicsMagick image manipulation library
(http://www.graphicsmagick.org/). Has anyone done this already? If
not, would anyone else besides me use it? If you think there's a
better library out there that serves a similar purpose, feel free to
tell me about it as well.

Cheers,
Tim

-- 
Tim Chevalier * catamorphism.org * Often in error, never in doubt
Work is there when love is gone -- Greg Brown
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread PR Stanley

Hi
take 1000 [1..3] still yields [1,2,3]
I thought it was supposed to return an error.
Any ideas?
Thanks, Paul

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Tim Chevalier
On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:
 Hi
 take 1000 [1..3] still yields [1,2,3]
 I thought it was supposed to return an error.
 Any ideas?

No, that's the behavior for take specified in the Haskell 98 report:
http://haskell.org/onlinereport/standard-prelude.html
-- take n, applied to a list xs, returns the prefix of xs of length n,
-- or xs itself if n  length xs.

Cheers,
Tim

-- 
Tim Chevalier * catamorphism.org * Often in error, never in doubt
Modesty...is both alien and irrelevant to people who are happy in
themselves, in their beings, in their skins, their natures, their
capacities.--Anne Sayre
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Brent Yorgey
On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:

 Hi
 take 1000 [1..3] still yields [1,2,3]
 I thought it was supposed to return an error.
 Any ideas?
 Thanks, Paul


If for some reason you want a version that does return an error in that
situation, you could do something like the following:

take' n _ | (n = 0) = []
take' n [] | (n  0) = error take': list too short
   | otherwise = []
take' n (x:xs) = x : take' (n-1) xs

I'm not sure why you'd want that, though.  The standard implementation
gracefully handles all inputs, and usually turns out to be what you want.
Really, if I were you, instead of making a version take' as above, I would
just use the standard take but check for the length of the list in the
places where it matters.

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread PR Stanley

I suppose I'm thinking of head or tail - e.g. head [] or tail [].
I'm trying to write my own version of the find function. I have a few 
ideas but not quite sure which would be more suitable in the context of FP.
Any advice would be gratefully received - e.g. do I use recursion, 
list comprehension or what?

Thanks, Paul

At 00:08 12/09/2007, you wrote:

On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:
 Hi
 take 1000 [1..3] still yields [1,2,3]
 I thought it was supposed to return an error.
 Any ideas?

No, that's the behavior for take specified in the Haskell 98 report:
http://haskell.org/onlinereport/standard-prelude.html
-- take n, applied to a list xs, returns the prefix of xs of length n,
-- or xs itself if n  length xs.

Cheers,
Tim

--
Tim Chevalier * catamorphism.org * Often in error, never in doubt
Modesty...is both alien and irrelevant to people who are happy in
themselves, in their beings, in their skins, their natures, their
capacities.--Anne Sayre
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Don Stewart
byorgey:
On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:
 
  Hi
  take 1000 [1..3] still yields [1,2,3]
  I thought it was supposed to return an error.
  Any ideas?
  Thanks, Paul
 
If for some reason you want a version that does return an error in that
situation, you could do something like the following:
 
take' n _ | (n = 0) = []
take' n [] | (n  0) = error take': list too short
   | otherwise = []
take' n (x:xs) = x : take' (n-1) xs

And we'd call it unsafeTake, just like unsafeFromJust and unsafeTail :-)

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Brent Yorgey
On 9/11/07, Don Stewart [EMAIL PROTECTED] wrote:

 byorgey:
 On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:
 
   Hi
   take 1000 [1..3] still yields [1,2,3]
   I thought it was supposed to return an error.
   Any ideas?
   Thanks, Paul
 
 If for some reason you want a version that does return an error in
 that
 situation, you could do something like the following:
 
 take' n _ | (n = 0) = []
 take' n [] | (n  0) = error take': list too short
| otherwise = []
 take' n (x:xs) = x : take' (n-1) xs

 And we'd call it unsafeTake, just like unsafeFromJust and unsafeTail :-)

 -- Don


Hmm, that's funny, I don't recall ever hearing of those functions... =)

ooo, Don has a shiny new e-mail address!

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread John Meacham
On Tue, Sep 11, 2007 at 07:38:18PM -0400, Brent Yorgey wrote:
 On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:
 
  Hi
  take 1000 [1..3] still yields [1,2,3]
  I thought it was supposed to return an error.
  Any ideas?
  Thanks, Paul
 
 
 If for some reason you want a version that does return an error in that
 situation, you could do something like the following:
 
 take' n _ | (n = 0) = []
 take' n [] | (n  0) = error take': list too short
| otherwise = []
 take' n (x:xs) = x : take' (n-1) xs


you could also do something like

take' n xs = take n (xs ++ error I want more!)


John

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread PR Stanley

Let me get this right, are you saying it's unsafe when it returns an error?
Paul

At 00:40 12/09/2007, you wrote:

byorgey:
On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:

  Hi
  take 1000 [1..3] still yields [1,2,3]
  I thought it was supposed to return an error.
  Any ideas?
  Thanks, Paul

If for some reason you want a version that does return an error in that
situation, you could do something like the following:

take' n _ | (n = 0) = []
take' n [] | (n  0) = error take': list too short
   | otherwise = []
take' n (x:xs) = x : take' (n-1) xs

And we'd call it unsafeTake, just like unsafeFromJust and unsafeTail :-)

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Don Stewart
prstanley:
I suppose I'm thinking of head or tail - e.g. head [] or tail [].
I'm trying to write my own version of the find function. I have a few
ideas but not quite sure which would be more suitable in the context of
FP.
Any advice would be gratefully received - e.g. do I use recursion, list
comprehension or what?

Well, you want to filter all elements from a list that match a predicate, 
and then return Just the first match, or Nothing?

find :: (a - Bool) - [a] - Maybe a

Checking the current behaviour:

 find isSpace haskell is fun
Just ' '

My first go would be something like this: ok, so let's start with 'filter':

 filter Char.isSpace haskell is fun
  

Good, then the natural translation to the Maybe type:

 listToMaybe . filter isSpace $ haskell is fun
Just ' '

And we're almost done. Just firing up QuickCheck:

 quickCheck $ \p (xs :: [Int])  - find p xs == listToMaybe (filter p 
xs)
OK, passed 100 tests.

Seems ok.

I hope that gives some insight into the process of deriving Haskell 
implementations by building up a pipeline of pieces.

-- Don

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Don Stewart
byorgey:
On 9/11/07, Don Stewart [EMAIL PROTECTED] wrote:
 
  byorgey:
  On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:
  
Hi
take 1000 [1..3] still yields [1,2,3]
I thought it was supposed to return an error.
Any ideas?
Thanks, Paul
  
  If for some reason you want a version that does return an error in
  that
  situation, you could do something like the following:
  
  take' n _ | (n = 0) = []
  take' n [] | (n  0) = error take': list too short
 | otherwise = []
  take' n (x:xs) = x : take' (n-1) xs
 
  And we'd call it unsafeTake, just like unsafeFromJust and unsafeTail :-)
 
  -- Don
 
Hmm, that's funny, I don't recall ever hearing of those functions... =)
 
ooo, Don has a shiny new e-mail address!
 

And a shiny new job in a shiny new city :-)

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Don Stewart
prstanley:
Let me get this right, are you saying it's unsafe when it returns an
error?

Partial functions may crash your program, so that's unsafe by some definitions, 
yep.
We have tools that analyse programs for such bugs, in fact (Neil's `catch' 
program).

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


[Haskell-cafe] Prime monads?

2007-09-11 Thread Greg Meredith
Haskellians,

Is there a characterization of prime monads? Here the notion of
factorization i'm thinking about is decomposition into adjoint situations.
For example, are there monads for which there are only the Kleisli and
Eilenberg-Moore decompositions into adjoint situations? Would this be a
characterization of quintessentially free or generative?

Best wishes,

--greg

-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
505 N 72nd St
Seattle, WA 98103

+1 206.650.3740

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


Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Derek Elkins
On Tue, 2007-09-11 at 16:48 -0700, Don Stewart wrote:
 byorgey:
 On 9/11/07, Don Stewart [EMAIL PROTECTED] wrote:
  
   byorgey:
   On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote:
   
 Hi
 take 1000 [1..3] still yields [1,2,3]
 I thought it was supposed to return an error.
 Any ideas?
 Thanks, Paul
   
   If for some reason you want a version that does return an error in
   that
   situation, you could do something like the following:
   
   take' n _ | (n = 0) = []
   take' n [] | (n  0) = error take': list too short
  | otherwise = []
   take' n (x:xs) = x : take' (n-1) xs
  
   And we'd call it unsafeTake, just like unsafeFromJust and unsafeTail 
  :-)
  
   -- Don
  
 Hmm, that's funny, I don't recall ever hearing of those functions... =)
  
 ooo, Don has a shiny new e-mail address!
  
 
 And a shiny new job in a shiny new city :-)

In a   new country.

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


Re: [Haskell-cafe] GraphicsMagick binding for Haskell

2007-09-11 Thread brad clawsie
On Tue, Sep 11, 2007 at 03:41:59PM -0700, Tim Chevalier wrote:
 As a Hackathon project, I'm thinking of trying to write a Haskell
 binding for the GraphicsMagick image manipulation library
 (http://www.graphicsmagick.org/).

please do! this would be a huge asset for us. image/graphicsmagick and
curl are good examples of outstanding existing libraries that are
better bound to than rewritten

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