[Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-17 Thread Michael T. Richter
I'm trying to build Yi (from the darcs repository) to take a look at it.
The README that comes with it says it's a standard Cabal project so do
what you normally do (paraphrased slightly).  The problem is that I'm
not a cabal user just yet and have no idea where to go from here.  Just
throwing caution to the wind and typing make built a setup program
which was then executed and failed complaining about not having
yi-lib0.3 (which I kind of thought the project should be building for
me) and such.  Editing the config.mk (which has some options left almost
entirely undocumented) got me a step farther (specifically giving it a
prefix that actually existed), but then had it choking out that it
couldn't find the vty library -- even when I specifically told it to
build the gtk version.

Is there some painfully obvious thing I'm missing in trying to build
this?  And is it something that's applicable in the broader Cabal world
or is it just this project?  Compiling GHC (which is a lot bigger and
more complex, I'd have guessed) was painless in comparison, so I'm kind
of in the dark here.

-- 
Michael T. Richter [EMAIL PROTECTED] (GoogleTalk:
[EMAIL PROTECTED])
If there's one thing that computers do well, it's to make the same
mistake uncountable times at inhuman speed. (Peter Coffee)


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


Re: [Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-17 Thread Alistair Bayley

I'm trying to build Yi (from the darcs repository) to take a look at it.  The README that 
comes with it says it's a standard Cabal project so do what you normally do 
(paraphrased slightly).  The problem is that I'm not a cabal user just yet and have no 
idea where to go from here.


The standard cabal usage is:
 runhaskell Setup.hs configure
 runhaskell Setup.hs build
 runhaskell Setup.hs install


http://www.haskell.org/haskellwiki/How_to_install_a_Cabal_package

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


Re: [Haskell-cafe] lists with mixed types

2007-06-17 Thread Lennart Augustsson

Well, in this example I don't see how this would even be close to possible.
How would it know that 1 is supposed to be an Int a2.0 a Float?  1 has type
'Num a = a'  and 2.0 has type 'Fractional a = a' so how the compiler know
you want Int and Float?

 -- Lennart

On 6/16/07, Anatoly Yakovenko [EMAIL PROTECTED] wrote:


If I define something like this:

data Bar = Bi Int
 | Bf String
 deriving Show

data Foo = Fi Int
 | Fs Float
 deriving Show

func::Foo - Bar
func (Fi xx) = Bi xx
func (Fs ff) = Bf (show ff)

I can do:
 map func [(Fi 1), (Fs 2.0)]
[Bi 1,Bf 2.0]

but what i really want to do is just do
map func [1, 2.0]
[1, 2.0]

I understand that this is impossible in haskell, but why cant the
compiler generate the Foo and Bar data types for me and just require
that i have a func defined for Int - Int and Float - String?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

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


[Haskell-cafe] Useful IDE features - What abaut automatically adding import statements?

2007-06-17 Thread Marc Weber
Eclipse does have this which saves you a lot of time:
Fix imports.

Did I miss anyone mentioning such a feature request?

Or is there already a solution around ?

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


Re: [Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-17 Thread Malte Milatz
Michael T. Richter:
 I'm trying to build Yi (from the darcs repository) to take a look at
 it. 

I tried that, too, and it seems to me that if you use a different GHC
version than the developers have, you're very likely to be struck.  (Now
how will I know what version they use?)

 The README that comes with it says it's a standard Cabal project so
 do what you normally do (paraphrased slightly). 

That seems to be a README bug.  The following steps seem to be
necessary:

cd packages/yi-lib/
runghc Setup.hs configure
runghc Setup.hs build
sudo runghc Setup.hs install
cd ../..
runghc Setup.hs configure
runghc Setup.hs build

You will need specific filepath and Vty libraries, as stated in the
Readme.

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


Re: [Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-17 Thread Michael T. Richter
On Sun, 2007-17-06 at 08:18 +0100, Alistair Bayley wrote:

  I'm trying to build Yi (from the darcs repository) to take a look at it.  
  The README that comes with it says it's a standard Cabal project so do 
  what you normally do (paraphrased slightly).  The problem is that I'm not 
  a cabal user just yet and have no idea where to go from here.
 
 The standard cabal usage is:
   runhaskell Setup.hs configure
   runhaskell Setup.hs build
   runhaskell Setup.hs install
 
 
 http://www.haskell.org/haskellwiki/How_to_install_a_Cabal_package
 
 Alistair


I eventually hit that Wiki and still had no joy.  On a clean darcs get:
---8---

$ runhaskell Setup.hs build
/usr/local/share/yi-0.3
Preprocessing executables for yi-0.3...
Building yi-0.3...
[1 of 4] Compiling Yi.Kernel( Yi/Kernel.hs,
dist/build/yi/yi-tmp/Yi/Kernel.o )
[2 of 4] Compiling Yi.Debug ( Yi/Debug.hs,
dist/build/yi/yi-tmp/Yi/Debug.o )
[3 of 4] Compiling Yi.Boot  ( Yi/Boot.hs,
dist/build/yi/yi-tmp/Yi/Boot.o )
[4 of 4] Compiling Main ( Main.hs,
dist/build/yi/yi-tmp/Main.o )
Linking dist/build/yi/yi ...
Precompiling vty

Yi/Vty.hs:10:7:
Could not find module `Graphics.Vty':
  Use -v to see a list of the files searched for.
Precompile of vty failed. Install the corresponding library if
needed.
Precompiling gtk

Yi/Vty.hs:10:7:
Could not find module `Graphics.Vty':
  Use -v to see a list of the files searched for.
Precompile of gtk failed. Install the corresponding library if
needed.

---8---
Now I know that gtk is installed, given that I'm able to build gtk2hs
(or at least was able to -- I haven't tried it with GHC 6.6.1 yet).  I
have no idea what Vty is, so I don't know how to solve this problem.  I
am interested in why the gtk build is looking for what appears to be a
console library, however.

Any further guidance?
-- 
Michael T. Richter [EMAIL PROTECTED] (GoogleTalk:
[EMAIL PROTECTED])
Experts in advanced countries underestimate by a factor of two to four
the ability of people in underdeveloped countries to do anything
technical. (Charles P Issawi)


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


Re: [Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-17 Thread Michael T. Richter
OK, got the builds to work.  I did, in fact, have to go two layers down
to build yi-lib and install it before building yi proper.  (I think this
needs to be updated in the docs or repaired, whichever is appropriate.)

So, I have a Yi build.  I type Yi and it... dies.  It complains about
not having a YiConfig.hs and suggests something to read.  (I like this
touch, actually.)  And, unlike, say, emacs, it tells you how to exit.
So I copy the examples/YiConfig.hs to ~/.yi and try again.  I'll let the
console speak for itself:


/home/michael/.yi/YiConfig.hs:15:2:
Couldn't match expected type `GHC.IOBase.IORef Editor'
^I   against inferred type `Yi'
  Expected type: Control.Monad.Reader.ReaderT
(GHC.IOBase.IORef Editor)
^I^I^I^I^I^I  IO
^I^I^I^I^I^I  t
  Inferred type: Action
In the expression: changeKeymapE myKeymap
In a 'do' expression: changeKeymapE myKeymap


This is the stock YiConfig.hs left completely untouched and boilerplate.
What's the next step?  (Running yi --as=whatever doesn't help either.
Same errors.)
-- 
Michael T. Richter [EMAIL PROTECTED] (GoogleTalk:
[EMAIL PROTECTED])
Our outrage at China notwithstanding, we should remember that before
1891 the copyrights of foreigners were not protected in the United
States. (Lawrence Lessig)


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


[Haskell-cafe] Re: Building Yi (and wider Cabal stuff)

2007-06-17 Thread Jean-Philippe Bernardy
Michael T. Richter ttmrichter at gmail.com writes:

I am Yi maintainer, and therefore responsible for this mess :)

The Yi build is rather involved (due among others to its dynamic nature), and to
make things worse, the build procedure is not up to date. I'm working on
simplifying things though.

Your problem apparently is that I've made the GTK build depending on Vty
(accidentally). I'm going to fix this and contact you when it's done.

Incidentally I've created a mailing list for discussing this sort of issues:
http://groups.google.com/group/yi-devel

Cheers,
JP.


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


Re: [Haskell-cafe] Useful IDE features - What abaut automatically adding import statements?

2007-06-17 Thread David House
Marc Weber writes:
  Eclipse does have this which saves you a lot of time:
  Fix imports.

Could you describe the semantics of that more precisely?

-- 
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Useful IDE features - What abaut automatically adding import statements?

2007-06-17 Thread Marc Weber
On Sun, Jun 17, 2007 at 10:58:04AM +0100, David House wrote:
 Marc Weber writes:
   Eclipse does have this which saves you a lot of time:
   Fix imports.
 
 Could you describe the semantics of that more precisely?

You get the error:
Not in scope 'c'

and the IDE should figure out automatically which used packages have
modules exporting c.
Then it should ask wether you want import one of those modules and add
the module to the import list.

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


Re: [Haskell-cafe] Useful IDE features - What abaut automatically adding import statements?

2007-06-17 Thread Neil Mitchell

Hi

It's one of the features I want to add to GuiHaskell
(http://www-users.cs.york.ac.uk/~ndm/guihaskell/). Once the main code
base is finished, things like this should be relatively easy.

Thanks

Neil


On 6/17/07, Marc Weber [EMAIL PROTECTED] wrote:

On Sun, Jun 17, 2007 at 10:58:04AM +0100, David House wrote:
 Marc Weber writes:
   Eclipse does have this which saves you a lot of time:
   Fix imports.

 Could you describe the semantics of that more precisely?

You get the error:
Not in scope 'c'

and the IDE should figure out automatically which used packages have
modules exporting c.
Then it should ask wether you want import one of those modules and add
the module to the import list.

Marc
___
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] Useful IDE features - What abaut automaticallyadding import statements?

2007-06-17 Thread Claus Reinke

  Eclipse does have this which saves you a lot of time:
  Fix imports.

Could you describe the semantics of that more precisely?


You get the error:
Not in scope 'c'

and the IDE should figure out automatically which used packages have
modules exporting c.
Then it should ask wether you want import one of those modules and add
the module to the import list.


in my vim setup, i can hit '_i' (import) or '_im' (import module) on an 
identifier to get a menu of modules from which it could be imported;

selecting an entry adds an import to the current module, either for the
identifier only, or for the whole module it comes from (this feature 
gets its information from haddock's indices of the standard 
hierarchical libs, so it is currently limited to identifiers found there) .


combined with quickfix mode, which will jump to the identifier not
in scope, this seems to be quite close to what you ask for?

http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/

[while useful, it doesn't check for existing imports, and it relies on
ghc --make/--interactive to find the packages holding the modules]

there's also '_.' which will use the same data to suggest possible
fully qualified identifiers for the id under cursor.

claus

ps
HaRe also had some transformations for manipulating imports/exports.
http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html


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


[Haskell-cafe] Re: Yaham - Yet Another HAskell Mode for GNU Emacs

2007-06-17 Thread Pete Kazmier
Ian Zimmerman [EMAIL PROTECTED] writes:

 It has a different focus than the Moss haskell-mode that's normally
 used nowadays.  Yaham strives, first and foremost, to integrate well
 with the rest of Emacs and respect the Emacs ecosystem.

Could you elaborate on this?  Perhaps an itemized list of things that
are different?

Thanks,
Pete

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


Re: [Haskell-cafe] Useful IDE features - What abaut automaticallyadding import statements?

2007-06-17 Thread Marc Weber
On Sun, Jun 17, 2007 at 03:39:25PM +0100, Claus Reinke wrote:
 in my vim setup, i can hit '_i' (import) or '_im' (import module) on an 
Great. To late ;(
I've now implemented this as well. My setup is getting the information
directly from the installed packages (thus ghc-pkg describe package and
then ghc -show-iface eachmodule.hi) Because I use caching it
should be reasonable fast ? (I hope so, I still have to do some testing)
The used packages are taken from the cabal file (and / or buffer
setting)

 identifier to get a menu of modules from which it could be imported;
 selecting an entry adds an import to the current module, either for the
 identifier only, 

  import Foo (a)

add identifier b
results in
  import Foo (a,b) 

? 

or for the whole module it comes from (this feature 
 gets its information from haddock's indices 
I'm using tags and the plain source file most of the time.
So I don't have trouble generating haddock documentation.
I think its easy but I haven't spent much time on this.
It contains all, the documentation and the implementation.

 combined with quickfix mode, which will jump to the identifier not
 in scope, this seems to be quite close to what you ask for?
I'll let you know when having finished the quickfix integration.
Perhaps this can be done all automatically?
 http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/
 there's also '_.' which will use the same data to suggest possible
 fully qualified identifiers for the id under cursor.
This might be useful, too

 HaRe also had some transformations for manipulating imports/exports.
 http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html
I don't know HaRe at all. Would this even work when working with #ifdef
etc?

I'd like to have some features, such as _T ..
But this only works if the file can be parsed by ghc, right?

Thanks for your suggestion.
Marc Weber
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] dangerous inlinePerformIO in Data.Binary(?)

2007-06-17 Thread Roberto Zunino

Udo Stenzel wrote:

| toLazyByteString :: Builder - L.ByteString
| toLazyByteString m = S.LPS $ inlinePerformIO $ do
| buf - newBuffer defaultSize
| return (runBuilder (m `append` flush) (const []) buf)

Why is this safe?  Considering the GHC implementation of IO, isn't there
a real danger that 'newBuffer defaultSize' is floated out and therefore
every invocation of 'toLazyByteString' starts out with the same buffer?


Floating out (newBuffer defaultSize) as in

| foo = newBuffer defaultSize
|
| toLazyByteString m = S.LPS $ inlinePerformIO $ do
| buf - foo
| return (runBuilder (m `append` flush) (const []) buf)

would still be safe, AFAICS. Floating out buf instead should be 
prevented by the implicit RealWorld parameter.


My (possibly wrong) understanding is that, each invocation of 
(toLazyByteString m) may cause either

1) a new buf to be allocated and runBuilder run on it or
2) to reuse the result of another invocation of (toLazyByteString m), 
having the same m


Case 1) would be the no inlining happened case, while 2) would be
the inlining happened. So, the buf stored in S.LPS may be equal for 
equal m's. Different m's should use distinct buffers.


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


Re: [Haskell-cafe] Useful IDE features - What abautautomaticallyadding import statements?

2007-06-17 Thread Claus Reinke

I've now implemented this as well. My setup is getting the information
directly from the installed packages (thus ghc-pkg describe package and
then ghc -show-iface eachmodule.hi) Because I use caching it
should be reasonable fast ? (I hope so, I still have to do some testing)
The used packages are taken from the cabal file (and / or buffer
setting)


the more, the merrier!-) yes, caching is essential (reading in a huge
dictionary is fast, creating it is not). getting the info from ghc-pkg would
be preferable, and i do actually keep two dictionaries, one from haddock,
one from ghci's :browse. but there seems to be a lot of internal info in the 
output of --show-iface, is that useable? extracting the information from

haddock indices was the most-likely-to-work approach at the time..

linking editing sessions to .cabal files is still on my todo list;-)


 import Foo (a)

add identifier b
results in
 import Foo (a,b) 

? 


currently, i get:

import Foo (a) 
import Foo (b) 


which is one reason why i'd like to take existing imports into account
in some future version.

or for the whole module it comes from (this feature 
gets its information from haddock's indices 

I'm using tags and the plain source file most of the time.


yes, tags and sources are used for some features, but the standard
libs simply have no sources in the default installations.


So I don't have trouble generating haddock documentation.
I think its easy but I haven't spent much time on this.
It contains all, the documentation and the implementation.


i'm not generating haddocks, just extracting information from them.


combined with quickfix mode, which will jump to the identifier not
in scope, this seems to be quite close to what you ask for?

I'll let you know when having finished the quickfix integration.


basic quickfix settings for ghc seem fairly straightforward, see

http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/vimfiles/compiler/GHC.vim


HaRe also had some transformations for manipulating imports/exports.
http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html

I don't know HaRe at all. Would this even work when working with #ifdef
etc?


i don't recall whether we tried to do anything about preprocessors,
probably not. also, preprocessor directives are mostly used to work
around language differences, and none but the haskell 98 branch
would be useable with HaRe.


I'd like to have some features, such as _T ..
But this only works if the file can be parsed by ghc, right?


yes. both '_t' and '_T' simply use ghci's :t (:s is also available via '_si').

claus

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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Hans van Thiel
On Sun, 2007-06-17 at 02:00 +0100, Donnchadh Ó Donnabháin wrote: 
Hi Peter,
 
  I'm also just starting to learn Haskell and tried the eclipsefp
  eclipse plugin [1] (since my day job is java development).
Hello Donnchadh,

What operating system do you use? I've tried it several times on Fedora
Core 6 but it doesn't work, either with the FC Eclipse or the official
Eclipse version. The Haskell plug-in  installs fine, but the editor
crashes, not always the same way.
The problem seems to be the different Java versions, and Java Virtual
Machines, which are in use on different systems. The Fedora Eclipse also
has problems with some other plug-ins which are not supported (yet).

Something similar happened with an Open Office Java utility which,
according to the documentation, only works with the Sun JVM. Even though
OO allows selection among different JVMs, that didn't work either.

The eclipsefp site does list some bugs I've encountered, but does not
mention any JVM or other preferences. But I'm convinced that's the
problem...
 It seems a
  little basic at the moment, but judging from this blog [2] it seems to
  have a lot of potential. 
What I've seen of it, before it crashes, looks very nice. 

Regards,

Hans van Thiel
 In fact part of the project seems to be to
  allow the development of eclipse plugins written in haskell, which
  could allow the possibility of integrating some of the tools listed on
  the haskell wiki with it.
 
  I also tried eclipsedarcs [3] for darcs repository access but it only
  really seems to work with local repositories.
 
Donnchadh
 
  [1] http://eclipsefp.sourceforge.net/haskell/index.html
  [2] http://cohatoe.blogspot.com/
  [3] http://eclipsedarcs.org/doku.php
 

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


Re: [Haskell-cafe] How to read -ddump-hi output (and other phases) from GHC

2007-06-17 Thread Aaron Tomb
The .hcr format isn't cast in stone, either. Though I'm working on  
the implementation, I don't have any immediate plans to use it,  
myself. So, if other people have suggestions for how it should be  
different, I'd love to hear them.


Aaron

On Jun 5, 2007, at 12:23 AM, Simon Peyton-Jones wrote:


|  4.16.3. How to read Core syntax
|  http://www.haskell.org/ghc/docs/latest/html/users_guide/options- 
debugging.html#id3130643

|
| I found that -ddump-simpl gives you good information, in a readable
| form - I much prefer it to reading the .hcr files.

The printer for GHC's Core language wasn't originally designed for  
lots of people to read, although lots of people now do.  It's not  
cast in stone.  If someone wants to improve the output, please go  
ahead.


Simon
___
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] hSetBuffering woes

2007-06-17 Thread Bryan O'Sullivan

Eric wrote:

I'm writing  a simple HTTP server and am trying to implement the POST 
method.


That's a rather general problem statement, indeed :-)  For an 
application like this, I'd suggest that explicit resource management is 
the way to go, and that you should not be using hGetContents at all, 
under any guise.  For example, any scheme involving reading an entire 
stream is going to do completely the wrong thing in the face of HTTP 
keepalive.  Also, code that leaves open sockets piling up in drifts, to 
eventually be shoveled up by the RTS, is going to be trivially easy to DoS.


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


RE: [Haskell-cafe] IDE?

2007-06-17 Thread peterv
I just tried the Haskell Mode using xemacs, adjust my init.el file, loaded
my haskell file, and got great syntax highlighting! So far so good.

But people, emacs is so weird for a Windows user... 

For example, ALL windows (and motif?) programs use CTRL-Z for undo. But not
emacs... So after some googling, I found and installed CUA, to get more
Windows compliant keys. CTRL-Z does undo, woohoo! But CTRL-Y doesn't do redo
yet, as in ALL windows programs. Select a block, press delete. ALL Windows
text editors will delete the block, but not emacs, it just deselects the
block and deletes the current character. I also couldn't get the auto
indentation working, not sure why, I thought that pressing ENTER would
automatically indent my code, especially when I end my line with $. Pressing
TAB will not insert a TAB, like in ALL Windows editors.

I guess I could spend time to configure all the keys and behavior. Heck with
LISP you can do anything! Even change the addition operator into whatever
other binary operator, at runtime, at any time, as a side-effect, horror! ;)
But I have no interest in learning emacs, I just want to learn Haskell
without having to perform too much manual text editing that one does not
expect to do in the 21st century :) 

So I could erase my brain and figure out all the emacs keys. But then I will
have a hard time using ANY other Windows program.

I'm sure if all you use is Emacs, this must really be great, but for the
average Windows coder that is used thay ANY other popular IDE, switching is
not obvious at all...

No pun intended; I know Emacs is an incredible system (I used to work with
it on OS/2, and if I recall correctly, I could even read my email right
inside of it, heck it could even make me lispy breakfast! ;), but it's just
so... alien, at least when looking at it from a Windows perspective. 

And that's why IMHO for Windows users, one needs a friendly IDE to get
started with Haskell in a modern way. And the Windows version should comply
to the Windows styleguides. Haskell is such a nice language, it should reach
a larger audience, and just like Concurrent Clean, that could be done by
providing a simple IDE.

Phew, my frustration leaked into this email, but at least now I got rid of
it, sorry guys ;)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Verswyvelen
Sent: Saturday, June 16, 2007 10:35 PM
To: haskell-cafe@haskell.org
Subject: Re: Re[2]: [Haskell-cafe] IDE?

That's just my point. Although I have no practical experience with Haskell
(besides writing a simple L-System using HOpenGL), from what I've read
Haskell is indeed much better than typical OO languages... So it *deserves*
an easy entry level IDE that will get many many more people started with it.
Like Concurrent Clean has, although their IDE is also far from perfect (e.g.
they don't have multi-level undo, sigh)

Anyway, it seems many people use Emacs for their Haskell edit/compile/run
cycle. I've used Emacs on IBM OS/2 a long time ago so I guess I can get back
into it. But man, was I happy back then when I could switch over to Visual
Studio... The productivity I nowadays have with Visual Studio 2005 and
Resharper for doing compilation, code-documentation-tips, code-completion,
refactoring, navigation, debugging, boiler plate code generation, is
amazing. Some of my colleagues still use Emacs, and maybe they are not using
it correctly, but at first sight their development is much much slower.

From this cafe talk I now know such an IDE for Haskell does not exist. So I
won't search any further for a great IDE before starting to do some real
Haskell programming, because my L-Systems experiment was a lot of fun! 

So I just installed XEmacs with the latest Haskell mode. I'll go from
here... If that doesn't work, Notepad++ and GHCI/GHC in a command prompt
also works, although it does make me feel I'm back in the eighties.

Thanks for all the help folks!

- Oorspronkelijk bericht -
Van: Bulat Ziganshin [mailto:[EMAIL PROTECTED]
Verzonden: zaterdag, juni 16, 2007 08:50 PM
Aan: [EMAIL PROTECTED]
CC: haskell-cafe@haskell.org
Onderwerp: Re[2]: [Haskell-cafe] IDE?

Hello bf3,

Saturday, June 16, 2007, 3:23:40 PM, you wrote:

 The point I wanted to make is, that I can't find an
 easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows that comes
with
 all or most of those features. I mean something like Borland TurboPascal

it's well-known trap. haskell is an order of magnitude better than
widespread OOP languages. why it's not used by everyone? just due to
shortage on libs, training and - yes - IDEs. programming in Delphi
in many cases need just clicking here and there

so, you got something, you lost something

ps: i use editor which supports only syntax highlighting. it's very
like working in tp 3.0 or quickc 1.0 - are you had such experience? :)



-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]






[Haskell-cafe] Re: Sneaking haskell in the workplace -- cleaning csv files

2007-06-17 Thread Pete Kazmier
Brandon S. Allbery KF8NH [EMAIL PROTECTED] writes:

 On Jun 15, 2007, at 18:37 , Jason Dagit wrote:

 I love to see people using Haskell, especially professionally, but I
 have to wonder if the real tool for this job is sed? :-)

 Actually, while sed could do that, it'd be a nightmare.  You really
 want a parser to deal with general CSV like this, and while you can
 write parsers in sed, you *really* don't want to.  :)

sed ':a /,$/!{N;s/\n//;ba}' somefile.csv

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


Re: [Haskell-cafe] Re: Sneaking haskell in the workplace -- cleaning csv files

2007-06-17 Thread Brandon S. Allbery KF8NH


On Jun 17, 2007, at 14:04 , Pete Kazmier wrote:


Brandon S. Allbery KF8NH [EMAIL PROTECTED] writes:


On Jun 15, 2007, at 18:37 , Jason Dagit wrote:


I love to see people using Haskell, especially professionally, but I
have to wonder if the real tool for this job is sed? :-)


Actually, while sed could do that, it'd be a nightmare.  You really
want a parser to deal with general CSV like this, and while you can
write parsers in sed, you *really* don't want to.  :)


sed ':a /,$/!{N;s/\n//;ba}' somefile.csv


If it's simple enough, sure.  If you get into dealing with quoting,  
it gets a lot more complex in a hurry.


Of course, given that this is from Oracle, it *probably* doesn't.   
(But as a sysadmin and ex-dba, probably is worrisome)


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


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


Re: [Haskell-cafe] dangerous inlinePerformIO in Data.Binary(?)

2007-06-17 Thread Udo Stenzel
Roberto Zunino wrote:
 Floating out (newBuffer defaultSize) as in
 
 | foo = newBuffer defaultSize
 |
 | toLazyByteString m = S.LPS $ inlinePerformIO $ do
 | buf - foo
 | return (runBuilder (m `append` flush) (const []) buf)
 
 would still be safe, AFAICS. Floating out buf instead should be 
 prevented by the implicit RealWorld parameter.

That's actually what I meant, though I wouldn't describe it as floating
out buf, since that's not the only thing that happens, and it is not
prevented.  Unfolding a bit gives you something like

| toLazyByteString m = S.LPS (
|   case newBuffer defaultSize RealWorld# of { ( buf, world1 ) -
|   runBuilder blahblah buf } )

since the scrutinee of the case expression is constant, it can float
anywhere:

| bufAndWorld1 = newBuffer defaultSize RealWorld# 
| 
| toLazyByteString m = S.LPS (
|   case bufAndWorld1 of { (# buf, world1 #) -
|   runBuilder blahblah buf } )

and that is bad.  It might simplify even further, making the resulting
bug even harder to detect.  The only reason this doesn't happen with
unsafePerformIO or runST is that it is not inlined.  One of them even
has a comment in the GHC library sources to the effect that the NOINLINE
pragma was forgotten, which resulted in a subtle and ugly bug.


-Udo
-- 
If you cannot in the long run tell everyone what you have been doing,
your doing was worthless.
-- Erwin Schrödinger


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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Donnchadh Ó Donnabháin

On 6/17/07, Hans van Thiel [EMAIL PROTECTED] wrote:

On Sun, 2007-06-17 at 02:00 +0100, Donnchadh Ó Donnabháin wrote:

What operating system do you use? I've tried it several times on Fedora
Core 6 but it doesn't work, either with the FC Eclipse or the official
Eclipse version. The Haskell plug-in  installs fine, but the editor
crashes, not always the same way.
The problem seems to be the different Java versions, and Java Virtual
Machines, which are in use on different systems. The Fedora Eclipse also
has problems with some other plug-ins which are not supported (yet).


 I use both windows and fedora. I don't use the fedora-provided
eclipse. Instead I have installed Sun's JVM (1.6.0 update 1) and
downloaded eclipse from eclipse.org .

I use eclipse on fedora every day with a multitude of plugins and it
seems to be very stable when run on the Sun JVM.

In the past I have had problems running eclipse with GCJ.

I haven't really had a chance to use eclipsefp in anger yet, but
syntax highlighting, error highlighting and compiling work. Runnging
in ghci didn't seem to work for me but I must look into that. No
crashes or exceptions yet.

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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Neil Mitchell

Hi


And that's why IMHO for Windows users, one needs a friendly IDE to get
started with Haskell in a modern way. And the Windows version should comply
to the Windows styleguides.


I use TextPad and WinHugs, you might find Visual Studio meets your
needs better. Both those options are properly Windows native.

Thanks

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


[Haskell-cafe] Re: Building Yi (and wider Cabal stuff)

2007-06-17 Thread Jean-Philippe Bernardy
Michael T. Richter ttmrichter at gmail.com writes:

 OK, got the builds to work.  I did, in fact, have to go two layers down to
 build yi-lib and install it before building yi proper.  (I think this needs 
 to be updated in the docs or repaired, whichever is appropriate.)

Please provide (doc) patches. :)

 This is the stock YiConfig.hs left completely untouched and boilerplate.
 What's the next step?  (Running yi --as=whatever doesn't help either.  Same 
 errors.)

I forgot to update the sample YiConfig.hs after a change I made; please 
pull the latest patches and copy YiConfig.hs to ~/.yi

This should fix the problem.

Thanks for trying Yi!
JP.




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


[Haskell-cafe] Re: IDE?

2007-06-17 Thread Jean-Philippe Bernardy
Claus Reinke claus.reinke at talk21.com writes:

 This was followed by Ermacs, a concurrent
 Emacs clone written completely in Erlang. Ermacs
 is fairly complete – it has major modes for
 Erlang and Scheme programming, a built-in Erlang
 shell, and support for efficiently editing large
 files. However, once the core editor was complete,
 it was obvious that GNU Emacs has an incredibly
 large set of wonderful features, and that extending
 Ermacs to include “enough” of them was
 completely out of the question.
 The lessons learned from Ermacs lead to Distel,..
 
 how is Yi going to avoid that trap?

Here's the plan for world domination:

* Many features are going to be written/replicated as haskell libraries anyway,
for usage as independent libraries.
* Make sure gluing code is relatively easy

I frankly suspect that haskell is a lot more powerful than erlang, and therefore
it will be way easier to write code for Yi than Ermacs. 

For example, Ben Moseley has written a rudimentary Dired mode for Yi in about a
week (I think), with no prior knowledge of Yi. The module is now 347 lines long
(including blanks and comments)

Also, I suspect haskell will become more popular than erlang, and the
contributions to the respective editor of choice proportional.


Cheers,
JP.



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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Andrew Coppin

Marc Weber wrote:

  Personally, I really hate text-mode editors. (I won't even go into how
  many times I've had to reboot Linux just to get *out* of Vi!)



One bad experience and you have never given anyone/what a chance to proof you 
wrong ;)
  


I tried a whole heap of different text editors - Vi, Vim, Nano, Pico, 
Emacs, Jim, Fred, Christopher...


(OK, I made that last one up.)

The only ones I managed to actually edit files with are Nano and Pico. 
But given the choice, I'd *much* rather use KWrite. (Or Kate if I really 
have to.)


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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Andrew Coppin

David House wrote:

Andrew Coppin writes:

  It's a text-mode editor.

With graphical support.
  


Really? When did that happen?

(And if it's now graphical, can you really still call it Emacs? I 
mean, if you write a GUI application that does what sed does, would it 
still be sed?)



   quod erat demonstrandum.

Please don't be so quick to jump to conclusions like that.
  


You make it sound as if I haven't tried this stuff...


  or an interactive debugger,

As previously mentioned, debugging in Haskell hasn't really reached maturity
yet,


Yeah, pitty that... (Again, I was going to try compiling HEAD to play 
with this - and then I realised you need Linux to do it, so I haven't 
got round to it yet.)


  or any of those other features that require a GUI. 


Perhaps you ought to revise your opinions on what constitutes a GUI.
  


Well, part 1 would be being *graphical*. I really have no time for ugly 
cryptic ASCII art graphical UIs... I just like being able to *see* 
what's happening. Is that too much to ask?


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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Andrew Coppin

Bulat Ziganshin wrote:

it's well-known trap. haskell is an order of magnitude better than
widespread OOP languages. why it's not used by everyone? just due to
shortage on libs, training and - yes - IDEs. programming in Delphi
in many cases need just clicking here and there
  


I'll second the libs thing - it's really quite frustrating the number of 
simple things for which no libraries exist. :-(


Still, the Open Source Way(tm) is to invent your own - and that is a 
task that is beyond my capabilities, so there.


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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread David House
Andrew Coppin writes:
  The only ones I managed to actually edit files with are Nano and Pico. 
  But given the choice, I'd *much* rather use KWrite. (Or Kate if I really 
  have to.)

Despite it exhibing virtually none of your own aforementioned IDE features?
Emacs may be hard to get used to, but its power makes it worth it. Give it a
fair try over a weekend or so, count the experience as gaining a life skill.

-- 
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] IDE?

2007-06-17 Thread David House
peterv writes:
  But people, emacs is so weird for a Windows user... 

Yes, there's no denying this.

  For example, ALL windows (and motif?) programs use CTRL-Z for undo. But not
  emacs... So after some googling, I found and installed CUA, to get more
  Windows compliant keys. CTRL-Z does undo, woohoo! 

My personal recommendation is that as soon as you're familiar with Emacs, turn
off CUA mode. It shouldn't take too long to retrain your brain to use the new
shortcuts, and with CUA mode you can't really use Emacs to its full potential.

  But CTRL-Y doesn't do redo yet, as in ALL windows programs.

Emacs uses a different (and more powerful) undo model to everyone else. The
'Undo' section of the Emacs tour [1] explains this well.

[1]: http://www.gnu.org/software/emacs/tour/

  Select a block, press delete. ALL Windows text editors will delete the block,
  but not emacs, it just deselects the block and deletes the current character.

Place (delete-selection-mode 1) in your .emacs.

  I also couldn't get the auto indentation working, not sure why, I thought
  that pressing ENTER would automatically indent my code, especially when I end
  my line with $. Pressing TAB will not insert a TAB, like in ALL Windows
  editors.

It's more traditional in Emacs to use TAB to indent code, and Enter (aka RET in
Emacs circles) just creates a newline. You can use C-j to perform a newline and
indent.

Make sure you read up on how indentation works in haskell-mode, though,
otherwise you'll confuse yourself. The Haskell wiki page for haskell-mode [2]
would be a good place to start.

[2]: http://haskell.org/haskellwiki/Haskell_mode_for_Emacs#Indentation

  But I have no interest in learning emacs, I just want to learn Haskell
  without having to perform too much manual text editing that one does not
  expect to do in the 21st century :) 

You will have to learn Emacs in order to use Emacs. But once you do, you'll
never go back. That's my experience at least.

  No pun intended; I know Emacs is an incredible system (I used to work with
  it on OS/2, and if I recall correctly, I could even read my email right
  inside of it, heck it could even make me lispy breakfast! ;), but it's just
  so... alien, at least when looking at it from a Windows perspective. 

In fact I read your mail and am reponding using the excellent VM [3], a mail
reader for Emacs :)

[3]: http://www.wonderworks.com/vm/

  And that's why IMHO for Windows users, one needs a friendly IDE to get
  started with Haskell in a modern way. And the Windows version should comply
  to the Windows styleguides. Haskell is such a nice language, it should reach
  a larger audience, and just like Concurrent Clean, that could be done by
  providing a simple IDE.

Emacs isn't a Windows editor, that's for certain. However, that doesn't mean it
isn't worth sticking with.

  Phew, my frustration leaked into this email, but at least now I got rid of
  it, sorry guys ;)

It's the same frustration I felt when I was looking for a good Haskell IDE. I
really didn't want to try Emacs because I was under the impression that it would
be arcane and impossible to learn. But it's the most powerful editor around
today, and let me tell you, if you can learn Haskell, you can certainly learn
Emacs :)

-- 
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Michael T. Richter
On Sun, 2007-17-06 at 22:37 +0100, David House wrote:

   Well, part 1 would be being *graphical*. I really have no time for ugly 
   cryptic ASCII art graphical UIs... I just like being able to *see* 
   what's happening. Is that too much to ask?
 
 Did you read the rest of my email? For every feature you cited I gave links 
 and
 screenshots to the Emacs equivalents, none of which (AFAIK -- I don't actually
 use them all) use ASCII art.


Got a file chooser that's actually a GUI that has the look and feel of
every other GUI file chooser in existence?  Because what I see in emacs
now that I've got the X version working (aside from horrible, ugly,
unreadable fonts -- again the Notepad of the GNOME world is kicking ass
and taking names here!) is a half-assed GUI wrapped around a plain
text-dominated interface.  Kind of what you'd expect from people who
think that GUIs are a waste of time and put one in just to say we've
got a GUI -- what are you talking about?

-- 
Michael T. Richter [EMAIL PROTECTED] (GoogleTalk:
[EMAIL PROTECTED])
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not Eureka! but That's funny... (Isaac Asimov)


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


Re: [Haskell-cafe] Useful IDE features - Whatabautautomaticallyadding import statements?

2007-06-17 Thread Claus Reinke

I'd like to have some features, such as _T ..
But this only works if the file can be parsed by ghc, right?


yes. both '_t' and '_T' simply use ghci's :t (:s is also available via '_si').


actually, that was only in early versions. these days, GHC.vim
lists the imports, uses 'ghc -e :browse ..' on each import, and
caches the results in a dictionary, which is used both for one
of the completions, and for '_t'/'_T'.

claus

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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Chaddaï Fouché

2007/6/18, Michael T. Richter [EMAIL PROTECTED]:

 Got a file chooser that's actually a GUI that has the look and feel of every 
other GUI file
chooser in existence?


Strange... Here I have the same file chooser as every other
application in the WM (personally I use C-x C-f most of the time since
with the completion it's faster if you know what you want to load),
what are you speaking about ? (Are you really using emacs and not
xemacs ?)


working (aside from horrible, ugly, unreadable fonts -- again the Notepad of 
the GNOME
world is kicking ass and taking names here!)


The Notepad of the GNOME world ? You're speaking about Gedit ? What
have gedit to do with emacs ?

Beside you can activate cleartype support for emacs now, and have
nicely antialiased fonts.

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


Re: [Haskell-cafe] Re: IDE?

2007-06-17 Thread Claus Reinke

files. However, once the core editor was complete,
it was obvious that GNU Emacs has an incredibly
large set of wonderful features, and that extending
Ermacs to include “enough” of them was
completely out of the question.
The lessons learned from Ermacs lead to Distel,..
how is Yi going to avoid that trap?



Here's the plan for world domination:
..
I frankly suspect that haskell is a lot more powerful than erlang, and therefore
it will be way easier to write code for Yi than Ermacs.
..
Also, I suspect haskell will become more popular than erlang, and the
contributions to the respective editor of choice proportional.
..


i didn't know that Yi had acquired a tongue-in-cheek mode
already!-) at least i hope that's what it was, because the ermacs
lesson was not about contributing code or better language, but
about sheer size and momentum being in favour of the weaker
solution.

that's not to say that Yi isn't worthwhile - having a haskell-only
editor solution available can be useful at times, and being able
to write a useful one is a good test of the language.

claus

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


[Haskell-cafe] String Hashing

2007-06-17 Thread Thomas Conway

Hi All,

I'm trying to figure out how to maximum performance out of one of my
inner loops which involves string hashing.

Consider the following hash function, which is a transliteration of a
good one written in C:

--8x--8x--8x--8x--8x--8x--8x--8x--8x
module HashStr where

import Data.Bits
import Data.ByteString as BLOB
import Data.Word

data Triple = Triple !Word64 !Word64 !Word64

hashStr :: ByteString - Word64
hashStr str = hashBlock (Triple gold gold gold) str
   where
   gold = 0x9e3779b97f4a7c13

hashBlock (Triple a b c) str
   | BLOB.length str  0 = hashBlock (mix (Triple a' b' c')) rest
   | otherwise   = c
   where
   a' = a + BLOB.foldl' make 0 (slice 0)
   b' = b + BLOB.foldl' make 0 (slice 1)
   c' = c + BLOB.foldl' make 0 (slice 2)
   make x w = (x `shiftL` 8) + fromIntegral w
   slice n = BLOB.take 8 $ BLOB.drop (8 * n) str
   rest = BLOB.drop 24 str

   mix :: Triple - Triple
   mix = (\(Triple a b c) - Triple (a - c) b c) .
 (\(Triple a b c) - Triple (a `xor` (c `shiftR` 43)) b c) .
 (\(Triple a b c) - Triple a (b - c) c) .
 (\(Triple a b c) - Triple a (b - a) c) .
 (\(Triple a b c) - Triple a (b `xor` (a `shiftL` 9)) c) .
 (\(Triple a b c) - Triple a b (c - a)) .
 (\(Triple a b c) - Triple a b (c - b)) .
 (\(Triple a b c) - Triple a b (c `xor` (b `shiftR` 8))) .
 (\(Triple a b c) - Triple (a - b) b c) .
 (\(Triple a b c) - Triple (a - c) b c) .
 (\(Triple a b c) - Triple (a `xor` (c `shiftR` 38)) b c) .
 (\(Triple a b c) - Triple a (b - c) c) .
 (\(Triple a b c) - Triple a (b - a) c) .
 (\(Triple a b c) - Triple a (b `xor` (a `shiftL` 23)) c) .
 (\(Triple a b c) - Triple a b (c - a)) .
 (\(Triple a b c) - Triple a b (c - b)) .
 (\(Triple a b c) - Triple a b (c `xor` (b `shiftR` 5))) .
 (\(Triple a b c) - Triple (a - b) b c) .
 (\(Triple a b c) - Triple (a - c) b c) .
 (\(Triple a b c) - Triple (a `xor` (c `shiftR` 35)) b c) .
 (\(Triple a b c) - Triple a (b - c) c) .
 (\(Triple a b c) - Triple a (b - a) c) .
 (\(Triple a b c) - Triple a (b `xor` (a `shiftL` 49)) c) .
 (\(Triple a b c) - Triple a b (c - a)) .
 (\(Triple a b c) - Triple a b (c - b)) .
 (\(Triple a b c) - Triple a b (c `xor` (b `shiftR` 11))) .
 (\(Triple a b c) - Triple (a - b) b c) .
 (\(Triple a b c) - Triple (a - c) b c) .
 (\(Triple a b c) - Triple (a `xor` (c `shiftR` 12)) b c) .
 (\(Triple a b c) - Triple a (b - c) c) .
 (\(Triple a b c) - Triple a (b - a) c) .
 (\(Triple a b c) - Triple a (b `xor` (a `shiftL` 18)) c) .
 (\(Triple a b c) - Triple a b (c - a)) .
 (\(Triple a b c) - Triple a b (c - b)) .
 (\(Triple a b c) - Triple a b (c `xor` (b `shiftR` 22)))

--8x--8x--8x--8x--8x--8x--8x--8x--8x

Obviously, we'd like all those lambdas and composes to be inlined,
along with all the intermediate Triple structures. So, how do you
convince ghc to do this? Alternatively, how would you *translate*
rather than transliterate, the mix function?

--
Dr Thomas Conway
[EMAIL PROTECTED]

Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] String Hashing

2007-06-17 Thread Stefan O'Rear
On Mon, Jun 18, 2007 at 11:55:05AM +1000, Thomas Conway wrote:
 Hi All,
 
 I'm trying to figure out how to maximum performance out of one of my
 inner loops which involves string hashing.
 
 Consider the following hash function, which is a transliteration of a
 good one written in C:
[ Code elided ]
 Obviously, we'd like all those lambdas and composes to be inlined,
 along with all the intermediate Triple structures. So, how do you
 convince ghc to do this? Alternatively, how would you *translate*
 rather than transliterate, the mix function?

Just pass the -O option to GHC. (-O2 for better results).  On my system
there are no lambdas or (.) left, as confirmed with -ddump-simpl.

However, GHC's 64 bit type is implemented using full foreign calls (and
thus rather expensive...) on 32 bit systems!  So if possible don't do
that.

Also, GHC produces this type signature for $wmix:

HashStr.$wmix :: GHC.Word.Word64
 - GHC.Prim.Word64#
 - GHC.Prim.Word64#
 - HashStr.Triple

That is, the unboxing is incomplete.  This is very very fishy; I'm
submitting a bug.

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


Re: [Haskell-cafe] String Hashing

2007-06-17 Thread Thomas Conway

FWIW, here's a link to the original c code:
   http://www.burtleburtle.net/bob/hash/evahash.html

--
Dr Thomas Conway
[EMAIL PROTECTED]

Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Michael T. Richter
On Mon, 2007-18-06 at 00:55 +0200, Chaddaï Fouché wrote:

   Got a file chooser that's actually a GUI that has the look and feel of 
  every other GUI file
  chooser in existence?



 Strange... Here I have the same file chooser as every other
 application in the WM (personally I use C-x C-f most of the time since
 with the completion it's faster if you know what you want to load),
 what are you speaking about ? (Are you really using emacs and not
 xemacs ?)


I'm using Emacs.  It gives me a text window, like any other editor
window (except where it's different) when I go to the horribly kludgy,
not-at-all-integrated-with-the-desktop-theme file menu.  In fact it's
even worse.  I go File-Open File... and it gives me ... a prompt in a
little command window at the bottom of the editing screen asking me for
the file name.  If I hit Enter, it displays the contents of my home
directory in an editing window.  I can right-click on a directory there
to open the directory -- in a new window.  (I have to select by cursor
and hit enter to open said directory in the same window.)

I installed Xemacs too and ran it once.  It had the same ugly fonts and
the same ugly menuing interface.  I'll confess, however, that I didn't
bother trying to open a file with it.  Let me do that now.
.
.
.
OK, this one has an actual dialogue box for opening files.  It isn't the
GNOME standard file opening widget, but it is at least a GUI.  It's just
a really crappy one.

And that's just one misfeature of Emacs.  Here's another (again only
Emacs-specific; Xemacs does it just fine) problem.  I open up a huge
file in Emacs.  I use my scroll wheel to work through it.  Nothing.  For
all Emacs cares, I may as well have an Apple one-button mouse connected
to my computer.  Oh.  Sorry.  Two-button.  Because almost everything
seems to be attached to right-clicks.  Left-clicks do little to nothing.
It doesn't seem to know about middle buttons, scroll wheels or any other
modern feature of computers made within, say, the last five years or so.


  working (aside from horrible, ugly, unreadable fonts -- again the Notepad 
  of the GNOME
  world is kicking ass and taking names here!)
 
 The Notepad of the GNOME world ? You're speaking about Gedit ? What
 have gedit to do with emacs ?


It, unlike Emacs, opens files using a standard file open dialogue
box


 Beside you can activate cleartype support for emacs now, and have
 nicely antialiased fonts.


Wouldn't it be nice if this feature were a) active by default or, at
least, b) available somewhere on the menus?  I can find nothing in the
GUI (of either *macs) that lets me specify fonts.  Everything's a
paper-thin wrapper around arcane config files with little to no
documentation available at hand formatted using any cross-application
(and even cross-platform!) standard.

-- 
Michael T. Richter [EMAIL PROTECTED] (GoogleTalk:
[EMAIL PROTECTED])
Theory is knowledge that doesn't work. Practice is when everything works
and you don't know why. (Hermann Hesse)


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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Michael T. Richter
On Sun, 2007-17-06 at 20:27 -0300, Alex Queiroz wrote:

  Albeit buttons are mostly a waste of time because the keyboard is
 so much more powerful,


For a very small percentage of users, yes.  For the vast majority, not
even close.


  nice and beautiful fonts are really a must.
 Fortunately Emacs have them, as the attached screenshot demonstrates.


Screenshots are worthless if they don't match my screen, aren't they?  I
guess I can open up exactly the same file that's in your screenshot and
then use your screenshot as a background to my screen so I have the
illusion of decent fonts, but that's not exactly a productive
environment now, is it?

-- 
Michael T. Richter [EMAIL PROTECTED] (GoogleTalk:
[EMAIL PROTECTED])
Experts in advanced countries underestimate by a factor of two to four
the ability of people in underdeveloped countries to do anything
technical. (Charles P Issawi)


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


Re: [Haskell-cafe] IDE?

2007-06-17 Thread Derek Elkins
Not directed at Michael Richter specifically:

I don't normally say this stuff, but this discussion has drifted onto
topics that have nothing to do with Haskell.  I personally would like
the parts unrelated to Haskell to be carried on off the list.

On Mon, 2007-06-18 at 12:26 +0800, Michael T. Richter wrote:
 On Sun, 2007-17-06 at 20:27 -0300, Alex Queiroz wrote: 
  Albeit buttons are mostly a waste of time because the keyboard is
  so much more powerful,
 
 For a very small percentage of users, yes.  For the vast majority, not
 even close.
 
  nice and beautiful fonts are really a must.
  Fortunately Emacs have them, as the attached screenshot demonstrates.
 
 Screenshots are worthless if they don't match my screen, aren't they?
 I guess I can open up exactly the same file that's in your screenshot
 and then use your screenshot as a background to my screen so I have
 the illusion of decent fonts, but that's not exactly a productive
 environment now, is it?
 
 -- 
 Michael T. Richter [EMAIL PROTECTED] (GoogleTalk:
 [EMAIL PROTECTED])
 Experts in advanced countries underestimate by a factor of two to four
 the ability of people in underdeveloped countries to do anything
 technical. (Charles P Issawi)
 ___
 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] IDE?

2007-06-17 Thread Jon Harrop
On Monday 18 June 2007 05:39:21 Derek Elkins wrote:
 Not directed at Michael Richter specifically:

 I don't normally say this stuff, but this discussion has drifted onto
 topics that have nothing to do with Haskell.  I personally would like
 the parts unrelated to Haskell to be carried on off the list.

I don't normally drag threads back on topic, but functional reactive GUIs seem 
to be pioneered by Haskell programmers. Can anyone explain what this idea is 
all about?

I'm just getting acquainted with GUI programming using LablGTK in OCaml and 
Windows Forms in F#, so I know next to nothing about GUI programming. In 
particular, I'm interested in developing GUIs for languages like these. More 
specifically, a variation of Mathematica's notebook front-end, designed to 
make functional languages more accessible and useful for scientists and 
engineers.

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