[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Thomas Hartman

To answer my original question, here's a few ways to accomplish what I
wanted with haskell

Perl is still a lot faster than ghc -e, but I guess if you wanted
speed you could compile first.



[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ls -l
total 16
-rw-r--r-- 1 thartman thartman 2726 Dec 20 07:56 UnixTools.hs
-rw-r--r-- 1 thartman thartman   82 Jan  7 07:18 echo.hs
-rwxr--r-- 1 thartman thartman  790 Mar  4 05:02 oneliners.sh
-rwxr--r-- 1 thartman thartman  646 Mar  4 04:18 oneliners.sh~

[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ./oneliners.sh
haskell, ghc -e pipe
16

real0m1.652s
user0m0.600s
sys 0m0.030s
**
haskell, hmap pipe
16

real0m1.549s
user0m0.410s
sys 0m0.200s
**
haskell, two pipes
16

real0m2.153s
user0m0.900s
sys 0m0.370s
**
perl, two pipes
16

real0m0.185s
user0m0.010s
sys 0m0.100s

[EMAIL PROTECTED]:~/learning/haskell/UnixTools$


[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ cat oneliners.sh
hmap (){ ghc -e interact ($*);  }
hmapl (){ hmap  unlines.($*).lines ; }
hmapw (){ hmapl map (unwords.($*).words) ; }

function filesizes () {
 find -maxdepth 1 -type f | xargs du
}

echo haskell, ghc -e pipe
time filesizes | ghc -e 'interact $ (++\n) . show . sum . map ( (
read :: String - Integer ) . head . words ) . lines '
echo **

echo haskell, hmap pipe
time filesizes | hmap '(++\n) . show . sum . map ( ( read :: String
- Integer ) . head . words ) . lines'
echo **

echo haskell, two pipes
time filesizes | hmapl map ( head . words ) | hmap '(++\n) . show
. sum . map ( read :: String - Integer ) . lines'
echo **

echo perl, two pipes
time filesizes | perl -ane 'print $F[0]\n' | perl -e '$sum += $_
while ; print $sum\n'


2007/3/2, Thomas Hartman [EMAIL PROTECTED]:

Okay, I am aware of

http://haskell.org/haskellwiki/Simple_unix_tools

which gives some implementation of simple unix utilities in haskell.

But I couldn't figure out how to use them directly from the shell, and
of course that's what most readers will probably wnat.

Or let me put it another way.

Is there a way to do

  find -maxdepth 1 -type f | xargs du | perl -ane 'print \$F[0]\n' |
perl -e '$sum += $_ while ; print $sum\n'

as a shell command that idiomatically uses haskell?

For non-perlers, that sums up the disk usage of all files in the
current directory, skipping subdirs.

print \$F[0]\n

looks at the first (space delimited) collumn of output.

perl -e '$sum += $_ while ; print $sum\n'

, which is I guess the meat of the program, sums up all the numbers
spewed out of the first column, so in the end you get a total.

So, anyone out there want to establish a haskell one liner tradition?

:)

thomas.


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


Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Donald Bruce Stewart
There's some nice one liners bundled with h4sh:

http://www.cse.unsw.edu.au/~dons/h4sh.html

For example:

http://www.cse.unsw.edu.au/~dons/h4sh.txt

If you recall, h4sh is a set of unix wrappers to the list library.
I still use them everyday, though probably should put out a new release
soon.

-- Don


tphyahoo:
 To answer my original question, here's a few ways to accomplish what I
 wanted with haskell
 
 Perl is still a lot faster than ghc -e, but I guess if you wanted
 speed you could compile first.
 
 
 
 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ls -l
 total 16
 -rw-r--r-- 1 thartman thartman 2726 Dec 20 07:56 UnixTools.hs
 -rw-r--r-- 1 thartman thartman   82 Jan  7 07:18 echo.hs
 -rwxr--r-- 1 thartman thartman  790 Mar  4 05:02 oneliners.sh
 -rwxr--r-- 1 thartman thartman  646 Mar  4 04:18 oneliners.sh~
 
 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ./oneliners.sh
 haskell, ghc -e pipe
 16
 
 real0m1.652s
 user0m0.600s
 sys 0m0.030s
 **
 haskell, hmap pipe
 16
 
 real0m1.549s
 user0m0.410s
 sys 0m0.200s
 **
 haskell, two pipes
 16
 
 real0m2.153s
 user0m0.900s
 sys 0m0.370s
 **
 perl, two pipes
 16
 
 real0m0.185s
 user0m0.010s
 sys 0m0.100s
 
 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$
 
 
 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ cat oneliners.sh
 hmap (){ ghc -e interact ($*);  }
 hmapl (){ hmap  unlines.($*).lines ; }
 hmapw (){ hmapl map (unwords.($*).words) ; }
 
 function filesizes () {
  find -maxdepth 1 -type f | xargs du
 }
 
 echo haskell, ghc -e pipe
 time filesizes | ghc -e 'interact $ (++\n) . show . sum . map ( (
 read :: String - Integer ) . head . words ) . lines '
 echo **
 
 echo haskell, hmap pipe
 time filesizes | hmap '(++\n) . show . sum . map ( ( read :: String
 - Integer ) . head . words ) . lines'
 echo **
 
 echo haskell, two pipes
 time filesizes | hmapl map ( head . words ) | hmap '(++\n) . show
 . sum . map ( read :: String - Integer ) . lines'
 echo **
 
 echo perl, two pipes
 time filesizes | perl -ane 'print $F[0]\n' | perl -e '$sum += $_
 while ; print $sum\n'
 
 
 2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
 Okay, I am aware of
 
 http://haskell.org/haskellwiki/Simple_unix_tools
 
 which gives some implementation of simple unix utilities in haskell.
 
 But I couldn't figure out how to use them directly from the shell, and
 of course that's what most readers will probably wnat.
 
 Or let me put it another way.
 
 Is there a way to do
 
   find -maxdepth 1 -type f | xargs du | perl -ane 'print \$F[0]\n' |
 perl -e '$sum += $_ while ; print $sum\n'
 
 as a shell command that idiomatically uses haskell?
 
 For non-perlers, that sums up the disk usage of all files in the
 current directory, skipping subdirs.
 
 print \$F[0]\n
 
 looks at the first (space delimited) collumn of output.
 
 perl -e '$sum += $_ while ; print $sum\n'
 
 , which is I guess the meat of the program, sums up all the numbers
 spewed out of the first column, so in the end you get a total.
 
 So, anyone out there want to establish a haskell one liner tradition?
 
 :)
 
 thomas.
 
 ___
 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: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Thomas Hartman

That seems like a really great thing to have. But I had troubles installing it.

h4sh depends on hs-plugins.

And...

[EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$ ./Setup.lhs configure
Setup.lhs: Warning: The field hs-source-dir is deprecated, please
use hs-source-dirs.
Configuring plugins-1.0...
configure: /usr/local/bin/ghc-pkg
configure: Dependency base-any: using base-2.0
configure: Dependency Cabal-any: using Cabal-1.1.6
Setup.lhs: cannot satisfy dependency haskell-src-any
[EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$

Advice?

2007/3/4, Donald Bruce Stewart [EMAIL PROTECTED]:

There's some nice one liners bundled with h4sh:

http://www.cse.unsw.edu.au/~dons/h4sh.html

For example:

http://www.cse.unsw.edu.au/~dons/h4sh.txt

If you recall, h4sh is a set of unix wrappers to the list library.
I still use them everyday, though probably should put out a new release
soon.

-- Don


tphyahoo:
 To answer my original question, here's a few ways to accomplish what I
 wanted with haskell

 Perl is still a lot faster than ghc -e, but I guess if you wanted
 speed you could compile first.

 

 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ls -l
 total 16
 -rw-r--r-- 1 thartman thartman 2726 Dec 20 07:56 UnixTools.hs
 -rw-r--r-- 1 thartman thartman   82 Jan  7 07:18 echo.hs
 -rwxr--r-- 1 thartman thartman  790 Mar  4 05:02 oneliners.sh
 -rwxr--r-- 1 thartman thartman  646 Mar  4 04:18 oneliners.sh~

 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ./oneliners.sh
 haskell, ghc -e pipe
 16

 real0m1.652s
 user0m0.600s
 sys 0m0.030s
 **
 haskell, hmap pipe
 16

 real0m1.549s
 user0m0.410s
 sys 0m0.200s
 **
 haskell, two pipes
 16

 real0m2.153s
 user0m0.900s
 sys 0m0.370s
 **
 perl, two pipes
 16

 real0m0.185s
 user0m0.010s
 sys 0m0.100s

 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$


 [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ cat oneliners.sh
 hmap (){ ghc -e interact ($*);  }
 hmapl (){ hmap  unlines.($*).lines ; }
 hmapw (){ hmapl map (unwords.($*).words) ; }

 function filesizes () {
  find -maxdepth 1 -type f | xargs du
 }

 echo haskell, ghc -e pipe
 time filesizes | ghc -e 'interact $ (++\n) . show . sum . map ( (
 read :: String - Integer ) . head . words ) . lines '
 echo **

 echo haskell, hmap pipe
 time filesizes | hmap '(++\n) . show . sum . map ( ( read :: String
 - Integer ) . head . words ) . lines'
 echo **

 echo haskell, two pipes
 time filesizes | hmapl map ( head . words ) | hmap '(++\n) . show
 . sum . map ( read :: String - Integer ) . lines'
 echo **

 echo perl, two pipes
 time filesizes | perl -ane 'print $F[0]\n' | perl -e '$sum += $_
 while ; print $sum\n'


 2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
 Okay, I am aware of
 
 http://haskell.org/haskellwiki/Simple_unix_tools
 
 which gives some implementation of simple unix utilities in haskell.
 
 But I couldn't figure out how to use them directly from the shell, and
 of course that's what most readers will probably wnat.
 
 Or let me put it another way.
 
 Is there a way to do
 
   find -maxdepth 1 -type f | xargs du | perl -ane 'print \$F[0]\n' |
 perl -e '$sum += $_ while ; print $sum\n'
 
 as a shell command that idiomatically uses haskell?
 
 For non-perlers, that sums up the disk usage of all files in the
 current directory, skipping subdirs.
 
 print \$F[0]\n
 
 looks at the first (space delimited) collumn of output.
 
 perl -e '$sum += $_ while ; print $sum\n'
 
 , which is I guess the meat of the program, sums up all the numbers
 spewed out of the first column, so in the end you get a total.
 
 So, anyone out there want to establish a haskell one liner tradition?
 
 :)
 
 thomas.
 
 ___
 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: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Donald Bruce Stewart
Yes, it definitely is a little lagged. It should be ported to use lazy
bytestrings too. I wsa more suggesting the one liners as examples of
haskell use in the shell.

tphyahoo:
 That seems like a really great thing to have. But I had troubles installing 
 it.
 
 h4sh depends on hs-plugins.
 
 And...
 
 [EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$ ./Setup.lhs configure
 Setup.lhs: Warning: The field hs-source-dir is deprecated, please
 use hs-source-dirs.
 Configuring plugins-1.0...
 configure: /usr/local/bin/ghc-pkg
 configure: Dependency base-any: using base-2.0
 configure: Dependency Cabal-any: using Cabal-1.1.6
 Setup.lhs: cannot satisfy dependency haskell-src-any
 [EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$
 
 Advice?
 
 2007/3/4, Donald Bruce Stewart [EMAIL PROTECTED]:
 There's some nice one liners bundled with h4sh:
 
 http://www.cse.unsw.edu.au/~dons/h4sh.html
 
 For example:
 
 http://www.cse.unsw.edu.au/~dons/h4sh.txt
 
 If you recall, h4sh is a set of unix wrappers to the list library.
 I still use them everyday, though probably should put out a new release
 soon.
 
 -- Don
 
 
 tphyahoo:
  To answer my original question, here's a few ways to accomplish what I
  wanted with haskell
 
  Perl is still a lot faster than ghc -e, but I guess if you wanted
  speed you could compile first.
 
  
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ls -l
  total 16
  -rw-r--r-- 1 thartman thartman 2726 Dec 20 07:56 UnixTools.hs
  -rw-r--r-- 1 thartman thartman   82 Jan  7 07:18 echo.hs
  -rwxr--r-- 1 thartman thartman  790 Mar  4 05:02 oneliners.sh
  -rwxr--r-- 1 thartman thartman  646 Mar  4 04:18 oneliners.sh~
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ./oneliners.sh
  haskell, ghc -e pipe
  16
 
  real0m1.652s
  user0m0.600s
  sys 0m0.030s
  **
  haskell, hmap pipe
  16
 
  real0m1.549s
  user0m0.410s
  sys 0m0.200s
  **
  haskell, two pipes
  16
 
  real0m2.153s
  user0m0.900s
  sys 0m0.370s
  **
  perl, two pipes
  16
 
  real0m0.185s
  user0m0.010s
  sys 0m0.100s
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$
 
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ cat oneliners.sh
  hmap (){ ghc -e interact ($*);  }
  hmapl (){ hmap  unlines.($*).lines ; }
  hmapw (){ hmapl map (unwords.($*).words) ; }
 
  function filesizes () {
   find -maxdepth 1 -type f | xargs du
  }
 
  echo haskell, ghc -e pipe
  time filesizes | ghc -e 'interact $ (++\n) . show . sum . map ( (
  read :: String - Integer ) . head . words ) . lines '
  echo **
 
  echo haskell, hmap pipe
  time filesizes | hmap '(++\n) . show . sum . map ( ( read :: String
  - Integer ) . head . words ) . lines'
  echo **
 
  echo haskell, two pipes
  time filesizes | hmapl map ( head . words ) | hmap '(++\n) . show
  . sum . map ( read :: String - Integer ) . lines'
  echo **
 
  echo perl, two pipes
  time filesizes | perl -ane 'print $F[0]\n' | perl -e '$sum += $_
  while ; print $sum\n'
 
 
  2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
  Okay, I am aware of
  
  http://haskell.org/haskellwiki/Simple_unix_tools
  
  which gives some implementation of simple unix utilities in haskell.
  
  But I couldn't figure out how to use them directly from the shell, and
  of course that's what most readers will probably wnat.
  
  Or let me put it another way.
  
  Is there a way to do
  
