[Haskell-cafe] Re: [Haskell] Re: Trying to install binary-0.4

2007-10-16 Thread Neil Mitchell
Hi

 I agree. = 1.0 isn't viable in the long term. Rather, a specific list,
 or bounded range of tested versions seems likely to be more robust.

In general, if it compiles and type checks, it will work. It is rare
that an interface stays sufficiently similar that the thing compiles,
but then crashes at runtime. Given that, shouldn't the tested versions
be something a machine figures out - rather than something each
library author has to tend to with every new release of every other
library in hackage?

Thanks

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


Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-14 Thread Neil Mitchell
Hi

 Then, I set out to learn Monads + Category Theory from a Math
 perspective.

This is where you went wrong. I know none of this stuff and am
perfectly happy with IO in Haskell. Read
http://www.haskell.org/haskellwiki/Monads_as_Containers and then read
lots of other Monad tutorials for Haskell.

 So, I requested my institute to buy Dr. Graham Hutton's book. I would
 be getting hold of that quite soon, and am willing to start from the
 beginning.

I'm not sure this covers IO in any great detail - it will be useful
for general Haskell though.

 1. An online judge system
 (Like http://spoj.pl).
 I had already done one for contests that were held during our
 Technical festival here, using php. The ideas are laid out. All I had
 to focus on was learning Haskell.

 2. A solver for the Peg-Solitaire.
 This was more of an academic interest. I have seen Richard Bird's
 presentation on 'How to write a functional pearl, with an example' and
 was quite impressed by it. But the actual modelling might be slightly
 tricky here, and I am yet to start off with it.

I would try number 2 first. IO in Haskell can be tricky, especially
while you are learning all the other bits of the language at the same
time. Network stuff is also not as well developed in terms of
libraries as something like Python - but something like HappS should
be able to do a spoj clone easily enough. A better choice for an
initial IO application might be something like du, then moving to an
online judge system later on.

Thanks

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


Re: [Haskell-cafe] Re: On the verge of ... giving up!

2007-10-14 Thread Neil Mitchell
Hi

  main n = print . sum . map read . take n . reverse . lines = getContents

 Could someone describe succinctly how to compute the space complexity of
 this program, if there are m lines of input and m  n? Many thanks. --PR

The space complexity is the size of the file - i.e. of size m. reverse
will buffer up all the lines before it gives any back, which is a well
known property of reverse. You could rewrite (take n . reverse) as a
function that only requires n lines of buffer.

Thanks

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


Re: [Haskell] Fingerprints and hashing

2007-10-11 Thread Neil Mitchell
Hi Simon,

 We are all familiar with the idea of an MD5 checksum, which provides a 
 reliable fingerprint for a file, usually 128 bits or so.  If the file 
 changes, the fingerprint is (almost) certain to do so too.  There are lots of 
 techniques: CRC, shar?, MD5, etc.

I believe the basic operations are all in the Crypto library:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Crypto-3.0.3
- see Data.Digest.SHA1 and Data.Digest.MD5 - digest is simply another
word for fingerprint in this sense.

However, your fingerprint stuff sounds a lot more like a request for a
Hash function - rather than something that operates over streams of
bytes. To get both, I'd recommend something like taking the digest of
the data after calling show, or after serialising it to a ByteString
with the binary library. Doing it this way means you have no
additional need for a FingerPrint class but can reuse the existing
Show/Binary class.

Thanks

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


Re: [Haskell-cafe] Adding GLUT package to WinHugs

2007-10-11 Thread Neil Mitchell
Hi

 The file you have requested
 (http://www.cs.york.ac.uk/fp/cpphs-1.5-win32.zip) could not
 be found on this server.

The slightly older version works:
http://www.cs.york.ac.uk/fp/cpphs-1.2-win32.zip

I'm unable to get SSH from this machine, so can't tell where that file
has gone to. Malcolm should be able to check if the file is present,
and if not I'll create a new one shortly. If you have GHC installed,
building cpphs is not that hard.

Thanks

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


[Haskell-cafe] Re: [Haskell] Abstract syntax representation

2007-10-11 Thread Neil Mitchell
Hi

In future questions like this are usually best directed to
haskell-cafe, with haskell being left for annoucements.

The standard full haskell representation is in Template Haskell
(http://haskell.org/ghc/docs/latest/html/libraries/template-haskell/Language-Haskell-TH.html).
If you want to work on a reduced language then I recommend Yhc.Core
(http://www-users.cs.york.ac.uk/~ndm/yhc/ - there is a link to the
Yhc.Core paper on that page).

Thanks

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


Re: [Haskell-cafe] Adding GLUT package to WinHugs

2007-10-10 Thread Neil Mitchell
Hi Peter,

  Also typing runhugs Setup.hs configure fails with

  runhugs: Error occurred
  ERROR c:\program
 files\winhugs\packages\base\Text\ParserCombinators\ReadP.hs:156
 - Syntax error in type expression (unexpected `.')

This is because Cabal gets it wrong. You need to type runhugs -98
Setup configure. There is an easy fix, which is for the Cabal
developers to always use the bundled ReadP rather than the library
one. I talked to Duncan about this in Germany, and he said he'd fix it
:-)

Thanks

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


Re: [Haskell-cafe] Hugs, dotnet, C#...

2007-10-08 Thread Neil Mitchell
Hi Peter,

There is a Dotnet tree in the Hugs source code files, which I believe
is what supports dotnet. As far as I am aware, it probably won't work.
A windows developer may be able to build it, but I've never tried.

You might also be interested to know that Yhc supports --dotnet to
generate a dotnet binary. I think it can FFI call the dotnet
framework, but I'm not sure.

IDE's are hard, and only Microsoft does them right - perhaps one day
if Haskell becomes popular enough we'll get something.

Thanks

Neil


On 10/3/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:

  In the (Win)Hugs documentation, I found

  Only the ccall, stdcall and dotnet calling conventions are supported. All
 others are flagged as errors.

  However, I fail to find any more information on how to invoke dotnet
 methods. This might be really handy for me, as I'm very familiar with the
 dotnet framework.

  For example, yesterday I rewrote and extended a program that I wanted to
 develop in Haskell in just 3 hours using dotnet, while I spend weeks trying
 do this in Haskell. Of course, I'm a Haskell newbie and a dotnet expert, so
 this is not a fair comparison. However, I got a strange feeling, which I
 want to share with you :) First of all, it was a *horrible* experience to
 program C# again; I needed to type at least 3 times the amount of code, much
 of which was boilerplate code, and the code is not elegant. Haskell really
 changed my point of view on this; before I knew Haskell, I found C# (I'm
 talking C# 3.0 here) a really neat and nice language. On the other hand, the
 great Visual Studio IDE and Resharper addin made it at least 3 times faster
 to type, navigate, refactor, and debug the code... Somehow, I get things
 done really really really fast in C#, albeit in an ugly way. Once again, I
 just wish Haskell had such an IDE... And yes, I know of the existance of
 Visual Haskell, EclipseFP, Haskell Mode for Emacs (which I'm using), VIM,
 YI, but still, these do not compare with the experience I have when using
 Visual Studio/Resharper (or Eclipse or IntelliJ/IDEA for Java). But that
 might just be me of course...

  A slightly frustrated Peter ;-)

  BTW: I don't want to bring up the IDE discussion again, no really ;-)



 ___
 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] Extract source code from literate Haskell (LHS) files

2007-10-06 Thread Neil Mitchell
Hi Peter,

  This is of course very easy to do manually, but does a command line tool
 exist for extracting source code from literate Haskell files?

Cpphs is the perfect tool to do this.

Thanks

Neil


On 9/30/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:


  Thanks,
  Peter


 ___
 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] GLFW for WinHugs

2007-10-06 Thread Neil Mitchell
Hi Peter,

It sounds like the problem is that you need to convert it to Hugs,
rather than WinHugs specific (which might put a few people off looking
to see if they can help). Perhaps an email to the author of the
library might help you find if they would be interested in doing a
port to Hugs.

From my very limited knowledge, RTS.h defines various constants and
links into the GHC runtime, but I don't think Hugs has any equivalent.
Depending on what they are using RTS.h for, they might be able to use
alternatives on Hugs. However, my knowledge of this side is even less
than my knowledge of football, so if you can find a second opinion,
take it!

Thanks

Neil

On 10/3/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:




 The latest version of SOE comes with a wrapper for a nice GLFW library. This
 library comes with a demo of a 3D bouncing Amiga ball so it must be the
 best library in the world ;-) ;-)



 Since I'm letting my students play with WinHugs, I would prefer to have a
 WinHugs compatible version of that library. I tried to convert it, but I got
 stuck when ffihugs complained about not finding RTS.h, which seems to be a
 GHC-only include file.



 Would it be possible to convert this library to WinHugs? I guess similar
 work has been done for other libraries, so any hints are welcome.



 Thanks,

 Peter


 ___
 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] Very crazy

2007-09-25 Thread Neil Mitchell
Hi

 show_system =
   unlines .
   zipWith
 (\l ms -
   Eq ++
   show l ++
   :  ++
   (concat $ intersperse  +  $ zipWith (\n x - x ++  x ++ show
 n) [1..] (init ms)) ++
=  ++
   last ms
 )
 [1..] .
   map (map (take 8 . show))

 And people complain that *Perl* is bad? This function is quite obviously
 absurd. I mean, it works, but can *you* figure out what it does without
 running it?

No. Can you say what the intention of this code is? Maybe a few
examples? The type signature? That way I think people will be more
able to give you hints.

Generally, I find list comprehensions to be a good way out of general
listy mess.

Thanks

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


Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Neil Mitchell
Hi

 complex. The input is quite simple (it's a bunch of numbers), the output
 is quite simple (it's a neatly formatted string), but the process in the
 middle is... a mess. I'd like to find a more readable way of doing stuff
 like this. It's not just this specific function; any general hints would
 be good. ;-)

A nice auxiliary would help:

showEqn :: Int - [Double] - String
showEqn i vs = ...
where
  (add,ans) = (init vs, last vs)

Then you can half the complexity. There are probably a few useful
functions that aren't in the standard libraries (consperse, joinWith
etc) that you could make use of.

You seem to be doing take 8 on the double - what if the double prints
out more information than this as the result of show?
100 could end up a bit smaller.

Thanks

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


Re: [Haskell] Re: [Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-24 Thread Neil Mitchell
Hi

 Forgive me, but I would much prefer a newsgroup to a mailing list.

 True, I could unsubscribe now and just browse the mailman archives -
 but for posting, I'd have to temporarily re-subscribe, which is awkward.
 (Indeed that's the only reason I'm not doing it.)

I believe you can post from the gmane archives, and that they also
offer a newsgroup feed of this list. I think the general consensus
(and my personal view) is that a mailing list is the preferred
mechanism for most people.

Thanks

Neil


 We already have comp.lang.haskell. - Best regards,
 --
 -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
  http://www.imn.htwk-leipzig.de/~waldmann/ ---

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

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


Re: [Haskell] Re: [Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-24 Thread Neil Mitchell
Hi

 Forgive me, but I would much prefer a newsgroup to a mailing list.

 True, I could unsubscribe now and just browse the mailman archives -
 but for posting, I'd have to temporarily re-subscribe, which is awkward.
 (Indeed that's the only reason I'm not doing it.)

I believe you can post from the gmane archives, and that they also
offer a newsgroup feed of this list. I think the general consensus
(and my personal view) is that a mailing list is the preferred
mechanism for most people.

Thanks

Neil


 We already have comp.lang.haskell. - Best regards,
 --
 -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
  http://www.imn.htwk-leipzig.de/~waldmann/ ---

 ___
 Haskell mailing list
 [EMAIL PROTECTED]
 http://www.haskell.org/mailman/listinfo/haskell

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


Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi Vimal,

 I was surprised to find out that the following piece of code:

  length [1..]  10

 isnt lazily evaluated!

The problem is that Int and Integer are both eager. It is possible to
write a lazy peano number based data type, but I'm not aware of anyone
who has - I have half the code (in joint work with Matt Naylor and
Greg Manning) but none of us have taken the time to finish it off
properly.

For details about why we should have lazy naturals read
http://citeseer.ist.psu.edu/45669.html - Colin Runciman, What About
the Natural Numbers (1989)

Thanks

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


Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi

  In this world, use length (take 11 [1..])  10...
 
  not (null (drop 10 [1..])) is surely faster (not tested...)
 
 Faster? There might be a few microseconds in it.

 Clearer? Possibly... ;-)

lengthNat [1..]  10

Couldn't be clearer, and can be made to work perfectly. If anyone does
want to pick up the lazy naturals work, I can send over the code (or
write it yourself - its not hard!)

Thanks

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


Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi

  lengthNat [1..]  10
 
  Couldn't be clearer, and can be made to work perfectly. If anyone does
  want to pick up the lazy naturals work, I can send over the code (or
  write it yourself - its not hard!)
 

 Um... isn't a lazy natural just a list with no data, where the list
 length encodes a number?

Pretty much, yes.

Thanks

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


Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi

  Pretty much, yes.
 

 So I just need to write

   newtype LazyNatural = LazyNatural [()]

or

data Nat = Zero | Succ Nat

it's your choice really.

 and then add some suitable instances. ;-)

Yes. Lots of them. Lots of instances and lots of methods.

 Hey, the length function would then just be

   ln_length :: [x] - LazyNatural
   ln_length = LazyNatural . map (const ())

 Ooo, that's hard.

Nope, its really easy. Its just quite a bit of work filling in all the
instances. I bet you can't do it and upload the results to hackage
within 24 hours :-)

Thanks

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


Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi

 I'm guessing there's going to be fairly minimal performance difference.
 (Or maybe there is. My way uses a few additional pointers. But it also
 allows me to elegantly recycle existing Prelude list functions, so...)

I think we can safely assume that people using peano numbers aren't
actually overly interested in performance...

 *ALL* the instances? No.

 A small handful of them? Sure. How about this...

How about creating a darcs repo, a cabal package and uploading it to hackage?

Two design decisions you made could have been done differently (not
sure which is best)

If you read the lazy naturals paper it says that 4 - 8 should be 0.
This follows the whole drop 8 [] = [], not _|_

Your show function is strict. Not sure whether this is a good idea or not.

You could also include the constant infinity in your library:

infinity = LN (repeat ())

Thanks

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


Re: [Haskell-cafe] what is f=f (not) doing ?

2007-09-23 Thread Neil Mitchell
Hi

 I'm not sure, but since it would require the detection of an evaluation
 that does not terminate,  it comes down to the halting problem, which is
 not generally solvable. Maybe the experts can confirm my intuition?

I think your intuition is off. This isn't the problem of detecting
that a computation might not halt, its a question of detecting after
the fact a very restricted case of non-termination has occurred. I
think it should be possible to assign threads etc to these things, but
may make the code run slower in the common case.

Thanks

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


[Haskell-cafe] Re: [Haskell] Math behind Haskell

2007-09-23 Thread Neil Mitchell
Hi

The haskell-cafe@ mailing list is more appropriate for messages such
as this. haskell@ is just for announcements (it should be called
haskell-annouce@ !)

  * Lambda calculus - the basis of functional languages

  * Category theory - where all these mysterious things like monads,
 arrows, and functors come from.

I'd add:

* Discrete Maths - booleans, relations, functions etc.

* Type theory

* Logic programming (Prolog)

* Semantics

Most of these are computer science courses, rather than maths ones.

Thanks

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


[Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-23 Thread Neil Mitchell
Hi

I've just replied to another first poster with wrong list. Its
entirely not their fault, but its also probably a bit off-putting that
your very first post gets a (very polite) you got it wrong message.

To steal the reasons and explanations from Ian:

-

pretty much what would be haskell-announce@ anywhere else, and
haskell-cafe@ what would be haskell@ elsewhere. A haskell-cafe@ list
elsewhere would probably be where the haskell@ people discuss things
which aren't actually related to Haskell (like e.g. the demon.local
newsgroup). I think the number of posts in the wrong place would be
lower if these were more conventionally named (although there aren't a
lot of them anyway).

I think it would make sense to:

* Rename haskell@ to haskell-announce@, and redirect mails from haskell@
 to haskell-announce@ for some period.

(more, but can be done step by step in the future)

-

I suggest that following somewhat the
http://www.haskell.org/haskellwiki/Library_submissions we allow 4
weeks for discussion, and depending on the result we then move the
mailing list.

Bug to track: http://hackage.haskell.org/trac/ghc/ticket/1732

Deadline: 23 October 2007

Thanks

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


Re: [Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-23 Thread Neil Mitchell
Hi

 I agree.  Unless... do some people subscribe to haskell@ (not
 haskell-cafe@) and like the existing stuff that's sent there (not all
 announcements... I'm not sure if I'd call e.g. Oleg's occasional
 demonstrations announcements even)?

There are four things sent to the haskell list@

1) Calls for papers
2) Annoucements
3) Oleg's stuff (which are really announcements of a library or technique)
4) Off topic stuff

I'm initially only proposing to mop up category 4, which I am pretty
sure the haskell@ people don't want to see.

I did wonder whether this discussion should take place on the haskell@
list or the haskell-cafe@ one - the great ambiguity of the lists.


  (more, but can be done step by step in the future)

 Maybe, but I'm doubtful... (it might seem different to me in a year
 though, i.e. some amount of time after a --haskell-announce@ change has
 been made.)

This proposal has nothing to do with any future steps. They may
happen, they may not, but I think this proposal is worthwhile on its
own.

Thanks

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


Re: [Haskell-cafe] what is f=f (not) doing ?

2007-09-22 Thread Neil Mitchell
Hi

 f = f

 and then try to evaluate 'f'  in GHCi, as one would expect, the interpreter
 never returns an answer.

 The funny thing is that, while it is stuck in an infinite loop, GHCi doesn't
 seem to use any CPU time at all.

It's called a black hole. The runtime can detect that f directly
depends on f, so just gives up early. Essentially it marks f as black
hole once it starts evaluating it, and then when it comes back to f,
it knows its already doing evaluation on f, so just fails. It would be
useful if there was a page on the wiki about black holes, but I can't
find one...

Thanks

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


Re: [Haskell-cafe] GHC 6.7 on Windows / containers-0.1 package?

2007-09-21 Thread Neil Mitchell
  All dependencies etc. have changed when going to 6.7/6.8 - you are
  probably better off using 6.6.1 for now.
 
 That's a petty. I really would like to experiment with the debugger :-)

Me too! A proper release of GHC 6.8 is very nearby, so you should get
your wish then.

Thanks

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


Re: [Haskell-cafe] help me ! who has vty ?

2007-09-19 Thread Neil Mitchell
Hi

 who has vty for haskell?
 I can't find the right one so who can mail one to me ?

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vty-3.0.0

hackage has a lot of packages, and is always a good place to start a search.

Thanks

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


Re: [Haskell-cafe] Why isn't pattern matching lazy by default?

2007-09-19 Thread Neil Mitchell
Hi

   Now why isn't pattern matching lazy by default?  This seems odd for a
  newbie since everything else is lazy by default.

f ~(x:xs) = rhs
f ~[] = rhs'

Now guess what f [] does...

If you use a where binding then pattern matching is lazy.

Thanks

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


Re: [Haskell-cafe] (win)hipe for Haskell?

2007-09-19 Thread Neil Mitchell
Hi Peter,

  During a googling session, I can across (Win)HIPE, a visualization program
 for the functional language HOPE. See
 http://dalila.sip.ucm.es/~cpareja/winhipe

  IMHO a similar tool would be a nice for learning/teaching Haskell; does
 that exist, or something else that comes close?

Yes, Hat does this http://www.haskell.org/hat/ (if you can get it to
work, I typically have little success)

Thanks

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


Re: [Haskell-cafe] (win)hipe for Haskell?

2007-09-19 Thread Neil Mitchell
Hi

  Yes, Hat does this http://www.haskell.org/hat/ (if you can get it to
  work, I typically have little success)
 

 Thanks. WinHIPE uses graphics and animation. If briefly encountered Hat
 before, but I had the impression it did not visualize the graphs using
 graphics, only text. Is this correct?

Yes, mainly. There is a graphical user interface for Hat, but its not
very well developed. http://www-users.cs.york.ac.uk/~ndm/hat/

Thanks

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


Re: [Haskell-cafe] GHC 6.7 on Windows / containers-0.1 package?

2007-09-19 Thread Neil Mitchell
Hi Peter,

  So I grabbed ghc-6.7.20070824 (=the latest one for Windows I could find)
 and the extra-libs, compiled and installed the GLUT package (which I
 needed), but when I compile my library, I get

  Could not find module `Data.Map':
it is a member of package containers-0.1, which is hidden

All dependencies etc. have changed when going to 6.7/6.8 - you are
probably better off using 6.6.1 for now.

I also don't think that the debugger will help you track down infinite
loop style errors. You might be better off posting the code and asking
for help.

Thanks

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


Re: [Haskell-cafe] Library Process (was Building production stable software in Haskell)

2007-09-18 Thread Neil Mitchell
Hi

 What is the process for the inclusion of modules / packages in ghc, hugs and
 other compilers  interpreters?

Propose to have the packaged added. There is a very low chance of this
being accepted. The only packages to have recently been added were
FilePath and ByteString, both of which were obvious deficiencies in
the libraries. I'm now not aware of any hole that is likely to get
plugged by bundling an additional library.

 Should
 something experimental be a base package? And shouldn't all modules that are
 base packages declare their status?

No, they should all be reasonably stable. Things that are unstable are
likely to move out of the standard libraries and just become hackage
packages.

 Perhaps these are questions for the libraries mailing list but I thought I'd
 start here.

Now there is a question I can't answer - I have no idea what should go
down the libraries list and what should go down the haskell-cafe list.
Perhaps someone could put up a guide of if your question/comment is
like this, send it on this list

Thanks

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


Re: [Haskell-cafe] Library Process (was Building production stable software in Haskell)

2007-09-18 Thread Neil Mitchell
Hi

 I think there is a niche for a subset of the hackage libraries providing
 an officially sanctioned standard library collection.  Currently,
 hackage includes, well, everything.  As such, it is a useful resource,
 but it would be useful to have a partitioning into two levels, where the
 SLC would only include libraries that meet specific criteria.  Maybe:

  - considered stable
  - is portable
  - relies only on other standard libraries
  - avoids needless duplication of functionality
  - with a responsive, named maintainer (not libraries@)
  - with acceptable documentation and unit tests
  - required by at least one separate application

I think there is a niche for this, but I don't think it should be an
officially sanctioned collection - since otherwise everyone is just
going to be debating how to add their library to this collection - and
we are going to descend into voting and politics. Instead, I think
several people should make their own personal list of libraries they
would vouch for - which meet the criteria above AND they have
personal positive experiences of.

Off the top of my head my list would include gtk2hs, and that's about it.

Thanks

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


Re: [Haskell-cafe] unique id for data types

2007-09-18 Thread Neil Mitchell
Hi Barney,

This may be of interest, since all types already have an Int
associated with them:

http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Typeable.html#v%3AtypeRepKey

Thanks

Neil


On 9/18/07, Barney Hilken [EMAIL PROTECTED] wrote:
 In order to make my records system practically useable, I need a type
 family

type family NameCmp n m

 which totally orders datatypes. More precisely, it should return one
 of the
 following types:

data NameLT = NameLT
data NameEQ = NameEQ
data NameGT = NameGT

 for each pair of datatypes n  m, according to whether n  m, n = m,
 or n  m
 in some global ordering. This ordering needs to be independent of the
 context,
 so it can't be affected by whatever imports there are in the current
 module.

 What I want to know is: does GHC give datatypes any global id I could
 use to
 generate such an ordering? Would fully qualified names work?

 Secondly (assuming it's possible) how easy would it be for me to
 write a patch
 to add NameCmp to GHC? Where in the source should I start looking?

 Thanks,

 Barney.


 ___
 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-18 Thread Neil Mitchell
Hi

 okay, but this fails in some cases. i wrote a package to obtain
 financial quotes. yahoo changed the webservice url on me. i rolled out
 a change within a day. in your model, people suffer a broken service
 for two weeks.

I don't think Yahoo will change the syntax or semantics of filepaths
anytime soon :-)

If a new operating system (say Vista) had changed the semantics of
filepaths then that would have been a fix, not a change, and provided
it doesn't alter the behaviour for others then that would have been a
bug fix that went in immediately. The code review is for interfaces -
internal details are a bit more free, and clear bug fixes are not
voted upon.

Thanks

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


Re: STG to JavaScript translation

2007-09-17 Thread Neil Mitchell
Hi

Are you aware that Dimitry is still working on ycr2js - and has made
great progress. There are details available in The Monad Reader, issue
7 (http://www.haskell.org/haskellwiki/The_Monad.Reader)

Thanks

Neil

On 9/17/07, Victor Nazarov [EMAIL PROTECTED] wrote:
 Hello.
 I'm working on the translation of GHC's STG language to
 JavaScript. I've started my implementation, but I've got stuck with
 the STG case statements. The problem is the binder in case expression.

 StgCase expr livevars liverhsvars bndr srt alttype alts

 Operationally, I need to save continuation and evaluate expr
 expression, but I have no idea what to do with the bndr. It seems to
 me that I need to build a closure binded by bndr with the body of
 expr evaluate it, update it, and use it in RHSs of alternatives.
 But It seems that this behavior isn't intended by GHC. Can you explain briefly
 how GHC implements this binder and what this binder points to.

 Here are some notes about Dmitries last year activity and my activity:
 http://haskell.org/haskellwiki/STG_in_Javascript

 --
 vir
 http://vir.comtv.ru/
 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: STG to JavaScript translation

2007-09-17 Thread Neil Mitchell
Hi

 case e of b { pati - rhsi }

 * evaluates 'e',
 * binds the resulting value to 'b',
 * performs case analysis on the result to find which alternative to choose
 * binds the variables of the pattern to the components of the value

The Yhc.Core translator converts this to:

let b = e in case b of { pati - rhsi }

I'm not sure if that would be a clearer form for you to work with, as
it is closer to standard Haskell.

Thanks

Neil
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


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

2007-09-17 Thread Neil Mitchell
Hi

 Would you care to explain why you have this aversion to libs that aren't
 bundled with ghc?

They are less stable and have less quality control. It is also an
additional burden for a user to install the library to get the program
working.

cabal-install should fix the second. Some useful community feedback on
hackage could fix the first. By removing most bundled libraries from
GHC, we can get to the point where people _have_ to use non bundled
libraries, then everyone will be on a more equal footing.

Thanks

Neil
___
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-17 Thread Neil Mitchell
Hi

 What's bad about stagnation is that nobody will bother to produce
 anything better (at least not as a fully polished publicly available
 open source project), precisely because they have little chance of
 achieving a user base exceeding 1 (at least not if the attitude of
 David and Neil is typical of the community culture).

I merely gave the reasons I suspected that David (and others) held
their beliefs - I don't share them particularly. As a library author I
have produced quite a few libraries (at least 5), and have received
useful feedback from users which has helped me improve the libraries
further.

I think the largest barrier to having many libraries used in projects
is the lack of a working cabal-install.

Thanks

Neil
___
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-17 Thread Neil Mitchell
Hi

  They are less stable and have less quality control.

 Surely you jest? I see no evidence of this, rather the contrary in fact.

No, dead serious. The libraries have a library submission process.

Compare me changing my tagsoup library, to me changing my filepath
library which comes bundled with GHC. I can do anything I want to the
tagsoup library, but I need to wait at least 2 weeks and get general
consensus before changing filepath.

Also some libraries on hackage are 0.1 etc - even the author doesn't
particularly think they are stable!

Thanks

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


Re: [Haskell-cafe] Re: [Haskell] question about a failure to generalize

2007-09-15 Thread Neil Mitchell
Hi

 Monomorphism restriction? Replacing fold with foldRegsUsed would work
 because there's a type signature for foldRegsUsed.

That looks like it. Another solution would be:

 fold = foldRegsUsed

becomes:

 fold x = foldRegsUsed x

Now the monomorphism restriction doesn't kick in because fold has an
explicit argument.

Thanks

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


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

2007-09-13 Thread Neil Mitchell
Hi

 Although I appluad the semantics of the safe package, I'm not delighted
 with the idea of replacing our concise elegant standard library names
 with uglyAndRatherLongCamelCaseNamesThatCouldBePerlOrEvenJava though.
 Conciseness of expression is a virtue.

They aren't that long - merely an extra 4 characters over the standard
one to indicate what the specific semantics are. If you can think of
better names, then I'm happy to make use of them.

Thanks

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


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

2007-09-13 Thread Neil Mitchell
Hi

 Similarly, I expect foo and foo' to be equivalent, except for strictness
 properties, but perhaps an underscore could be used for slightly
 different behaviors (interpretations, as it were)?  tail_ or zip_,
 anyone?

There are 4 variants of tail:

tail :: [a] - [a] -- normal
tailDef :: [a] - [a] - [a] -- returns the first argument on []
tailMay :: [a] - Maybe [a] -- returns a Nothing
tailNote :: String - [a] - [a] -- crashes, but with a helpful message
tailSafe :: [a] - [a] -- returns [] on []

tail_ would not be a good name!

Thanks

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


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

2007-09-13 Thread Neil Mitchell
Hi

 Is there a reason for not having

 tailM :: Monad m = [a] - m [a]

 which, at least for me, is much more useful?

No, that probably is a much more sensible choice. Patches welcome :)

Thanks

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


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

2007-09-13 Thread Neil Mitchell
Hi

 From the logical point of view tailMay is the right one.
 It pushes the error handling to the caller programm.

 tail = fromJust . tailMay

The error messages suffer:

tail [] = error: fromJust Nothing

That's why I supplied tailNote, where tailNote foo broke its
invariant! [] gives the message error: tail [], foo broke its
invariant!

Thanks

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


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

2007-09-12 Thread Neil Mitchell
Hi

 A more serious point is that in some cases we might want take to
 underapproximate, or zip to truncate (or tail [] = [] ?). I don't
 think there's
 always a clear library choice here.

I have a zipWithEq function I often use, which crashes if the zip'd
lists aren't equal. I also have tailSafe which does the tailSafe [] =
[] behaviour. I created a hackage package safe for the tailSafe
function and others, http://www-users.cs.york.ac.uk/~ndm/safe/ . If
anyone wants to extend that with deliberately unsafe functions, such
as zipWithUnsafe, zipUnsafe, takeUnsafe etc, I'd be happy to accept a
patch. If not, I'll probably do it myself at some point in the
(potentially distant) future.

Thanks

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


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

2007-09-12 Thread Neil Mitchell
Hi

  The same should apply to head and tail. head or tail  of [] should be [].

  What does the list think?

Disagree, strongly. Its not even possible for head, since [a] - a.
Wadler's theorems for free states that if head is given an empty list
the _only_ thing it can do is crash.

Thanks

Neil
___
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] 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: [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] WinHugs shortcut keys

2007-09-10 Thread Neil Mitchell
Hi Peter,

 It does not seem to have shortcut keys for reload, edit, etc...

When do you use reload? WinHugs automatically reloads modified files,
so I've never felt the need to reload things. Similarly for edit,
typing just edit on its own isn't that useful unless you give it a
module.

However, I'm not averse to including more shortcuts - its relatively
easy and if it is of benefit to you, I'm happy to do so.

 These would be really handy. It is possible to customize the shortcuts
 assigned to the commands?

 If not, can it be build from source?

It can be built from source, but the libraries changed slightly, so a
new build from source won't work with the existing WinHugs packages
libraries. Building the libraries is much more tricky and requires
mingw.

You can report bugs from http://hackage.haskell.org/trac/hugs - so if
you do want some shortcuts, say what you want a particular key to do,
and I'll include it for the next release.

Thanks

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


Re: [Haskell-cafe] WinHugs shortcut keys

2007-09-10 Thread Neil Mitchell
Hi Peter,

 Automatic reloading is of course THE best solution, and that's already
 in :-) Maybe it could help new users to display a simple message into
 the WinHugs statusbar like module XXX reloaded after external
 modification at HH:MM:SS) or something? But that's really minor.

That would be neat. There has also been a suggestion to display the
message file modified but not reloaded if auto-reloading is turned
off. These things are in the same area, so when I take a look at it
I'll see what I can do. The code does seem rather crufty though...

Thanks

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


Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Neil Mitchell
Hi

  I've never really understood what the benefit of this is... I mean,
  Google make the Google toolbar, but what's the point? Why not just
  click on the Google bookmark and type in your search? What benefits does
  installing a special addon provide?

You can setup firefox so in the location bar (Alt+D) typing h query
(without the quotes) will perform a hoogle query. Simply right click
in the search box and click add keyword search with h as the
keyword. You can also do the same for Google, which I've been using
for years (Opera 5 had this feature!)

re: Hoogle not always getting it exactly right, there are a few known
bugs floating around which I'm working on. Hoogle can permute the
order of arguments though, so that shouldn't be a problem. It doesn't
really like Monads, but I wrote Hoogle before I was aware of
higher-kinded type classes, so its understandable...

Thanks

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


Re: [Haskell-cafe] Tiny documentation request

2007-09-09 Thread Neil Mitchell
Hi

 I have the following page bookmarked:

   http://haskell.org/ghc/docs/latest/html/libraries/

Just bookmark: http://haskell.org/hoogle

It's not perfect, but it probably solves lots of your problems.

 A tip is to use Firefox's search as you type feature if you know the
 module name.

This will be better supported in Hoogle 4 - but unfortunately degrees
etc. are coming in the way of Hoogle development...

 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.

Replicating actual tables with CSS is a nightmare - you shouldn't use
table's for lots of things, but there are sometimes when it really is
the best option. Fixing up the CSS and still keeping tables is a
perfectly valid option.

Thanks

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


Re: [Haskell-cafe] Speed of character reading in Haskell

2007-09-09 Thread Neil Mitchell
Hi

  (Some list operations are too expensive with ByteString but for most
  string processing it's perfectly fine and much faster than String).

 I'm sure it's true, but it's quite irrelevant to my question, which is
 why is using getChar so much slower than using getContents?

Buffering, blocks and locks.

Buffering: getChar demands to get a character now, which pretty much
means you can't buffer.

Blocks: getContents reads blocks at a time from the underlying
library, whereas getChar has to do one character at a time.

Locks: getChar has to acquire locks, as does getContents. However,
because getContents can operate on blocks, this requires many fewer
locks.

Thanks

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


Re: Consistency of reserved operators and bang patterns

2007-09-08 Thread Neil Mitchell
Hi

Re ! as an operator: This caused a number of complexities in the
parsing of stuff, including shift-reduce conflicts. Someone would need
to look into this, and determine that the rules are completely
unambiguous.

  Backwards compatibility requires that it be implicitly imported from
  Prelude even in a module that does import Prelude ( ) (although Hugs
  is already broken in this regard).

 In particular, Haskell-98 bans

 import Prelude ( (:) )

Yhc does not meet this restriction either. Perhaps this is a change
that is breaking but minor enough to be permitted for H', since
everyone already does the reverse.

Thanks

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


Re: [Haskell-cafe] Hackage and GHC 6.8

2007-09-08 Thread Neil Mitchell
Hi Neil,

 Given that GHC 6.8 is just around the corner and, given how it has
 re-organised the libraries so that the dependencies in many (most/all)
 the packages in the hackage DB are now not correct.

 Is there a plan of how to get hackage DB up to speed with GHC 6.8 ?

I think whatever we go with will be deeply painful. Especially given
the switch to Cabal configurations comes at the same time, rather than
before. However, remember this is a one of set of pain, which will
hopefully never be repeated.

In the absence of anyone else doing anything, I'll probably give it a
month or two, then upgrade all my packages on hackage.

Thanks

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


Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Neil Mitchell
Hi

 * Create sophisticated GUIs.

Gtk2hs. Could do with a nice wrapper on that, but Conal is doing some
interesting stuff, and I've got PropLang on the back burner. People
are thinking the right thoughts, it just needs time.

 * Read and write standard binary file formats. (Images, compressed
 files, etc.)

Data.Binary is the low level frameworks, now people can pick up the rest.

 * Talk to a database.

Databases are dead, long live flat files :-) It's possible, but I
don't have a clue how.

 * Use various network protocols (possibly custom, possibly standardised).

The great thing about Data.Binary is that its for binary stuff,
whether it be networks or files.

 * Access the Windoze registry and play with COM stuff.

H/Direct, System.Win32. My only question is why you want to build
non-portable software when Haskell is so beautifully portable.

 * Get system-specific file information (protection bits, modification
 times, security information, etc.)

THe Unix stuff does all this, and the win32 stuff does it on Windows.

 * Query the OS. (How many CPUs? How much RAM? What is my IP address?)

Easy enough, if anyone took the time to FFI to a library.

 I don't know how to do any of that in Haskell. Some of it can be done,
 just not very easily. Other items are, AFAIK, impossible.

All of it can be done. The problem is that it hasn't been done, since
Haskell libraries tend to be written lazily, usually after the need is
present.

 And then there's just random stuff like the Prelude numeric classes
 being broken, the fact that the array API is virtually skeletal
 compared to what you can do with lists, the lack of a clean,
 standardised character encoding system [that handles more than 2
 encodings], etc.

All these things are minor. The Prelude numeric classes aren't
broken - they don't quite match what a mathematician might have
picked, but its certainly easy enough to do numeric operations! The
array API is a bit poor, but should never be used - lists are more
functional.

 I'd like to think that Haskell will soon be ready for prime-time. But
 let's face it, the language is 20 years old already...

Most of your problems are lack of libraries. We've had Cabal in
mainstream for maybe a year, hackage is even newer. People know where
the problems are, and they are being fixed. Haskell as a language is
pretty much done, people just like tweaking the corners.

Thanks

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


Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Neil Mitchell
Hi

 Data.Binary is the low level frameworks, now people can pick up the rest.
Last time I checked, there's about half a dozen binary packages. All
incompatible. All with different design. Seriously not obvious which one
to use...

Data.Binary is the answer, http://www.cse.unsw.edu.au/~dons/binary.html

 The Unix stuff does all this, and the win32 stuff does it on Windows.
 Mmm... looks lovely. Any danger of documentation?

msdn.microsoft.com - if you know the C API, you can figure out the
Haskell one. No one should ever have to learn the Win32 API though,
its horrible.

 Still, everybody keeps muttering that functional is the next big
 thing, and Erlang is taking over the world, so many Haskell's day will
 come.

I quite like the fact that I'm massively more productive than most
other programmers - at the end of the day that's what will make me
worth more money and happier than everyone else. Haskell might never
be popular, that's fine by me - I like elegance much more than
cheerleading :-) *