find -maxdepth 1 -type f | xargs du | perl -ane 'print \$F[0]\n' |
  perl -e '$sum += $_ while ; print $sum\n'
  
  as a shell command that idiomatically uses haskell?
  
  For non-perlers, that sums up the disk usage of all files in the
  current directory, skipping subdirs.
  
  print \$F[0]\n
  
  looks at the first (space delimited) collumn of output.
  
  perl -e '$sum += $_ while ; print $sum\n'
  
  , which is I guess the meat of the program, sums up all the numbers
  spewed out of the first column, so in the end you get a total.
  
  So, anyone out there want to establish a haskell one liner tradition?
  
  :)
  
  thomas.
  
  ___
  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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Thomas Hartman

I think I could have most of the oneliner goodness of h4sh, without
having to do the module install, if I could figure out a way to
include modules with ghc -e.

or, alternatively some way to specify modules as a ghc flag, analogous to

perl -MPath::To::Module -e 'commands'

Can this be made to work?

(From http://haskell.org/haskellwiki/Simple_unix_tools, which seems to
be repeated somehow in h4sh, although I'm not completely certain on
that.)

***

[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ echo 1234 | ghc
-e 'interact id'
1234
[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ echo 1234 | ghc
-e 'UnixTools.cat'

interactive:1:0:
  Bad interface file: UnixTools.hi
  UnixTools.hi: openBinaryFile: does not exist (No such file or directory)


[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ head -n23 UnixTools.hs
module UnixTools where
--
-- Some unix-like tools written in simple, clean Haskell
--
--

import Data.List
import Data.Char
import System.IO
import Text.Printf
.
-- The 'cat' program
--
cat = interact id

2007/3/4, Donald Bruce Stewart [EMAIL PROTECTED]:

Yes, it definitely is a little lagged. It should be ported to use lazy
bytestrings too. I wsa more suggesting the one liners as examples of
haskell use in the shell.

tphyahoo:
 That seems like a really great thing to have. But I had troubles installing
 it.

 h4sh depends on hs-plugins.

 And...
 
 [EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$ ./Setup.lhs configure
 Setup.lhs: Warning: The field hs-source-dir is deprecated, please
 use hs-source-dirs.
 Configuring plugins-1.0...
 configure: /usr/local/bin/ghc-pkg
 configure: Dependency base-any: using base-2.0
 configure: Dependency Cabal-any: using Cabal-1.1.6
 Setup.lhs: cannot satisfy dependency haskell-src-any
 [EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$
 
 Advice?

 2007/3/4, Donald Bruce Stewart [EMAIL PROTECTED]:
 There's some nice one liners bundled with h4sh:
 
 http://www.cse.unsw.edu.au/~dons/h4sh.html
 
 For example:
 
 http://www.cse.unsw.edu.au/~dons/h4sh.txt
 
 If you recall, h4sh is a set of unix wrappers to the list library.
 I still use them everyday, though probably should put out a new release
 soon.
 
 -- Don
 
 
 tphyahoo:
  To answer my original question, here's a few ways to accomplish what I
  wanted with haskell
 
  Perl is still a lot faster than ghc -e, but I guess if you wanted
  speed you could compile first.
 
  
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ls -l
  total 16
  -rw-r--r-- 1 thartman thartman 2726 Dec 20 07:56 UnixTools.hs
  -rw-r--r-- 1 thartman thartman   82 Jan  7 07:18 echo.hs
  -rwxr--r-- 1 thartman thartman  790 Mar  4 05:02 oneliners.sh
  -rwxr--r-- 1 thartman thartman  646 Mar  4 04:18 oneliners.sh~
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ./oneliners.sh
  haskell, ghc -e pipe
  16
 
  real0m1.652s
  user0m0.600s
  sys 0m0.030s
  **
  haskell, hmap pipe
  16
 
  real0m1.549s
  user0m0.410s
  sys 0m0.200s
  **
  haskell, two pipes
  16
 
  real0m2.153s
  user0m0.900s
  sys 0m0.370s
  **
  perl, two pipes
  16
 
  real0m0.185s
  user0m0.010s
  sys 0m0.100s
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$
 
 
  [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ cat oneliners.sh
  hmap (){ ghc -e interact ($*);  }
  hmapl (){ hmap  unlines.($*).lines ; }
  hmapw (){ hmapl map (unwords.($*).words) ; }
 
  function filesizes () {
   find -maxdepth 1 -type f | xargs du
  }
 
  echo haskell, ghc -e pipe
  time filesizes | ghc -e 'interact $ (++\n) . show . sum . map ( (
  read :: String - Integer ) . head . words ) . lines '
  echo **
 
  echo haskell, hmap pipe
  time filesizes | hmap '(++\n) . show . sum . map ( ( read :: String
  - Integer ) . head . words ) . lines'
  echo **
 
  echo haskell, two pipes
  time filesizes | hmapl map ( head . words ) | hmap '(++\n) . show
  . sum . map ( read :: String - Integer ) . lines'
  echo **
 
  echo perl, two pipes
  time filesizes | perl -ane 'print $F[0]\n' | perl -e '$sum += $_
  while ; print $sum\n'
 
 
  2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
  Okay, I am aware of
  
  http://haskell.org/haskellwiki/Simple_unix_tools
  
  which gives some implementation of simple unix utilities in haskell.
  
  But I couldn't figure out how to use them directly from the shell, and
  of course that's what most readers will probably wnat.
  
  Or let me put it another way.
  
  Is there a way to do
  
find -maxdepth 1 -type f | xargs du | perl -ane 'print \$F[0]\n' |
  perl -e '$sum += $_ while ; print $sum\n'
  
  as a shell command that idiomatically uses haskell?
  
  For non-perlers, that sums up the disk usage of all files in the
  current directory, skipping subdirs.
  
  print \$F[0]\n
  
  looks at the first (space delimited) 

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Brandon S. Allbery KF8NH


On Mar 4, 2007, at 6:31 , Thomas Hartman wrote:


Setup.lhs: cannot satisfy dependency haskell-src-any


Used to be bundled, now unbundled.  On debian/ubuntu check your  
libghc6-*-dev packages.  (libghc6-haskell-src-dev?)


--
brandon s. allbery[linux,solaris,freebsd,perl] [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] MPTCs and rigid variables

2007-03-04 Thread Iavor Diatchki

Hello,

There is nothing wrong with this program.   I have run into this
problem and I consider it to be a bug/weakness of the type checking
algorithm used by the implementation.

(I also agree with you that the term rigid variable is rather
confusing because it is an artifact of the type checking algorithm
used by GHC.)

-Iavor

On 3/3/07, David House [EMAIL PROTECTED] wrote:

class Foo a b | a - b
instance Foo Int String
bar :: Foo Int b = b
bar = rargh

Is there any reason why that shouldn't work? GHC gives one of its
silly b is a rigid variable errors (aside: that's a really confusing
error; I'd prefer something like Hugs's Infered type is not general
enough).

--
-David House, [EMAIL PROTECTED]
___
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] auto-completion for Vim 7

2007-03-04 Thread Stephan Walter

Hi,

I started to write a Vim script for the new omni-completion feature of
Vim 7. If you use Vim you might want to check it out:

* download http://stephan.walter.name/files/haskellcomplete.vim and
put it in ~/.vim/plugin
* :set omnifunc=haskellcomplete#CompleteHaskell
* press c-xc-o to complete

(The advantage of omni-completion over normal completion using c-n
and c-p is that you can write you own function which does some smart
guessing to offer good completions)

So far the functionality is *very* limited. It will autocomplete a few
functions from the prelude as well as functions in the current file
that have a type declaration.

If you look through the source code of the script, you'll see that I
have included some function names and types from the standard
libraries. Before I continue this (rather tedious) work, I wanted to
know what the cafe patrons think about it.

If someone knows of a simple way to generate a function/type list of
the standard modules, I'd love to hear about it. Generating such a
list on the fly each time is probably not an option, as it would be
too slow.

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


Re: [Haskell-cafe] auto-completion for Vim 7

2007-03-04 Thread Neil Mitchell

Hi


If someone knows of a simple way to generate a function/type list of
the standard modules, I'd love to hear about it. Generating such a
list on the fly each time is probably not an option, as it would be
too slow.


Using a recent version of haddock, the --hoogle flag gives you exactly
what you want.

Thanks

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


Re: [Haskell-cafe] wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Yitzchak Gale

Thomas Hartman wrote:

Is there a way to do


perl one-liner gibberish


as a shell command that idiomatically uses haskell?


I used to do those in Perl, too, years ago.

I switched to the readable step-by-step style of the
Python shell when I moved from Perl to Python.
It is a whole different mentality about how to work,
but in the end it is equally powerful and beautiful.

Now that I am a Haskell person, I find that the Python
style is a perfect fit for Haskell shells such as GHCi.
The :def command in GHCi makes this really
powerful (though I find that I rarely need that much
power).

You can kind of fake the one-liner style in Python,
but it is awkward. I assume that the same would
be true in Haskell (though I admit that I never
tried it very seriously). Unless you define all kinds
of single-character abbreviations, in which case
why not just use Perl?

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


[Haskell-cafe] Re: auto-completion for Vim 7

2007-03-04 Thread Stephan Walter
Hi Neil,

Neil Mitchell wrote:
 Using a recent version of haddock, the --hoogle flag gives you exactly
 what you want.

I tried that but I guess I was too impatient to figure out what exactly
haddock wants (it seemed to choke on #ifdefs), so I just used the
hoogle.txt from darcs and ran it through sed.

Now the vim script is 190kb big, but it seems to work more or less.
Maybe I'll have to remove some entries that nobody uses anyway, like
System.Win32.*  ;-)

-Stephan

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


Re: [Haskell-cafe] Re: auto-completion for Vim 7

2007-03-04 Thread Neil Mitchell

Hi


I tried that but I guess I was too impatient to figure out what exactly
haddock wants (it seemed to choke on #ifdefs), so I just used the
hoogle.txt from darcs and ran it through sed.


Haddock can't cope with #ifdef's, or .lhs files - haddock-ghc will be
able to (the next version), so hopefully soon you'll have less of a
problem. I just use runhaskell Setup haddocck --hoogle through Cabal,
and that handles preprocessing etc.

Of course, taking hoogle.txt gives you the same result (thats how I
got hoogle.txt) and less work :)

Thanks

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


Re: [Haskell-cafe] Re: auto-completion for Vim 7

2007-03-04 Thread Stefan O'Rear
On Sun, Mar 04, 2007 at 07:58:59PM +, Neil Mitchell wrote:
 Hi
 
 I tried that but I guess I was too impatient to figure out what exactly
 haddock wants (it seemed to choke on #ifdefs), so I just used the
 hoogle.txt from darcs and ran it through sed.
 
 Haddock can't cope with #ifdef's, or .lhs files - haddock-ghc will be
 able to (the next version), so hopefully soon you'll have less of a
 problem. I just use runhaskell Setup haddocck --hoogle through Cabal,
 and that handles preprocessing etc.
 
 Of course, taking hoogle.txt gives you the same result (thats how I
 got hoogle.txt) and less work :)

Is haddock-ghc still the next version?  It wouldn't even compile
without minor modifications (it seems to be incompatible with the
current version of cabal); and when I tried to run it:

[EMAIL PROTECTED]:/tmp/HAppS_0$ haddock-ghc --html 
--dump-interface=dist/doc/html/HAppS.haddock 
--prologue=HAppS-0.9.0-haddock-prolog.txt --use-package=HaXml-1.13.2 
--use-package=mtl-1.0  --use-package=network-2.0 --use-package=stm-2.0 
--use-package=template-haskell-2.0 --use-package=regex-compat-0.71 
--use-package=binary-0.2 --use-package=HList-0.1  --title=HAppS-0.9.0:  
--odir=dist/doc/html  `find dist/build/tmp/src/HAppS -name '*.hs'`
Warning: Cannot use package base:
   HTML directory /usr/local/share/ghc-6.7.20070223/html/libraries/base does 
not exist.

haddock-ghc: panic! (the 'impossible' happened)
  (GHC version 6.7.20070223 for i386-unknown-linux):
a static opt was looked at too early!

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

(Is it still worth reporting if it is the GHC API?)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] auto-completion for Vim 7