Thanks

Neil

* Of course, all the cheerleading leads to more libraries which makes
me more productive and happier, so its all a win in the end.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: file name letters

2007-09-05 Thread Neil Mitchell
Hi

 Ouch, the well-known case-preserving but case-ignoring default behaviour
 of MacOS X's file system bites someone again.

 In short: Mac OS X's filesystem ignores case when opening a file, but
 preserves
 case when creating.

FWIW, Windows has exactly the same behaviour. Technically you can
change to case sensitive at format time, but I've never actually seen
anyone running in this mode.

Thanks

Neil
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] Hawiki articles

2007-09-03 Thread Neil Mitchell
Hi

 Bring back HaWiki!

I couldn't agree more! We built up an incredible array of articles, by
fantastic authors with stunning content - which we then deleted... I
learnt much from the old wiki, and it would be a shame if others
didn't get that opportunity.

Of course it should be static only, big warnings of out of date
content etc. - but it should be available for years to come.

Thanks

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


Re: [Haskell-cafe] Hawiki articles

2007-09-03 Thread Neil Mitchell
Hi

There are two entirely separate issues in this thread - let's not confuse them.

1) The old HaWiki content is good and unavailable. I want it made
available, in whatever form is appropriate. Please :-)

2) Licensing - the old content cannot be dumped onto the new wiki. My
personal view is who cares. There are numerous license violations
within the Haskell community (I can think of 4 off the top of my
head), but in general everyone is working for the same purpose, and
its just pesky laws getting in the way - not violating peoples intent.
I realise that this will be a minority opinion, and that its probably
a bad idea to follow my opinion on this.