2007-03-04 Thread Claus Reinke

If someone knows of a simple way to generate a function/type list of
the standard modules, I'd love to hear about it. Generating such a
list on the fly each time is probably not an option, as it would be
too slow.


Using a recent version of haddock, the --hoogle flag gives you exactly
what you want.


Neil: is there any documentation on the output format? i couldn't find the 
flag in the haddock manual, so i was surprised to see it in haddock --help;
it works, though, and does seem to generate modules with implementations 
removed, and some declarations simplified?


one problem with this is that hoogle.txt is not included with releases, nor 
are the library sources, so this route won't be available for most ghc users. 

that is why my Doc.vim, announced earlier today, extracts information 
somewhat tediously from the haddock html index files that are included 
at least with windows releases.


Stephan: if your goal is intelligent, context-aware completion, that's quite
ambituous for Haskell!-) you might want to reuse the more simple-minded
completion and information extraction included in Doc.vim as a start, so that
you can focus on the more interesting context-sensitive bits. the current 
version of Doc.vim allows to write out the docindex, once extracted from 
the haddocks, and with simple reading it back in rather than re-generation, 
completion seems reasonably quick.


Doc.vim supports CTRL-X CTRL-U insert-mode completion by looking
for matching prefixes in the docindex, including all unqualified names in the
libraries. one can also separately qualify names.

if you want (naive) completion based on text in imported files as well, you 
can tell Vim's standard insert-mode completion (CTRL-N) to follow imports,

by using 'set include= ' and 'set includeexpr= '. there's an example in the
by now ancient hugs.vim at http://www.cs.kent.ac.uk/~cr3/toolbox/haskell/Vim/