Thanks

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


Re: Derived instances

2007-08-31 Thread Neil Mitchell
Hi

 I have just discovered Generics in Haskell and, writing some code with
 GHC, I wondered about the portability of my code.

If you use Data.Generics, your code is not portable - no other Haskell
implementation supports the necessary bits.

 I can use the -fgenerics to automatically derive instances for
 Something. But I could wish to have the generated source code for those
 instances (like, I suppose, the DrIft tool does), for instance, to
 compile my source with another compiler, which does not support Generics.

Use Derive, which does support Generics:
http://www-users.cs.york.ac.uk/~ndm/derive/

If you care about portability, and are not using some of the more
advanced features of Generics, then you might want to take a look at
Uniplate: http://www-users.cs.york.ac.uk/~ndm/uniplate/

Uniplate does generic traversals, but will work on all Haskell 98
compilers, to some degree - read the paper for exact details.

Thanks

Neil
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: hello

2007-08-29 Thread Neil Mitchell
Hi

 hello thanks for my new subscription, do I need to pay a fee or is it free
 to join ?

This is a mailing list. Its totally free, and for the purpose of
discussing future improvements to the Haskell standard. If you just
wait, you'll find interesting discussions flowing into your inbox.  If
you would rather just have general Haskell discussions, then the
haskell-cafe mailing list might be a more appropriate venue.

Thanks

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


Re: [Haskell-cafe] defining mapPairs function

2007-08-29 Thread Neil Mitchell
Hi Alexteslin,

 I just came across with this question on the exam and can not think of
 implementing it.

 mapPair :: (a - a - a) - [a] - [a]

 such that mapPairs f [x1, x2, x3, x4...] = [f x1 x2, f x3 x4,...]

I would implement this using direct recursion. As a starting point,
the standard definition of map is:

map f [] = []
map f (x:xs) = f x : map f xs

You should be able to start at this and modify it to give the
behaviour you require.

If you want further hints, you might want to try the Haskell IRC
Channel, which is good for these kind of questions.
http://www.haskell.org/haskellwiki/IRC_channel

Thanks

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


Re: [Haskell-cafe] defining mapPairs function

2007-08-29 Thread Neil Mitchell
Hi

 mapPairs :: (a - a - a) - [a] - [a]
 mapPairs f [x] = [x]
 mapPairs f [] = []
 mapPairs f (x:xs) = f x (head xs) : mapPairs f (tail xs)

It looks like it works, but you can get a better version by changing
the last line:

mapPairs f (x:y:zs) = ... - left as an exercise, but no need for head or tail.

Thanks

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


Re: [Haskell-cafe] Ideas

2007-08-25 Thread Neil Mitchell
Hi

 - Blogging software. (Because there isn't enough of it in the world yet.)

Hope (google: Haskell Hope)

 - A wiki program. (Ditto.)

Flippi (google: Haskell Flippi)

 - A general CMS.

Hope

 - An interactive function plotter. (GNUplot is nice, but it can't plot
 recursive functions...)

None that I know of.

 - A graphical programming tool. (You add boxes and put in lines, it
 constructs a program that you can run.)

You mean a programming tool with a horrible syntax and user interface?
If you want to remove the joy from programming, just use Ada.

Alternatively, use PureData, which can be extended with Haskell, and
gives boxes and lines.
http://haskell.org/haskellwiki/AngloHaskell/2007#Abstracts

Thanks

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


Re: [Haskell-cafe] Ideas

2007-08-25 Thread Neil Mitchell
Hi

  Flippi (google: Haskell Flippi)

 ...and yet haskell.org uses WikiMedia? (Which is written in something
 bizzare like Perl...)

Yes, but WikiMedia is a result of years of work, Flippi is a lot less.
Wikipedia uses WikiMedia - its a tried and proven solution.

  - A graphical programming tool. (You add boxes and put in lines, it
  constructs a program that you can run.)

 Have you ever played with KLogic? You draw boxes and lines, and it makes
 some logic. (As in the digital electronics sense of logic.)

 I have some (very expensive) software called Reaktor. You draw boxes and
 lines, it does DSP algorithms. You build synthesizers and effects boxes
 with it.

That sounds exactly like PureData - you can also do graphics as well
with PureData, the demo I saw was very cool. Of course, PureData is
written in C with Haskell as an extension language.

The last two ideas you mentioned require a graphical user interface,
which is an area of Haskell which is comparatively weak, compared to
the rest of Haskell.

Thanks

Neil


PS: Apologies to Andrew for 2 copies of this message.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-25 Thread Neil Mitchell
Hi

 Another option would be to port the yhi bytecode interpreter to run on
 PalmOS. I tried this, but I ran into three problems:

  1. libgmp dependency

This is no longer an issue, we now have a flag to not require libgmp,
which makes type Integer = Int

  2. build system requires Python (scons).

Still alas, but we'd like to fix it.


 If PalmOS is really un-POSIX compatible, it may be easier to write a
 custom compiler that compiles YHC or GHC Core to PalmOS. Well, the
 first time you try to write a compiler from Core - ??? is
 difficult, but the second time around is a lot easier ;)