to provide completion also for non-libraries identifiers, perhaps completion
based on tags-files (as generated by :ctags in ghci), via CTRL-X CTRL-] ,
might be a good approach. those tags-file don't include type info yet, but
then i'm not quite sure how you'd be able to use type info for completion
in Vim (which doesn't know anything about Haskell types).

   ghc -e :ctags Main.hs

ought to give you a tags file, including exported identifiers in your project,
but not in the libraries.

with these three completion variants, one can get by, though putting everything
together and adding at least some context-sensitivity would be nice.

the haddock --hoogle route has the additional issue that it will miss 
identifiers
without type declarations. you could use ghc itself to provide identifier lists:

   $ ghc -e :b Data.Char
   digitToInt :: Char - Int
   data Char
   type String = [Char]
   chr :: Int - Char
   ..

with the obvious disadvantage that you'd need to name every module. but
you could get those from 'ghc-pkg describe base'.

anyway, let us know about any progress with such Haskell/Vim utilities.
claus

ps. i'm still rehacktoring Doc.vim, adding and removing bugs and features,
   but don't want to bother the list with updated versions. a recent one,
   including functions for writing/reading docindex, can be found here:
   http://www.cs.kent.ac.uk/~cr3/toolbox/haskell/Vim/Doc.vim

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


Re: [Haskell-cafe] auto-completion for Vim 7

2007-03-04 Thread Neil Mitchell

Hi Claus,


Neil: is there any documentation on the output format? i couldn't find the
flag in the haddock manual, so i was surprised to see it in haddock --help;
it works, though, and does seem to generate modules with implementations
removed, and some declarations simplified?


Documentation isn't my strong point :) It was originally only intended
to be an internal thing for Hoogle, but it does seem generally useful.
Perhaps changing it to --summary, documenting it, and more formally
specifying the output format (along with an AST/printer/parser) would
be a good plan.


one problem with this is that hoogle.txt is not included with releases, nor
are the library sources, so this route won't be available for most ghc users.
that is why my Doc.vim, announced earlier today, extracts information
somewhat tediously from the haddock html index files that are included
at least with windows releases.


You can always download hoogle.txt, or perhaps we could supply
summary.txt with the HTML output as the documentation? The GHC people
would have to be the ones to decide it - Hugs doesn't ship with
documentation anyway.

My experience with parsing haddock generated HTML is that its painful,
and usually wrong. The indexes might be a bit clearer, but parsing out
the type signatures and names was a nightmare.


the haddock --hoogle route has the additional issue that it will miss 
identifiers
without type declarations. you could use ghc itself to provide identifier lists:


ghc-haddock will fix that. Extracting names from the index will also
miss those without type signatures.


$ ghc -e :b Data.Char
digitToInt :: Char - Int
data Char
type String = [Char]
chr :: Int - Char


I experimented with this as the means for getting information for
Hoogle. It was fine, apart from extracting instances (you needed the
instance and the type both to be in scope, which you can't really do,
or the instance is missed).  The only tip I'd give is make sure you
specify -fglasgow-exts, I remember some issue if that was missed with
functions that were using # in their name - no idea on the exact issue
but that flag fixed it.

Thanks

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


[Haskell-cafe] Safe top-level IORefs

2007-03-04 Thread Roberto Zunino
I'm posting the code of a module, IORefs, allowing top-level IORefs to
be safely declared and used. Usafety reports are welcome. Tested in GHC 6.6.

** Features:

1) IORef a provided for any Typeable a
2) An unbounded number of IORef's can be declared
3) An IORef declaration is 3 lines long (+ optional type signature)
4) Each IORef has its own starting value
5) Referential transparency:
   no NOINLINE, no unsafePerformIO is needed in the user module
6) Negligible overhead: O(1) in the usual usage pattern
   (neglecting a O(log n) setup phase)

** Usage:

import Data.Typeable
import Data.IORef
import IORefs

data X deriving Typeable  -- the actual name of the IORef
instance IORefDefault X Int where ioRefDefault _ = 42 -- type+default
x = ioRef (undefined :: X) -- a convenient name for the IORef

x :: IORef Int -- optional signature

-- Still the same IORef as x !
y :: IORef Int
y = ioRef (undefined :: X)

main = do
   let printX = readIORef x = print
   printX -- 42
   writeIORef x 3
   printX -- 3
   modifyIORef x succ
   printX -- 4
   modifyIORef y succ  -- y is equal to x, so...
   printX -- 5
   -- ... the above is actually equivalent to
   modifyIORef (ioRef (undefined :: X) :: IORef Int) succ
   printX -- 6

Passing a non _|_ value to ioRef does not break the abstraction: ioRef
ignores this value. Similarly, ioRef always calls ioRefDefault with _|_,
so writing (ioRef (X1 :: X)) and (ioRef (X2 :: X)) will not cause the
initial value to be ill-defined, i.e. depending on which expression is
evaluated first.

On performance: ioRef takes O(log n) to return, where n is the number of
refs previous created by ioRef. In the common usage pattern, ioRef is
used only in a top-level definition. If no inlining happens, we pay only
a startup cost: then all IORefs are available in O(1). If inlining
happens, or if we use ioRef as in the last lines of main above, we pay
the log(n) price. Note that inlining only affects the performance, and
not the semantics.

Assumptions/known glitches:

1) We rely on cast from Typeable
2) GHCi is known not to reinitialize the refs on reload.
3) No multithreading support for now.
4) The IORefs module uses a memoization technique, relying on a
classic top-level IORef declared through NOINLINE + unsafePerformIO.

Regards,
Zun.