We have compilers from Yhc Core to everything nowadays. One to Lisp
shouldn't be too tricky, if someone wanted to take that direction.

Thanks

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


[Haskell-cafe] Re: [Haskell] Issue about use of WinHugs

2007-08-24 Thread Neil Mitchell
Hi

 I'm new to WinHugs, what's wrong with isUpper of my WinHugs?

Nothing. The book/tutorial you are going from is out of date. Before
using the isUpper/isLower functions you first have to type :load
Char:

Hugs :load Char
Hugs filter isUpper ABCDEfgh
ABCDE

The :load Char loads the Char module into scope, which provides the
isUpper function.

The haskell@ mailing list is mainly for announcements, so I've sent
this email to haskell-cafe@ - which is the right place for questions
like this.

Thanks

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


Re: [Haskell-cafe] GHC optimisations

2007-08-23 Thread Neil Mitchell
Hi

 Its (==) isn't
 reflexive (is it transitive? probably, at least if there aren't too many
 optimizations, but floating-point transitive equality isn't very useful).

It's not even referentially transparent in all cases. a == b may fail
while the double's are in the high precision registers, and then
succeed later on in the program once they are truncated. I think you
have to specify -fexcess-precision with GHC to get this behaviour.

Thanks

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


Re: [Haskell-cafe] Re: Graph reduction [Was: Where is StackOverflow on the Wiki?]

2007-08-23 Thread Neil Mitchell
Hi

  Yeah, the precise details may vary, even :) But for teaching, an
  automatic tool that does graph reduction would be great. I don't mind
  if it's sloppy (directly apply definitions  pattern matching VS
  everything is a lambda abstraction) and only does simply typed lambda
  calculus (no type applications, no type classes).

 Well come ON people, there's *got* to be enough big-wigs on this list to
 put *something* together! ;-)