===
{-# OPTIONS_GHC -Wall -fglasgow-exts #-}
module IORefs (ioRef, IORefDefault, ioRefDefault) where

import qualified Data.Map as M
import System.IO.Unsafe
import Data.IORef
import Data.Typeable

class (Typeable a, Typeable b) = IORefDefault a b | a - b where
ioRefDefault :: a - b

data Ref = forall a . Typeable a = Ref (IORef a)
type RefMap = M.Map TypeRep Ref

{-# NOINLINE refs #-} -- This is crucial
refs :: IORef RefMap
refs = unsafePerformIO $ newIORef M.empty

-- This is like a memoized function, so inlining this should be safe.
-- (Needs locking for multithread, though.)
ioRef :: forall a b . IORefDefault a b = a - IORef b
ioRef x = unsafePerformIO $
   do
   rs - readIORef refs
   case typeOf x `M.lookup` rs of
  Nothing - do
 ref - newIORef $ ioRefDefault (undefined :: a)
 writeIORef refs $ M.insert (typeOf x) (Ref ref) rs
 return ref
  Just (Ref aRef) - case cast aRef of
 Nothing  - error $ ioRef: impossible!
 Just ref - return ref

-- Should be in Data.Typeable
instance Ord TypeRep where compare x y = compare (show x) (show y)


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


Re: [Haskell-cafe] Safe top-level IORefs

2007-03-04 Thread Roberto Zunino
Neil Mitchell wrote:
 Hi
 
 On 3/4/07, Roberto Zunino [EMAIL PROTECTED] wrote:
 I'm posting the code of a module, IORefs, allowing top-level IORefs to
 be safely declared and used. Usafety reports are welcome. Tested in
 GHC 6.6.
 
 That looks cool, does it work on Hugs?

I've tested it right now.

Yes, it works with -98, but you have to provide a (correct!) instance of
Typeable X on your own.

Declaring a ref becomes a bit more cumbersome:

data X  -- the actual name of the IORef
instance Typeable X where typeOf _ = mkTyConApp (mkTyCon Main.X) []
instance IORefDefault X Int where ioRefDefault _ = 42  -- initial value
x = ioRef (undefined :: X) -- a convenient name for the IORef

It would be better to use drift to write the instance for you, since
getting that wrong breaks Typeable, and ioRef roo.

Finally, IORefs.ioRef must be changed to use asTypeOf.

Zun.


-- Hugs  GHC version
ioRef :: IORefDefault a b = a - IORef b
ioRef x = unsafePerformIO $
   do
   rs - readIORef refs
   case typeOf x `M.lookup` rs of
  Nothing - do
 ref - newIORef $ ioRefDefault (undefined `asTypeOf` x)
 writeIORef refs $ M.insert (typeOf x) (Ref ref) rs
 return ref
  Just (Ref aRef) - case cast aRef of
 Nothing  - error $ ioRef: impossible!
 Just ref - return ref

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


[Haskell-cafe] Any interested authors?

2007-03-04 Thread Antonio Cangiano

Dave Thomas (from The Pragmatic Programmers, not from Wendy's :)) has
announced an Erlang book
(http://www.pragmaticprogrammer.com/titles/jaerlang/) in the Ruby
mailing list.
A few responses showed an interest in a similar book for Haskell. You
can see the thread here: http://tinyurl.com/2ecpsn.

Dave answered such requests by saying: I'd love to do one. It's a
question of finding the right author..

If you think this would be up your alley, perhaps you could contact
Dave in regards to this matter.

Just a heads up, from a potential reader. :)

Regards,
Antonio
--
http://antoniocangiano.com
Zen and the Art of Ruby Programming
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-04 Thread Feustel dfeustel
 The Makefile in the HSH distribution should do this for you.  But you
 can say:
 
 ghc --make -o setup -package Cabal Setup.lhs

A40:/home/daf/Hsh/hsh}ghc --make -o setup -package Cabal Setu.lhs
ghc-6.2.2: unknown package name: Cabal

I'm working on getting ghc 6.6 built and installed.
Gmake Currently exits on these errors:

== gmake all -r;
 in /home/daf/Ghc/ghc-6.6/compiler


== gmake all -r;
 in /home/daf/Ghc/ghc-6.6/rts

../compiler/ghc-inplace -optc-O -optc-L/usr/local/lib -optc-Wall -optc-W 
-optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations 
-optc-Winline -optc-Waggregate-return -optc-Wbad-function-cast 
-optc-I../includes -optc-I. -optc-Iparallel -optc-DCOMPILING_RTS 
-optc-fomit-frame-pointer -optc-fno-strict-aliasing -H16m -O -L/usr/local/lib 
-optc-O2 -static -I. -#include HCIncludes.h -optc-fno-stack-protector -fvia-C 
-dcmm-lint -c Linker.c -o Linker.o
Linker.c: In function `addDLL':
Linker.c:1026: warning: assignment discards qualifiers from pointer target type
Linker.c: In function `loadObj':
Linker.c:1350: error: `MAP_32BIT' undeclared (first use in this function)
Linker.c:1350: error: (Each undeclared identifier is reported only once
Linker.c:1350: error: for each function it appears in.)
Linker.c: In function `x86_64_high_symbol':
Linker.c:2789: error: `MAP_32BIT' undeclared (first use in this function)
Linker.c:2789: error: `MAP_ANONYMOUS' undeclared (first use in this function)
gmake[1]: *** [Linker.o] Error 1
gmake: *** [stage1] Error 1
A40:/home/daf/Ghc/ghc-6.6}  

I'm not quite sure what to do with MAP_32BIT since I'm running in
AMD 64-bit mode. Any suggestions?



 ./setup configure
 ./setup build
 (as root) ./setup install
 
 
 On 2007-03-03, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  I just tried to make HSH 1.2 but it needs Cabal, which I
  apparently don't have installed. I also don't have
  runghc installed (referenced at cabal homepage). Using
  ghc instead failed as follows:
 
 
  Setup.lhs:2:
  Failed to load interface for `Distribution.Simple':
  *** Deleting temp files
  Deleting: /home/daf/Tmp/ghc27809.hc /home/daf/Tmp/ghc27809.lpp
  Warning: deleting non-existent /home/daf/Tmp/ghc27809.hc
  A40:/home/daf/Hsh/hsh}ghc Setup.lhs configure
 
  Setup.lhs:2:
  Failed to load interface for `Distribution.Simple':
  A40:/home/daf/Hsh/hsh}  
 
  This suggests to me that my Haskell setup is not complete.
 
  What do I need to do to get to the point where I can build HSH?
 
  Thanks.
 
 
 -- 
 John Goerzen
 Author, Foundations of Python Network Programming
 http://www.amazon.com/exec/obidos/tg/detail/-/1590593715
 
 ___
 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: wanted: haskell one-liners (in the perl senseof one-liners)

2007-03-04 Thread Claus Reinke
I think I could have most of the oneliner goodness of h4sh, without having to do 
the module install, if I could figure out a way to include modules with ghc -e.


i confess myself to be among those who underappreciated ghc -e, until this 
thread:)

as Joachim said (thanks for starting this, btw;-), we can use qualified names

   $ echo hello world | hmap 'map Char.toUpper'
   HELLO WORLD

and to get at your other methods, the question is not how to include modules
with ghc -e; instead, recall that ghc -e supplies a command to be evaluated
within the context of its parameter module (single input for a ghci session):

   $ cat Imports.hs
   import Debug.Trace
   helper x = trace hi there (x+1)

   $ ghc -e 'helper 41' Imports.hs
   hi there
   42

as to the original question in this thread, my .bashrc now also has a few less
symmetric entries:

  function hrunl { ghc -e interact(show.($*).lines);  }
  function hrunw { ghc -e interact(show.($*).words);  }
  function hrunwl { ghc -e interact(show.($*).map words.lines);  }

using which the one-liner becomes something like

   find -maxdepth 1 -type f | xargs du | hrunwl sum . map (read . head)

(the find/du is better left in shell tool land, it seems, and default Num is 
Integer)

hth,
claus

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


[Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-04 Thread John Goerzen
On 2007-03-04, [EMAIL PROTECTED], Feustel dfeustel@mindspring.com [EMAIL 
PROTECTED] wrote:
 The Makefile in the HSH distribution should do this for you.  But you
 can say:
 
 ghc --make -o setup -package Cabal Setup.lhs

 A40:/home/daf/Hsh/hsh}ghc --make -o setup -package Cabal Setu.lhs
 ghc-6.2.2: unknown package name: Cabal

Ahh.  You will certainly need GHC 6.6 for HSH; see the list of
prerequisites in the README or at
http://software.complete.org/hsh/wiki/RelatedSoftware

 gmake[1]: *** [Linker.o] Error 1
 gmake: *** [stage1] Error 1
 A40:/home/daf/Ghc/ghc-6.6}  

 I'm not quite sure what to do with MAP_32BIT since I'm running in
 AMD 64-bit mode. Any suggestions?

This is out of my league to answer, but if you tell us about your
platform, I bet we can find you some precompiled binaries for it.

-- John

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


[Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-04 Thread Dave Feustel
 On 2007-03-04, [EMAIL PROTECTED], Feustel dfeustel@mindspring.com [EMAIL 
 PROTECTED] wrote:
  The Makefile in the HSH distribution should do this for you.  But you
  can say:
  
  ghc --make -o setup -package Cabal Setup.lhs
 
  A40:/home/daf/Hsh/hsh}ghc --make -o setup -package Cabal Setu.lhs
  ghc-6.2.2: unknown package name: Cabal
 
 Ahh.  You will certainly need GHC 6.6 for HSH; see the list of
 prerequisites in the README or at
 http://software.complete.org/hsh/wiki/RelatedSoftware
 
  gmake[1]: *** [Linker.o] Error 1
  gmake: *** [stage1] Error 1
  A40:/home/daf/Ghc/ghc-6.6}  
 
  I'm not quite sure what to do with MAP_32BIT since I'm running in
  AMD 64-bit mode. Any suggestions?
 
 This is out of my league to answer, but if you tell us about your
 platform, I bet we can find you some precompiled binaries for it.
 
 -- John

I'm running AMD 64-bit OpenBSD 4.0. There is a downlevel package for ghc.

I think I have found the cause of the undefined MAP_ANONYMOUS. It
looks like that symbol was changed to MAP_ANON in sys/mmap.h for
OpenBSD. I fixed(?) that and now the MAP_32BIT symbol is the current
roadblock. As far as I can tell, this symbol is not defined anywhere
in OpenBSD at the moment. I've done some googling but I still don't
know what to do with this symbol.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-04 Thread Dave Feustel
  On 2007-03-04, [EMAIL PROTECTED], Feustel dfeustel@mindspring.com 
  [EMAIL PROTECTED] wrote:
   The Makefile in the HSH distribution should do this for you.  But you
   can say:
   
   ghc --make -o setup -package Cabal Setup.lhs
  
   A40:/home/daf/Hsh/hsh}ghc --make -o setup -package Cabal Setu.lhs
   ghc-6.2.2: unknown package name: Cabal
  
  Ahh.  You will certainly need GHC 6.6 for HSH; see the list of
  prerequisites in the README or at
  http://software.complete.org/hsh/wiki/RelatedSoftware
  
   gmake[1]: *** [Linker.o] Error 1
   gmake: *** [stage1] Error 1
   A40:/home/daf/Ghc/ghc-6.6}  
  
   I'm not quite sure what to do with MAP_32BIT since I'm running in
   AMD 64-bit mode. Any suggestions?
  
  This is out of my league to answer, but if you tell us about your
  platform, I bet we can find you some precompiled binaries for it.
  
  -- John
 
 I'm running AMD 64-bit OpenBSD 4.0. There is a downlevel package for ghc.
 
 I think I have found the cause of the undefined MAP_ANONYMOUS. It
 looks like that symbol was changed to MAP_ANON in sys/mmap.h for
 OpenBSD. I fixed(?) that and now the MAP_32BIT symbol is the current
 roadblock. As far as I can tell, this symbol is not defined anywhere
 in OpenBSD at the moment. I've done some googling but I still don't
 know what to do with this symbol.

Since there seems to be no MAP_32BIT in OpenBSD, I set the symbol to
0 and gmake got through Linker.c. Gmake now is running toward completion
of the make. I have my fingers crossed :-).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-04 Thread Donald Bruce Stewart
dfeustel:
   On 2007-03-04, [EMAIL PROTECTED], Feustel dfeustel@mindspring.com 
   [EMAIL PROTECTED] wrote:
The Makefile in the HSH distribution should do this for you.  But you
can say:

ghc --make -o setup -package Cabal Setup.lhs
   
A40:/home/daf/Hsh/hsh}ghc --make -o setup -package Cabal Setu.lhs
ghc-6.2.2: unknown package name: Cabal
   
   Ahh.  You will certainly need GHC 6.6 for HSH; see the list of
   prerequisites in the README or at
   http://software.complete.org/hsh/wiki/RelatedSoftware
   
gmake[1]: *** [Linker.o] Error 1
gmake: *** [stage1] Error 1
A40:/home/daf/Ghc/ghc-6.6}  
   
I'm not quite sure what to do with MAP_32BIT since I'm running in
AMD 64-bit mode. Any suggestions?
   
   This is out of my league to answer, but if you tell us about your
   platform, I bet we can find you some precompiled binaries for it.
   
   -- John
  
  I'm running AMD 64-bit OpenBSD 4.0. There is a downlevel package for ghc.
  
  I think I have found the cause of the undefined MAP_ANONYMOUS. It
  looks like that symbol was changed to MAP_ANON in sys/mmap.h for
  OpenBSD. I fixed(?) that and now the MAP_32BIT symbol is the current
  roadblock. As far as I can tell, this symbol is not defined anywhere
  in OpenBSD at the moment. I've done some googling but I still don't
  know what to do with this symbol.
 
 Since there seems to be no MAP_32BIT in OpenBSD, I set the symbol to
 0 and gmake got through Linker.c. Gmake now is running toward completion
 of the make. I have my fingers crossed :-).

Yes, I'm thinking the build system shouldn't even include Linker.c if
you're not attempting to build ghci. 

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


Re: [Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-04 Thread Stefan O'Rear
On Mon, Mar 05, 2007 at 01:37:20AM +, Dave Feustel wrote:
  I think I have found the cause of the undefined MAP_ANONYMOUS. It
  looks like that symbol was changed to MAP_ANON in sys/mmap.h for
  OpenBSD. I fixed(?) that and now the MAP_32BIT symbol is the current
  roadblock. As far as I can tell, this symbol is not defined anywhere
  in OpenBSD at the moment. I've done some googling but I still don't
  know what to do with this symbol.
 
 Since there seems to be no MAP_32BIT in OpenBSD, I set the symbol to
 0 and gmake got through Linker.c. Gmake now is running toward completion
 of the make. I have my fingers crossed :-).

According to my (Linux) mmap(2), MAP_32BIT says to only allocate
addresses that can be cast to 32bits losslessly.  Of course, there's
no guarantee that NOT specifying it will result in addresses that are
truncated, so if you're unlucky this could introduce a latent bug.  As
in nothing happens for months, then one day ghc uses a lot of ram, and
POP! sigsegv, by which time you've completely forgotten about the
kluge you used to compile it, and you won't be able to figure out what
broke.  Check your man 2 mmap for the appropriate define ... 

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


Re: Re: [Haskell-cafe] Build failed - hidden package ?

2007-03-04 Thread Dunric
Yes, that did the trick.

Thank You.