It's been done, but never got to a released state:

http://haskell.org/haskellwiki/Haskell_Equational_Reasoning_Assistant

http://www.cs.york.ac.uk/fp/darcs/proof/ (screenshot:
http://www-users.cs.york.ac.uk/~ndm/temp/proof.png)

And neither of them will be of much use to a beginner. Haskell is too
complex to reason about formally for a beginner, and reasoning
informally isn't very easy to do - because its not a precise
description of what to do.

Thanks

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


Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Neil Mitchell
Hi

 Other rules that could be interesting are:
   forall a b. fromInteger a + fromInteger b = fromInteger (a + b)
   forall a b. fromInteger a * fromInteger b = fromInteger (a * b)

This is wrong, since the class function can do what it wants. Imagine:

instance Num String where
   (+) = (++)
   fromInteger x = show x

1 + 2 :: String

this expression now goes from 12 to 3 by applying this rule.

You need to be incredibly careful if there are any classes floating around.

Thanks

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


Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Neil Mitchell
Hi

 If Num obeys ring axioms, fromInteger is a perfectly fine
 ring-homomorphism. (It's also the first or second homomorphism taught.)

Does Int obey these axioms? I'm thinking that assuming properties
about things such as numbers is very likely to go wrong very quickly.
Monads you might be able to get away with, Numbers you probably can't.

Thanks

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


Re: [Haskell-cafe] help understanding lazy evaluation

2007-08-22 Thread Neil Mitchell
Hi

factors :: Int - [Int]
factors n = [x | x - [1..n], n `mod` x == 0]

prime :: Int - Bool
prime n = factors n == [1, n]

 My vague intuition said we either need factors or we don't, we do
 because we need to perform the test, so we compute it. That's wrong,
 so a posteriori the explanation must be something like this:

The key point is that factors doesn't either compute all or none, it
may compute part of the value. It does this by computing something
like:

_:_
1:_
1:_:_

where _ is the unevaluated bit, i.e. it computes one bit of the result
at a time.

Equals also has this property, it can be defined as:

a:as == b:bs = a == b  as == bs
[] == [] = True
_ == _ = False

If you have (1:_) == (2:_) then the match will fail instantly.

 That's a lot of *context* about that particular evaluation of
 factors, in particular step puzzles me. Can anyone explain how lazy
 evaluation fits there? I suspect the key is the implementation of ==
 together with the fact that list comprehensions are lazy themselves,
 is that right?

Everything is lazy, to all subparts. You might get along better with a
reasoning more of the form to compute anything, this expression will
demand this expression - rather than your someone knows we'll need.
If you follow example derivations you'll see that there is always a
very clear idea of what needs to happen next for the computation to
proceed, which explains the laziness quite naturally.

 [*] Which notation do you use for functions in text? is f() ok?

Sure, although a little unusual for Haskell where f() means f applied
to the empty tuple. Some people use |f| (generally those who use
latex), but generally it can be inferred from the context what is a
function

Thanks

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


Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Neil Mitchell
Hi

 Wait, you're saying that ghc can produce pure c-code, that doesnt
 contain any assembly code, and that runs as fast as ghc code that does
 contain assembly?

No. It can produce pure C code (unregistered), but to get high
performance it processes the output assembly afterwards (registered).

 Sooo if I was feeling evil, could I take this c-code and pipe it
 into something that turns it into C#???

You might be able to. Much easier would be to use Yhc and pass the
--dotnet flag which generates .NET binaries natively.

 macros (or any macros at all perhaps...), this becomes non-trivial,
 but otherwise I think most things in C can be mapped fairly trivially
 to C#?  (It's a one-way mapping of course, eg delete in C is simply
 dropped when mapped to c#).

There isn't going to be much free/delete, its all a garbage collected heap.

Thanks

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


Re: [Haskell-cafe] Generic data constructor in pattern?

2007-08-21 Thread Neil Mitchell
Hi Peter,

   liftV1 f (V x y) = V (f x) (f y)
 liftV2 f (V x1 y1) (V x2 y2) = V (f x1 x2) (f y1 y2)

 liftM1 f (M x y) = M (f x) (f y)
 liftM2 f (M x1 y1) (M x2 y2) = M (f x1 x2) (f y1 y2)

 Both pairs of lift functions have almost identical implementations. Can I
 merge these somehow?

Using the Uniplate library the first already has a name, its called descend.

The second does not, but could be implemented in Uniplate if you wanted.

descend2 :: Biplate a b = (b - b - b) - a - a - a
descend2 f a b = a2 (zipWith f as bs)
   where
  (as, a2) = uniplate a
  (bs, b2) = uniplate b

For full details see the website: http://www-users.cs.york.ac.uk/~ndm/uniplate/

Thanks

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


Re: [Haskell-cafe] Re: Newbie question: Where is StackOverflow on the Wiki?

2007-08-21 Thread Neil Mitchell
Hi

  sum (enum 1 10) =
  sum' 0 (enum 1 10)  =
  ...
 
  sum' 36 (9 : enum (9+1) 10)  =
  (sum' $! (36+9)) (enum (9+1) 10) =
  sum' 45 (enum (9+1) 10)  =
  sum' 45 []   =
  45
 
  (I need to find some way to automate making these trails :) )

 Yes! We'd need such an automatic tool for the wikibook, too.

The problem is that Haskell is ridiculously complex, and the small
step interpretation is much harder than you'd think. For example, sum
may well be defined as foldl' (+) 0, which is a CAF, so gets reduced
once. The 0 won't actually be a 0, but will be fromInteger 0, which
will correspond to looking up an item in the dictionary and applying
it. Dictionaries especially make the simple interpretation
completely wrong.

It's easy to do informally, but once you start being more precise, its
very complex.

Thanks

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


Re: [Haskell-cafe] is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility?

2007-08-20 Thread Neil Mitchell
Hi

Distribution/Simple/InstallDirs.hs:267:36:
 Not in scope: `dropDrive'

 [EMAIL PROTECTED]:~/installs/cabal-head/caballs -l `which ghc`
 lrwxrwxrwx 1 root root 31 2007-08-20 11:08 /usr/local/bin/ghc -
 /usr/local/bin/ghc-6.7.20070816


You'll need to upgrade the filepath library as well, since cabal depends on
it, and a very recent version at that.

Thanks

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


[Haskell-cafe] List comprehension desugaring

2007-08-19 Thread Neil Mitchell
Hi,

The Haskell desugaring for list comprehensions is given in:

http://haskell.org/onlinereport/exps.html#list-comprehensions

All the rules seem to be left to right rewrites, apart from the second
one, which seems to be right to left. Is there some deep reason for
this, or is this accidental.

Thanks

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


[Haskell-cafe] Re: List comprehension desugaring

2007-08-19 Thread Neil Mitchell
Hi

Sorry for the noise, I've now realised they are a left to right
rewrite system, the second rule is required to set up the base case.

Thanks

Neil

On 8/19/07, Neil Mitchell [EMAIL PROTECTED] wrote:
 Hi,

 The Haskell desugaring for list comprehensions is given in:

 http://haskell.org/onlinereport/exps.html#list-comprehensions

 All the rules seem to be left to right rewrites, apart from the second
 one, which seems to be right to left. Is there some deep reason for
 this, or is this accidental.

 Thanks

 Neil

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


Re: [Haskell-cafe] ghc 6.7 /6.8

2007-08-19 Thread Neil Mitchell
Hi

  will 6.7 be released, or will only 6.8 be  ?

6.7 is the HEAD branch, 6.8 will be released.

 -in that case, does the 6.8 branch means the freeze is on, and what would be
 the target for 6.8 ? Q3/2007 ? Q4 ?

Soon, in the next month - according to latest targets/estimates.

 ( context: I am impatient to test the new debbuger, but too newby to go and
 fix all the lib..hoping it may help me undertand haskell execution.. )

The new debugger looks dead cool, I can't wait for it either!

Thanks

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


Re: hyperlinked haskell 98 grammar

2007-08-16 Thread Neil Mitchell
Hi Peter,

A nice application. One suggestion: I would have implemented it so
that a maximum on one backward hyperlink menu could be visible at once
- try clicking on two RHS's and you'll get too menus visible at the
same time.

You also might want to mail this out on haskell-cafe - which is more
appropriate for general haskell things, ghc-users is more for direct
issues with GHC (although haskell-cafe can also be used for those)

Thanks

Neil

On 8/16/07, Peter Hercek [EMAIL PROTECTED] wrote:
 Hi,

 I was improving my Haskell knowledge lately and I created a small dhtml 
 application which allows browsing of
 Haskell 98 grammar. I contains both forward and backward hyperlinks. By 
 backward hyperlink I mean that you can
 click on an a production head and you get a popup list box where you can 
 navigate to any production using the
 nonterminal. If you like it please save and use your local copy since the 
 server cannot handle much load.

 http://www.hck.sk/users/peter/

 Peter.

 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: hyperlinked haskell 98 grammar

2007-08-16 Thread Neil Mitchell
Hi

In addition, perhaps this should be relocated to haskell.org, if your
server is not suitable for a large volume of users. I think it should
also be integrated somewhere (perhaps a link from the HTML report, and
certainly on the wiki)

Thanks

Neil

On 8/16/07, Neil Mitchell [EMAIL PROTECTED] wrote:
 Hi Peter,

 A nice application. One suggestion: I would have implemented it so
 that a maximum on one backward hyperlink menu could be visible at once
 - try clicking on two RHS's and you'll get too menus visible at the
 same time.

 You also might want to mail this out on haskell-cafe - which is more
 appropriate for general haskell things, ghc-users is more for direct
 issues with GHC (although haskell-cafe can also be used for those)

 Thanks

 Neil

 On 8/16/07, Peter Hercek [EMAIL PROTECTED] wrote:
  Hi,
 
  I was improving my Haskell knowledge lately and I created a small dhtml 
  application which allows browsing of
  Haskell 98 grammar. I contains both forward and backward hyperlinks. By 
  backward hyperlink I mean that you can
  click on an a production head and you get a popup list box where you can 
  navigate to any production using the
  nonterminal. If you like it please save and use your local copy since the 
  server cannot handle much load.
 
  http://www.hck.sk/users/peter/
 
  Peter.
 
  ___
  Glasgow-haskell-users mailing list
  Glasgow-haskell-users@haskell.org
  http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
 

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] Pattern matching articles/explanations

2007-08-16 Thread Neil Mitchell
Hi

 So what I noticed that A Gentle Introduction to Haskell mentioned
 that wild-cards are useful in constructors. For example:

 head (x:_) = x

 So, does that offer any performance benefits over:

 head (x:xs) = x

No. They are exactly the same. _ simply means a new unique name.

 Or is it primarily to indicate to the coder that xs is useless?

Yes

 I get
 the impression it has a very similar meaning to the irrefutable
 pattern in regards to not evaluating it when the function is called.
 Or am I way off?

Way off :-) Nothing to do with irrefutable patterns, or demand of
evaluation, its got two uses:

1) Indicate to the reader that this argument is never used
2) Save you coming up with a name for the argument

Thanks

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


Re: [Haskell-cafe] ANNOUNCE: Guihaskell and PropLang 0.1

2007-08-15 Thread Neil Mitchell
Hi Dougal,

It's cross platform, and will use GHC and Hugs if they are already installed.

Thanks

Neil

On 8/15/07, Dougal Stanton [EMAIL PROTECTED] wrote:
 On 15/08/07, Asumu Takikawa [EMAIL PROTECTED] wrote:
  == GuiHaskell
 
  Guihaskell is a graphical REPL using PropLang, a GUI combinator library
  built on top of Gtk2hs, which aims to be an IDE for Haskell written in
  Haskell. It's still rough around the edges, so think of this as an alpha
  release. As such, I'd appreciate any feedback very much!

 Looks interesting. I couldn't see anywhere whether it has any OS
 dependencies. Is it cross platform?

 Cheers,

 D.
 ___
 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: Unexpected boxing in generated code

2007-08-07 Thread Neil Mitchell
Hi Simon,

 OK this is an interesting one. Here's the smallest program that demonstrates 
 the problem.

 foreign import ccall unsafe stdio.h getchar getchar :: IO CInt

 f56 :: State# RealWorld - Int - Int
 f56 s v2 = case (unIO getchar s) of
(# s' , v6  #) -
   case v2 of I# _ - f56 s' v2

 GHC says this is lazy in v2, which it obviously isn't.  Why?  Because there's 
 a special
 hack (introduced after an earlier bug report) in the strictness analyser to 
 account for the
 fact that a ccall might exit the program.  Suppose instead of calling 
 'getchar' we called
 'exit'!  Then f56 is not strict in v2 any more.

 One could imagine an analysis for definitely does not exit.  But it only 
 really
 makes sense for IO-ish things.

Why not demand that all unsafe foreign imports do not exit the
program? If your foreign call does exit the program, then its unlikely
to be performance critical. All unsafe FFI functions can then have
their strictness analysed as before.

Thanks

Neil
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] Re: Navigating Haddock

2007-08-06 Thread Neil Mitchell
Hi

  a) use hoogle (haskell.org/hoogle). You can use hoogle to find functions by 
  types. But I don't
  know haw to create a query such as ... - Document - ...

 Hoogle unfortunately doesn't do that very well, although that would be a
 great feature.

Wait for version 4 :-) - I've added _ 's for wildcard types, _ -
Document - _ would give you what you want. I've also  made it so a
search for Document can give you all the types which involve
document in any way.

 But I think that  Text.XML.HaXml  isn't indexed by Hoogle
 anyway?

Version 4 will be capable of indexing all of hackage, so hopefully
that can be done.

Thanks

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


Re: [Haskell-cafe] Type without a data constructor?

2007-08-06 Thread Neil Mitchell
Hi

 I by mistake defined a type which did not specify a data constructor

 So the question is what are types with no constructors good for? A
 simple example would be appreciated.

They are called phantom types, and can be used for ensuring properties
at the type level.

I wrote about them in a blog post:

http://neilmitchell.blogspot.com/2007/04/phantom-types-for-real-problems.html

There are probably better references, but that's the easiest for me to find ;-)

Thanks

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


Re: [Haskell-cafe] How odd...

2007-08-04 Thread Neil Mitchell
Hi

If you just use Catch (http://www-users.cs.york.ac.uk/~ndm/catch/):

   foo x
 | x  0 = ...
 | x == 0 = ...
 | x  0 = ...

This gives an error. Something identical to this code is in
Data.FiniteMap, and indeed, when using floats and NaN's (or just silly
Ord classes) you can cause Data.FiniteMap to pattern match error. See
section 6.3 of the draft paper on the Catch website for details.

 myNot x
  | x == True  = False
  | x == False = True

This is determined to be exhaustive.

 as it is (in general) undecidable whether all patterns are covered.

In general, yes. But its possible to do a lot better than GHC's
current warnings (I'm not saying its worth changing, though)

Thanks

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


Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi

Perhaps we need to cool this thread down a little bit, and refocus. I
personally choose never to use ++ as anything but a statement, since
my brain works that way. Other people find different things natural,
so can pick what they choose. The one thing you can guarantee is that
discussing it isn't going to result in anyone changing their opinion!

The thread started out on monad subexpressions, with request for
helpful thoughts as to what could be done with them, and how we can
treat them syntactically. Does anyone have any further thoughts on the
syntax? We started with 4 suggestions, and as far as I can tell, are
left with only one (- ...). This is the time for people to have new
and clever thoughts, and possibly shape the future of (what I think)
will be a very commonly used Haskell syntax.

For the record, my comments on (- ...) where not objections, but
merely thoughts out loud, and I could certainly see myself using
that syntax in a day to day basis.

Thanks

Neil



On 8/3/07, Mirko Rahn [EMAIL PROTECTED] wrote:

  rewrite *p++=*q++ in haskell?

  it's one of C idioms. probably, you don't have enough C experience to
  understand it :)

 Maybe, but how can *you* understand it, when the standard is vague about it?

 It could be

 A: *p=*q; p+=1; q+=1;
 B: *p=*q; q+=1; p+=1;
 C: tp=p; tq=q; p+=1; q+=1; *tp=*tq;

 ...and so on. Which is the right version?

  result is that currently C code rewritten in Haskell becomes much
  larger and less readable.

 Larger should not be that issue and readability depends on the reader as
 your C example shows. Some Haskellers would very quickly recognize some
 common idioms, where others need some help...

 /BR

 --
 -- Mirko Rahn -- Tel +49-721 608 7504 --
 --- http://liinwww.ira.uka.de/~rahn/ ---
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi

Thinking on the semantic issue for the moment:

Can you use (-) outside of a do block?

b  f (- a)

What are the semantics of

do b  f (- a)

where does the evaluation of a get lifted to?

Given:

if (- a) then f (- b) else g (- c)

Do b and c both get monadic bindings regardless of a?

if (- a) then do f (- b) else g (- c)

Does this change to make b bound inside the then, but c bound outside?
Does this then violate the rule that do x == x

Can you combine let and do?

do let x = (- a)
f x

Our best guess is that all monadic bindings get floated to the
previous line of the innermost do block, in left-to-right order.
Monadic expressions in let statements are allowed. Outside a do block,
monadic subexpressions are banned.

Despite all these complications, it's still a great idea, and would be
lovely to have!

Thanks

Neil and Tom


On 8/3/07, Neil Mitchell [EMAIL PROTECTED] wrote:
 Hi

 Perhaps we need to cool this thread down a little bit, and refocus. I
 personally choose never to use ++ as anything but a statement, since
 my brain works that way. Other people find different things natural,
 so can pick what they choose. The one thing you can guarantee is that
 discussing it isn't going to result in anyone changing their opinion!

 The thread started out on monad subexpressions, with request for
 helpful thoughts as to what could be done with them, and how we can
 treat them syntactically. Does anyone have any further thoughts on the
 syntax? We started with 4 suggestions, and as far as I can tell, are
 left with only one (- ...). This is the time for people to have new
 and clever thoughts, and possibly shape the future of (what I think)
 will be a very commonly used Haskell syntax.

 For the record, my comments on (- ...) where not objections, but
 merely thoughts out loud, and I could certainly see myself using
 that syntax in a day to day basis.

 Thanks

 Neil



 On 8/3/07, Mirko Rahn [EMAIL PROTECTED] wrote:
 
   rewrite *p++=*q++ in haskell?
 
   it's one of C idioms. probably, you don't have enough C experience to
   understand it :)
 
  Maybe, but how can *you* understand it, when the standard is vague about it?
 
  It could be
 
  A: *p=*q; p+=1; q+=1;
  B: *p=*q; q+=1; p+=1;
  C: tp=p; tq=q; p+=1; q+=1; *tp=*tq;
 
  ...and so on. Which is the right version?
 
   result is that currently C code rewritten in Haskell becomes much
   larger and less readable.
 
  Larger should not be that issue and readability depends on the reader as
  your C example shows. Some Haskellers would very quickly recognize some
  common idioms, where others need some help...
 
  /BR
 
  --
  -- Mirko Rahn -- Tel +49-721 608 7504 --
  --- http://liinwww.ira.uka.de/~rahn/ ---
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

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


Re: [Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi

  Can you combine let and do?
 
  do let x = (- a)
 f x

 Right.  In effect, as a matter of fact, the notation

 x - a

 would become equivalent to

 let x = (- a)

Hmm, interesting. Consider:

let x = 12
let x = (- x)

Currently, in let x = ... the x is in scope on the right hand side.
Now it isn't. Changing the order of evaluation with syntactic sugar
seems fine, changing the lexical scoping seems nasty. Perhaps this is
a reason to disallow monadic expressions in a let.

  Our best guess is that all monadic bindings get floated to the
  previous line of the innermost do block, in left-to-right order.
  Monadic expressions in let statements are allowed. Outside a do block,
  monadic subexpressions are banned.

 Sure.  SPJ mentioned that you wouldn't promote (- x) past a lambda.
 I'm not convinced (it seems to fall into the same category as the if
 statement), but it's worth considering.

I'm not convinced either, a nice concrete example would let people
ponder this a bit more. What is nice to note is that all your answers
to my questions matched perfectly with what I thought should happen.

Thanks

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


Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi

  do { do { a; b}; c }
 
  is still the same as
 
  do { a; do { b; c } }
 
  yes? no? perhaps? sometimes? how long did it take you?

 I'm not entirely sure I understand the point here.  The monad laws are
 defined in terms of = and return.  They have never had anything to do
 with do, let, or -.  All of the monad laws still hold.

The Monad laws have never been defined in terms of do notation, but
they have always held with do notation since it was simply basic sugar
for  and =. Now do notation is no longer as simple, and the laws
do not hold on do, only on the desugared version. We have lost the
ability to manipulate do quite as easily, and gained a more compact
expression of monadic actions.

I think the trade off is worth it, but others may not.

Thanks

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


Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi

  let x = 12
  let x = (- x)

 Okay, so the desugaring process wouldn't terminate in that case!  One
 could either: (a) try to retain the equivalence in theory, but make it
 illegal to use x in a monadic subexpression when defining x; (b) we
 could abandon my claim that they are equivalent.

This example isn't intended to be about termination of the desugaring,
or about types etc - the only point is to note the change in the
lexical scoping rules that (-) gives. I'll try and state my concern
more clearly:

let x = a

In this expression, x is available for use within a, since let is
recursive. This allows us to write:

let xs = paws : xs

With the end result that xs is bound to [paws,paws,paws,paws...

Now consider:

let x = (- a)

With the proposed desugaring we obtain:

temp - a
let x = temp

Now x is NOT in scope within the expression a! We have changed the
static lexical scoping, and only within the brackets. This behaviour
is (in my opinion) horrid. A quick poll of people in my office lead us
all to believe that this issue means you should not be allowed (-)
within a do's let statement.

This leads us to a second problem, floating these monadic expressions
outside any binding:

do case x of
 [] - return 1
 (y:ys) - f (- g y)

Here, the proposed desugaring does not work, since y is not in scope
where we move the element to.

Perhaps this leads to the conclusion that monadic subexpressions
should not be allowed inside any binding group, including let, case or
lambda.

Thanks

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


Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi

 if you write :

 let x = (-a):x

 is it possible that is desugars into :

 temp -a
 let x = temp:x

 that would'nt work ?

That would work, since 'a' doesn't refer to 'x'. I can't think of a
real example where it becomes an issue, but the scope within 'a' has
changed.

 Also :

  do case x of
   [] - return 1
   (y:ys) - f (- g y)

 Is it not possible that is desugars to

 do case x of
  [] - return 1
  (y:ys) - g y = \temp - f temp

See the rule about always binding to the previous line of a do block.
This case then violates that.

Thanks

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


Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi

   do case x of
[] - return 1
(y:ys) - g y = \temp - f temp

  See the rule about always binding to the previous line of a do block.
  This case then violates that.

 I assumed that the example was equivalent to :

 do case x of
  [] - return 1
  (y:ys) - do f (- g y)

 Shouldn't the rule work then ?

If the do was inserted, then yes, this would work. Without it, it
doesn't. Perhaps this makes a restriction to not inside
case/let/lambda not that severe, since usually an additional do could
be inserted.

Thanks

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


Re: [Haskell-cafe] positive Int

2007-08-02 Thread Neil Mitchell
Hi

Catch (www.cs.york.ac.uk/~ndm/catch) can infer that certain uses of
numbers fit into the {Neg, Zero, One, Pos} abstraction - so for
example it can infer that length returns {Zero, One, Pos}, but not
Neg. If you then do:

xs !! length ys

It will detect that length ys is natural, and will be safe. However,
if you pass any arbitrary value as the index to !! it will warn of a
possible pattern match error.

You can of course use type Nat = Int, and write additional
documentation, even if this documentation isn't a static guarantee.

Thanks

Neil



On 8/2/07, brad clawsie [EMAIL PROTECTED] wrote:
 as far as i know, the haskell standard does not define a basic Int
 type that is limited to positive numbers.

 would a type of this kind not potentially allow us to make stronger
 verification statements about certain functions?

 for example, 'length' returns an Int, but in reality it must always
 return a value 0 or greater. a potential counter-argument would be the
 need to possibly redefine Ord etc for this more narrow type...



 ___
 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] Perfect example

2007-08-02 Thread Neil Mitchell
Hi

I know that Audrey Tang (the Pugs project) has used hamming numbers
for this, see http://www.perl.com/lpt/a/959

Thanks

Neil

On 8/2/07, Jon Harrop [EMAIL PROTECTED] wrote:

 Any suggestions for a perfect example that uniquely demonstrates the benefits
 of the Haskell language compared to other languages?

 --
 Dr Jon D Harrop, Flying Frog Consultancy Ltd.
 OCaml for Scientists
 http://www.ffconsultancy.com/products/ocaml_for_scientists/?e
 ___
 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] monad subexpressions

2007-08-02 Thread Neil Mitchell
Hi Chris,

 I've heard Simon (Peyton-Jones) twice now mention the desire to be able
 to embed a monadic subexpression into a monad.

I think this is a fantastic idea, please do so!

 $( expr   )   -- conflicts with template haskell
 ( - expr )   -- makes sense, and I think it's unambiguous

 Other ideas:

 ``expr``  -- back-ticks make sense for UNIX shell scripters
 (| expr |)-- I don't think anything uses this yet

This final (| one |) looks way too much like template haskell, it has
the feel of template haskell, even if it isn't yet in the syntax. Your
(- proposal) feels a bit like an operator section - I'm not sure if
that is a good thing or a bad thing, but for some reason feels
slightly clunky and high-syntax overhead, perhaps because of the
inevitable space between the - and expr, and that ()- are all fairly
high semantic value currently in Haskell, while this extension should
blend in, rather than stand out. The `` syntax is clever, and I like
it, but I worry that its quite a long way from the current use of ` as
infix, although I'm not sure if that is a particular issue given -
(negation/subtraction) and -- (comment) couldn't be more different.

Thanks

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


Re: [Haskell-cafe] positive Int

2007-08-02 Thread Neil Mitchell
Hi

  It will detect that length ys is natural, and will be safe. However,
  if you pass any arbitrary value as the index to !! it will warn of a
  possible pattern match error.

 I hope catch doesn't actually think that's safe, because it's not - set
 ys = xs = [1,2,3,4,5], you'll get an index out of range error.  (Yes, I
 deliberately chose a list longer than 4 elements).

Of course, it doesn't, I abstracted for the sake of simplicity :-)

The !! operator has two entirely separate pattern match errors, one is
negative index, one is ran off the end of the list. The length xs
will satisfy the first one by proving that length is always a natural,
but the only proof of the other condition is that either the list is
infinite, or that the index is Zero/One, and the list is bigger than
this.

Thanks

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


<    2   3   4   5   6   7   8   9   10   11   >