-Puvodni zprava-
Od: J. Garrett Morris [mailto:[EMAIL PROTECTED]
Komu: Dunric [EMAIL PROTECTED]
Předmět: Re: [Haskell-cafe] Build failed - hidden package ?


Hello,

Are you building with Cabal?  In case you are, Cabal hides all
packages by default and only shows those which are mentioned in your
cabal file.  To fix this, you can add 'base' to the build-depends:
list.

If you're not using Cabal, I don't have a clue.  (-;

Good luck!

/g

On 2/26/07, Dunric [EMAIL PROTECTED] wrote:
 Hi.
 I've got stuck with the following compilation error I probably can't fully 
 understand:

 --
 Building library...
 ...
 Using package config file: /usr/local/lib/ghc-6.6/package.conf
 wired-in package base mapped to base-2.0
 wired-in package rts mapped to rts-1.0
 wired-in package haskell98 mapped to haskell98-1.0
 wired-in package template-haskell mapped to template-haskell-2.0
 Hsc static flags: -static
 ...
 Graphics/UI/SDL/Rotozoomer.hs:15:7:
 Could not find module `Foreign.C':
   it is a member of package base, which is hidden

 --

 What does such error mean ?

 Modules Foreign and Foreign.C are installed and available from the default 
 path.
 Lines 12-15 of Rotozoomer.hs:
 --
 module Graphics.UI.SDL.Rotozoomer where

 import Foreign
 import Foreign.C
 --

 Any idea what's wrong, resp. some explanation why compilation fails ?

 Thanks in an advance.

 --

 www.icqsms.cz

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



--
It is myself I have never met, whose face is pasted on the underside of my 
mind.
--

www.icqsms.cz

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


[Haskell-cafe] Haskell 6.6 problem

2007-03-04 Thread Dave Feustel
make and make install of ghc 6.6 completed successfully,
but exe generated by ghc fails to load.

===test.hs===
main :: IO()
main =  putStr This is a test\n
=

ghc test.hs 
compilation IS NOT required
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status

Is there a simple way to fix this?

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


Re: [Haskell-cafe] Haskell 6.6 problem

2007-03-04 Thread Brandon S. Allbery KF8NH


On Mar 5, 2007, at 1:22 , Dave Feustel wrote:


ghc test.hs
compilation IS NOT required
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status

Is there a simple way to fix this?


You failed to mention the platform you're on, but at a guess you are  
missing the libgmp and/or libgmp-dev(el) package(s) for your platform.


--
brandon s. allbery[linux,solaris,freebsd,perl] [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] Haskell 6.6 problem

2007-03-04 Thread Donald Bruce Stewart
dfeustel:
 make and make install of ghc 6.6 completed successfully,
 but exe generated by ghc fails to load.
 
 ===test.hs===
 main :: IO()
 main =putStr This is a test\n
 =
 
 ghc test.hs 
 compilation IS NOT required
 /usr/bin/ld: cannot find -lgmp
 collect2: ld returned 1 exit status
 
 Is there a simple way to fix this?
 

that's a missing argument to ld to tell it to look in /usr/local for
openbsd libs. 

Edit:
~/lib/ghc-6.6/package.conf

under wherever you installed ghc 6.6.  and add:

-L/usr/local/lib

to this ldOptions field. So it looks like this:

..., ldOptions = [-L/usr/local/lib,-u,base_GHCziBase_Izh_static_info, 
...

that should ensure libgmp if always found by the linker.

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


[Haskell-cafe] Haskell Weekly News: March 05, 2007

2007-03-04 Thread Donald Bruce Stewart
---
Haskell Weekly News
http://sequence.complete.org/hwn/20070305
Issue 58 - March 05, 2007
---

   Welcome to issue 58 of HWN, a weekly newsletter covering developments
   in the [1]Haskell community.

   1. http://haskell.org/

Announcements

   New Book - Programming in Haskell. Graham Hutton [2]announced a new
   Haskell textbook: [3]Programming in Haskell. This introduction is
   ideal for beginner programmers: it requires no previous programming
   experience and all concepts are explained from first principles via
   carefully chosen examples. Each chapter includes exercises that range
   from the straightforward to extended projects, plus suggestions for
   further reading on more advanced topics. The presentation is clear and
   simple, and benefits from having been refined and class-tested over
   several years.

   2. http://article.gmane.org/gmane.comp.lang.haskell.general/14849
   3. http://www.cs.nott.ac.uk/~gmh/book.html

   Gtk2Hs version 0.9.11. Duncan Coutts [4]announced Gtk2Hs - a GUI
   Library for Haskell based on Gtk+, version 0.9.11, is [5]now
   available. Gtk2Hs features: automatic memory management; Unicode
   support; nearly full coverage of Gtk+ 2.8 API; support for several
   additional Gtk+/Gnome modules (Glade visual GUI builder, cairo vector
   graphics, SVG rendering, OpenGL extension and more).

   4. http://article.gmane.org/gmane.comp.lang.haskell.general/14934
   5. http://haskell.org/gtk2hs/download/

   cabal-make version 0.1. Conal Elliott [6]announced Cabal-make, a GNU
   make include file to be used with Cabal in creating and sharing
   Haskell packages. A few highlights: web-based, cross-package links in
   Haddock docs; syntax coloring via hscolour, with per-project CSS;
   links from the Haddock docs to hscolour'd code and to wiki-based user
   comment pages. [7]It is available here.

   6. http://article.gmane.org/gmane.comp.lang.haskell.general/14891
   7. http://haskell.org/haskellwiki/Cabal-make

   Vty 3.0.0. Stefan O'Rear [8]announced a new major of [9]vty, featuring
   improved performance. vty is notably used in yi to provide a terminal
   interface supporting syntax highlighting.

   8. http://article.gmane.org/gmane.comp.lang.haskell.general/14876
   9. http://members.cox.net/stefanor/vty/dist/doc/html/index.html

   Haskell Xcode Plugin. Lyndon Tremblay [10]announced the first release
   of [11]a plugin for Xcode enabling Haskell syntax highlighting, Xcode
   projects compiling and linking, and a couple missing features, for
   Haskell (GHC).

  10. http://article.gmane.org/gmane.comp.lang.haskell.general/14875
  11. http://www.hoovy.org/HaskellXcodePlugin/

   urlcheck 0.1: parallel link checker. Don Stewart [12]announced the
   first release of [13]urlcheck, an parallel link checker, written in
   Haskell. Frustrated with the resources and time consumed by
   'linkchecker', urlcheck is a lightweight, smp-capable replacement in
   Haskell. urlcheck pings urls found in the input file, checking they
   aren't 404s. It uses Haskell threads to run queries concurrently, and
   can transparently utilise multiple cores if you have them.

  12. http://article.gmane.org/gmane.comp.lang.haskell.general/14863
  13. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/urlcheck-0.1

   The Monad.Reader: call for copy. Wouter Swierstra [14]welcomed
   articles for the next issue of The Monad.Reader. Submit articles for
   the next issue by e-mail before April 13th, 2007. Articles should be
   written according to the guidelines available from [15]The Monad
   Reader home.
   
  14. http://article.gmane.org/gmane.comp.lang.haskell.general/14870
  15. http://www.haskell.org/haskellwiki/TheMonadReader

   TV-0.2 and GuiTV-0.2. Conal Elliott [16]announced TV, a library for
   composing tangible values ('TVs'), values that carry along external
   interfaces. In particular, TVs can be composed to create new TVs, and
   they can be directly executed with various kinds of interfaces. Values
   and interfaces are combined for direct use, and separable for
   composition. GuiTV adds graphical user interfaces to the TV (tangible
   value) framework, using Phooey. The functionality was part of TV up to
   version 0.1.1, and is now moved out to a new package to eliminate the
   dependency of core TV on Phooey and hence on wxHaskell, as the latter
   can be difficult to install.

  16. http://article.gmane.org/gmane.comp.lang.haskell.general/14862

   Haskell-mode 2.2. Stefan Monnier [17]released version 2.2 of [18]the
   Haskell-mode package for Emacs. It has very few visible changes,
   mostly some commands to query an underlying interactive hugs/ghci in
   order to get type/info about specific identifiers.

  17. http://article.gmane.org/gmane.comp.lang.haskell.general/14857
  18. http://www.iro.umontreal.ca/~monnier/elisp/