RE: GHC Core question

2008-01-07 Thread Simon Peyton-Jones
If you use -dppr-debug GHC will show you the unique number of each identifier, 
and that'll show you that the two $dMonads are distinct even though they have 
the same print-name.  CoreTidy makes the print-name unique too.

Perhaps the Core printer should be a bit keener to print unique numbers, but it 
adds a lot of clutter.

Simon

| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
| Neil Mitchell
| Sent: 05 January 2008 20:01
| To: GHC Users
| Subject: GHC Core question
|
| Hi
|
| I've compiled the Debug.Trace module to Core, but can't understand the
| resulting output. The original code is:
|
| trace string expr = unsafePerformIO $ do
| putTraceMsg string
| return expr
|
| The core is:
|
| Debug.Trace.trace =
|\ (@ a) -
|  __letrec {
|trace :: GHC.Base.String - a - a
|[]
|trace =
|  \ (string :: GHC.Base.String) (expr :: a) -
|GHC.Base.$
|  @ (GHC.IOBase.IO a)
|  @ a
|  (GHC.IOBase.unsafePerformIO @ a)
|  ( @ () @ a (Debug.Trace.putTraceMsg string) (return @ a expr));
|$dMonad :: GHC.Base.Monad GHC.IOBase.IO
|[]
|$dMonad = $dMonad;
|return :: forall a. a - GHC.IOBase.IO a
|[]
|return = GHC.Base.return @ GHC.IOBase.IO $dMonad;
|$dMonad :: GHC.Base.Monad GHC.IOBase.IO
|[]
|$dMonad = GHC.IOBase.$f16;
| :: forall a b.
|  GHC.IOBase.IO a - GHC.IOBase.IO b - GHC.IOBase.IO b
|[]
| = GHC.Base. @ GHC.IOBase.IO $dMonad;
|  } in  trace;
|
| And my Haskell reformatting of that is:
|
| Debug.Trace.trace = let
|trace string expr = unsafePerformIO $ putTraceMsg string  return expr
|$dMonad = $dMonad;
|return = GHC.Base.return $dMonad;
|$dMonad = GHC.IOBase.$f16;
| = GHC.Base. $dMonad;
| in  trace
|
| However, that let expression has two bindings for $dMonad, one of
| which looks like a black-hole. Are the semantics of __letrec different
| from let in some way?
|
| Thanks
|
| Neil
| ___
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: binary-dists for ghc-6.8.2

2008-01-07 Thread Christian Maeder
Ian Lynagh wrote:
 On Fri, Jan 04, 2008 at 06:03:50PM +0100, Christian Maeder wrote:
 Christian Maeder wrote:
 http://www.dfki.de/sks/hets/mac/versions/ghc-6.8.2-powerpc-apple-darwin.tar.bz2
 http://www.dfki.de/sks/hets/intel-mac/versions/ghc-6.8.2-i386-apple-darwin.tar.bz2
 Ian, could you replace the dists on the download page?
 
 Done; I assume that these dists include the new hsc2hs-bin from
 http://www.haskell.org/pipermail/glasgow-haskell-users/2008-January/013998.html
 ?

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


RE: Rank-2 polymorphism and pattern matching

2008-01-07 Thread Simon Peyton-Jones
Jim

| My reason for wanting pattern matching on values of polymorphic types
| is a kind of first-level refinement types. I'm going to demonstrate
| using the risers function, as presented in Dana N. Xu's ESC/Haskell, which
| references Neil Mitchell's Catch.

I didn't follow all the details, but I think your main idea is to use the fact 
that [] is the only value of type (forall a. [a]), and similarly for other 
polymorphic values, and use that to reason that certain branches are 
inaccessible.

Sadly, it's not true in Haskell, is it?
(error urk) : []
also has type (forall a. [a]).

I don't know how to fix this, short of making the constructors strict.

Another less-than-satisfying aspect is that Nil has a real value argument 
(usually () I guess) which is there only to speak to the type system.  It's 
nicer if static properties have static witnesses, and involve no runtime 
activity.

You have a type (NonEmpty (NonEmpty a)). If you expand that out, I think you 
get a
forall n1. List (forall n2. List a n2) n1
So you're instantiating the element type of the outer list with a polytype, 
which requires impredicativity too, not just existentials!

All that said, I never thought of using existentials this way. Ingenious.

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


Re: wish for more-usable bindist

2008-01-07 Thread Simon Marlow

Isaac Dupree wrote:
the i386 linux ghc bindist still uses readline 4 
http://haskell.org/ghc/download_ghc_682.html, which is hard to get:
readline 5.0 came out almost three and a half years ago 
ftp://ftp.cwru.edu/pub/bash/


And I don't want to pollute my Ubuntu system with compatibility RPMs; 
in fact I intend to install the bindist as my local user so I don't 
pollute it with extra GHCs either, except I can't.  Could there be a 
bindist with modern readline, or perhaps is it possible to statically 
link with readline?


The i386 machine I use here for building the bindists is running a rather 
old version of RedHat.  I do intend to upgrade it at some point, but it's 
entirely possible for someone else to build a bindist too.


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


Re: [Fwd: Re: Problem building hdbc-sqlite3 with ghc 6.8.2]

2008-01-07 Thread Christian Maeder
Hi Emmanuel,

sqlite3 must be installed on your mac, i.e. a file libsqlite3.dylib.
(I don't have it, too.) If it is say under /opt/local/lib you may need
to pass -optl-L/opt/local/lib to ghc's command line (or set
LD_LIBRARY_PATH)

HTH Christian

manu wrote:
 Macintosh:blog_old_with_sqlite3 manu$ ghc --make newArticle.hs -o
 new_article.c
 gi
 [3 of 3] Compiling Main ( newArticle.hs, newArticle.o )
 Linking new_article.cgi ...
 ld: atom sorting error for
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziTypes_CSqlite3_closure_tbl
  and
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziTypes_CStmt_closure_tbl in
 /usr/local/lib/HDBC-sqlite3-1.1.3.0/ghc-6.8.2/libHSHDBC-sqlite3-1.1.3.0.a(Types.o)
 
 ld: atom sorting error for
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziTypes_CSqlite3_closure_tbl
  and
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziTypes_CStmt_closure_tbl in
 /usr/local/lib/HDBC-sqlite3-1.1.3.0/ghc-6.8.2/libHSHDBC-sqlite3-1.1.3.0.a(Types.o)
 
 Undefined symbols:
   _sqlite3_errmsg, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziUtils_zdwccall_info in
 libHSHDBC-sqlite3-1.1.3.0.a(Utils.o)
   _sqlite3_bind_null, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall11_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_bind_text, referenced from:
   _sqlite3_bind_text2 in
 libHSHDBC-sqlite3-1.1.3.0.a(hdbc-sqlite3-helper.o)
   _sqlite3_column_name, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall6_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_total_changes, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall13_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_close, referenced from:
   _sqlite3_close_app in
 libHSHDBC-sqlite3-1.1.3.0.a(hdbc-sqlite3-helper.o)
   _sqlite3_column_text, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall8_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_column_type, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall7_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_libversion, referenced from:
   _r6xt_info in libHSHDBC-sqlite3-1.1.3.0.a(Connection.o)
   _sqlite3_finalize, referenced from:
   _sqlite3_prepare2 in
 libHSHDBC-sqlite3-1.1.3.0.a(hdbc-sqlite3-helper.o)
   _sqlite3_finalize_app in
 libHSHDBC-sqlite3-1.1.3.0.a(hdbc-sqlite3-helper.o)
   _sqlite3_changes, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall12_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_open, referenced from:
   _sqlite3_open2 in libHSHDBC-sqlite3-1.1.3.0.a(hdbc-sqlite3-helper.o)
   _sqlite3_bind_parameter_count, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall2_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_step, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall3_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_busy_timeout, referenced from:
   _sqlite3_busy_timeout2 in
 libHSHDBC-sqlite3-1.1.3.0.a(hdbc-sqlite3-helper.o)
   _sqlite3_column_count, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall5_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_reset, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall4_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_column_bytes, referenced from:
  
 _HDBCzmsqlite3zm1zi1zi3zi0_DatabaseziHDBCziSqlite3ziStatement_zdwccall9_info 
 in
 libHSHDBC-sqlite3-1.1.3.0.a(Statement.o)
   _sqlite3_prepare, referenced from:
   _sqlite3_prepare2 in
 libHSHDBC-sqlite3-1.1.3.0.a(hdbc-sqlite3-helper.o)
 ld: symbol(s) not found
 collect2: ld returned 1 exit status
 
 
 
 
 On Jan 4, 2008, at 6:13 PM, Christian Maeder wrote:
 
 Please post the full ld error message
 (also to glasgow-haskell-users@haskell.org)

 C.

 manu wrote:
 Hi Christian

 yes it did

 but, when i tried to compile one of my cgi script where I happen to use
 HDBC.Sqlite3
 it fails with similar 'ld' errors...

 so I can compile HDBC-Sqlite3, but not programs that use the package...

 Thanks

 Emmanuel


 On Jan 4, 2008, at 11:21 AM, Christian Maeder wrote:

 Did a final runhaskell Setup.lhs install work for you, Emmanuel?


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


can't build plugins-1.0 with ghc-6.9

2008-01-07 Thread Valery V. Vorotyntsev
Hi,

(The message below contains bunch of preformatted sections.
I hope it's still readable, otherwise, please, let me know.)

My quest is to install lambdabot (for the sake of offline [EMAIL PROTECTED]'
and [EMAIL PROTECTED]' commands), and the one depends on `plugins'.

1) plugins.cabal should be updated
--

A patch to .cabal file[1] is needed to get rid of config-time
warning[2] and resolve build-time errors[3].

  [1]
  vvv:~/src/plugins-1.0$ diff -u plugins.cabal{.orig,}
  --- plugins.cabal.orig  2008-01-06 22:23:44.657177486 +0200
  +++ plugins.cabal   2008-01-06 22:25:45.160728537 +0200
  @@ -33,6 +33,6 @@
   src/Language/Hi/hschooks.c
   includes: Linker.h
   extensions:   CPP, ForeignFunctionInterface
  -Build-Depends:base, Cabal, haskell-src
  +Build-Depends:base, Cabal, haskell-src, array, containers,
directory, random, process
   ghc-options:  -Wall -O -fasm -funbox-strict-fields
-fno-warn-missing-signatures
  -hs-source-dir: src
  +hs-source-dirs: src

  [2]
  vvv:~/src/plugins-1.0$ runhaskell Setup configure --prefix=$HOME --user
  Warning: The field hs-source-dir is deprecated, please use hs-source-dirs
  Configuring plugins-1.0...
  [...]

  [3]
  vvv:~/src/plugins-1.0$ runhaskell Setup build
  Preprocessing library plugins-1.0...
  Building plugins-1.0...

  src/Language/Hi/Binary.hs:90:7:
  Could not find module `Data.Array.Base':
it is a member of package array-0.1, which is hidden

2) it doesn't build with Cabal-1.3.2


`InstalledPackageInfo' is a type alias in GHC's Cabal[4], not a data
constructor; `plugins' library[5] gets confused[6].

  [4]
  vvv:~/src$ diff -u
cabal-1.2.2.0/Distribution/InstalledPackageInfo.hs
ghc/libraries/Cabal/Distribution/InstalledPackageInfo.hs
  --- cabal-1.2.2.0/Distribution/InstalledPackageInfo.hs  2007-11-01
17:02:35.0 +0200
  +++ ghc/libraries/Cabal/Distribution/InstalledPackageInfo.hs
2007-12-17 17:53:21.691532864 +0200
  @@ -46,7 +46,7 @@
   -- This module is meant to be local-only to Distribution...

   module Distribution.InstalledPackageInfo (
  -   InstalledPackageInfo(..),
  +   InstalledPackageInfo_(..), InstalledPackageInfo,
  ParseResult(..), PError(..), PWarning,
  emptyInstalledPackageInfo,
  parseInstalledPackageInfo,
  @@ -72,8 +72,8 @@
   -- 
-
   -- The InstalledPackageInfo type

  -data InstalledPackageInfo
  -   = InstalledPackageInfo {
  +data InstalledPackageInfo_ m
  +   = InstalledPackageInfo_ {
  -- these parts are exactly the same as PackageDescription
  package   :: PackageIdentifier,
   license   :: License,
  @@ -87,8 +87,8 @@
  category  :: String,
  -- these parts are required by an installed package only:
   exposed   :: Bool,
  -   exposedModules:: [String],
  -   hiddenModules :: [String],
  +   exposedModules:: [m],
  +   hiddenModules :: [m],
   importDirs:: [FilePath],  -- contain sources in case of Hugs
   libraryDirs   :: [FilePath],
   hsLibraries   :: [String],
  @@ -107,9 +107,11 @@
   }
   deriving (Read, Show)

  -emptyInstalledPackageInfo :: InstalledPackageInfo
  +type InstalledPackageInfo = InstalledPackageInfo_ String
  +
  +emptyInstalledPackageInfo :: InstalledPackageInfo_ m
   emptyInstalledPackageInfo
  -   = InstalledPackageInfo {
  +   = InstalledPackageInfo_ {
   package   = PackageIdentifier  noVersion,
   license   = AllRightsReserved,
   copyright = ,

  [5]
  vvv:~/src/plugins-1.0$ sed -n 64,66p src/System/Plugins/PackageAPI.hs
  updImportDirs f pk@(InstalledPackageInfo { importDirs = idirs }) =
  pk { importDirs = f idirs }
  updLibraryDirs f pk@(InstalledPackageInfo { libraryDirs = ldirs }) =

  [6]
  vvv:~/src/plugins-1.0$ runhaskell Setup build
  Preprocessing library plugins-1.0...
  Building plugins-1.0...
  [ 1 of 24] Compiling System.Plugins.Process (
src/System/Plugins/Process.hs, dist/build/System/Plugins/Process.o )
  [ 2 of 24] Compiling System.Plugins.Parser (
src/System/Plugins/Parser.hs, dist/build/System/Plugins/Parser.o )
  [ 3 of 24] Compiling System.Plugins.ParsePkgConfCabal (
src/System/Plugins/ParsePkgConfCabal.hs,
dist/build/System/Plugins/ParsePkgConfCabal.o )
  [ 4 of 24] Compiling System.Plugins.PackageAPI (
src/System/Plugins/PackageAPI.hs,
dist/build/System/Plugins/PackageAPI.o )

  src/System/Plugins/PackageAPI.hs:64:20:
  Not in scope: data constructor `InstalledPackageInfo'

  src/System/Plugins/PackageAPI.hs:66:21:
  Not in scope: data constructor `InstalledPackageInfo'

I would like to hear your suggestions.

Should I try harder[7] installing Cabal-1.2.2.0?
Or is this a bug of GHC's Cabal? In this 

Re: Rank-2 polymorphism and pattern matching

2008-01-07 Thread Jim Apple
On Jan 7, 2008 1:37 AM, Simon Peyton-Jones [EMAIL PROTECTED] wrote:
 Sadly, it's not true in Haskell, is it?
 (error urk) : []
 also has type (forall a. [a]).

It is a bit sad, but I think that's The Curse of The _|_, which
infects any attempt to add static assurance.

 It's nicer if static properties have static witnesses, and involve no runtime 
 activity.

Maybe The Curse doesn't infect everything. What methods of assuring
static properties in GHC have static witnesses?

I think no: GADTs, lightweight static capabilities, forall a . [a]
trick, nested/non-regular types
I think yes: associated types, class constraints

 You have a type (NonEmpty (NonEmpty a)). If you expand that out, I think you 
 get a
 forall n1. List (forall n2. List a n2) n1
 So you're instantiating the element type of the outer list with a polytype, 
 which requires impredicativity too, not just existentials!

It's true, but that seems to work without a hiccup right now

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


Re: wish for more-usable bindist

2008-01-07 Thread Christian Maeder
You may try my version built on:

[EMAIL PROTECTED]:~ uname -a
Linux denebola 2.6.18.8-0.7-bigsmp #1 SMP Tue Oct 2 17:21:08 UTC 2007
i686 i686 i386 GNU/Linux

using: gcc version 4.1.2 20061115 (prerelease) (SUSE Linux)

http://www.dfki.de/sks/hets/linux/versions/ghc-6.8.2-i386-unknown-linux.tar.bz2

ldd output:
linux-gate.so.1 =  (0xe000)
libreadline.so.5 = /lib/libreadline.so.5 (0xb7e91000)
libncurses.so.5 = /lib/libncurses.so.5 (0xb7e4a000)
libutil.so.1 = /lib/libutil.so.1 (0xb7e46000)
libdl.so.2 = /lib/libdl.so.2 (0xb7e42000)
libm.so.6 = /lib/libm.so.6 (0xb7e1b000)
libgmp.so.3 = /usr/lib/libgmp.so.3 (0xb7de5000)
librt.so.1 = /lib/librt.so.1 (0xb7ddc000)
libpthread.so.0 = /lib/libpthread.so.0 (0xb7dc5000)
libc.so.6 = /lib/libc.so.6 (0xb7c97000)
/lib/ld-linux.so.2 (0xb7eef000)

HTH Christian

Simon Marlow wrote:
 Isaac Dupree wrote:
 the i386 linux ghc bindist still uses readline 4
 http://haskell.org/ghc/download_ghc_682.html, which is hard to get:
 readline 5.0 came out almost three and a half years ago
 ftp://ftp.cwru.edu/pub/bash/

 And I don't want to pollute my Ubuntu system with compatibility
 RPMs; in fact I intend to install the bindist as my local user so I
 don't pollute it with extra GHCs either, except I can't.  Could there
 be a bindist with modern readline, or perhaps is it possible to
 statically link with readline?
 
 The i386 machine I use here for building the bindists is running a
 rather old version of RedHat.  I do intend to upgrade it at some point,
 but it's entirely possible for someone else to build a bindist too.
 
 Cheers,
 Simon
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: wish for more-usable bindist

2008-01-07 Thread Christian Maeder
Simon Marlow wrote:
 The i386 machine I use here for building the bindists is running a
 rather old version of RedHat.  I do intend to upgrade it at some point,
 but it's entirely possible for someone else to build a bindist too.

I wonder why (all) the (various) buildbots do not produce (tested) bindists.

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

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


reifying is-a relation

2008-01-07 Thread Jorge Marques Pelizzoni

Hi, all! I guess what I am about to ask is currently impossible, but as
you haskellers always manage to amaze me and there is plenty of new
features in GHC I am not familiar with here it goes. Given two type
classes A t and B t, I'd like to derive different A t instances
depending exactly on whether t is an instance of B. In other words, is it
possible to define a class (actually a type-level function) IsB t f such
that:

IsB t HTrue = (B t) exists
IsB t HFalse = otherwise?

If not, is this wish intrisically pointless?

Thanks in advance. Cheers,

Jorge M. Pelizzoni
ICMC - Universidade de São Paulo

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


Re: GHC Core question

2008-01-07 Thread Neil Mitchell
Hi

 How are you printing out the Core?

showSDoc $ ppr c

where c :: [CoreBind]

 It looks like the unique ids are
 missing (you can see them if you pass the -ppr-debug flag, which can
 be set using the API)

I have now set the -ppr-debug flag, but that has no effect. It's not
entirely surprising, as I guess setting the flag only applies through
the GHC session, and this code is being run outside that. How can I
print the output (to a file) using the unique id's?

 Simon Peyton-Jones says:
 CoreTidy makes the print-name unique too.

Can I invoke CoreTidy using the GHC API?

Thanks

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


readline on macs

2008-01-07 Thread Christian Maeder
Judah Jacobson wrote:
 On Jan 5, 2008 10:29 AM, Thorkil Naur [EMAIL PROTECTED] wrote:
 On Friday 04 January 2008 12:03, Christian Maeder wrote:

 I understand that there are problems in this area, but I am not convinced 
 that
 they could not be solved without the renamed and/or modified readline
 library. I am sorry if you have done that already elsewhere, but I don't
 recall having seen any details about your difficulties. Would you be kind
 enough to supply some details? Thanks a lot.

I'm against a further (renamed or modified) readline library (and I've
done nothing in that direction).

 The alternative is to use static linking of gmp (as suggested by chak)
 _and_ readline (version 5), so that user programs are also statically
 linked with these libs.

I just have succeeded in linking ghc-6.8.2 statically with libreadline.a
and libncurses.a in the compiler directory by setting:

SRC_HC_OPTS += -optl-Xlinker -optl-search_paths_first

in mk/build.mk.

This option prevents linking against the wrong dynamic library
/usr/lib/libreadline.dylib.

 Again, I am not convinced that this is the only alternative.

I don't see an advantage of a renamed or modified readline library
(it'll be even more version confusion).

 There is another alternative (which I think we talked about before):

yes in http://hackage.haskell.org/trac/ghc/ticket/1798

 Have ghc manually search for frameworks in the standard folders
 (rather than letting gcc do it automatically).  Then if we found e.g.
 /Library/Frameworks/GNUreadline.framework, we would pass the following
 flag:
 -I/Library/Frameworks/GNUreadline.framework/Versions/A/Headers

It's not even necessary to specify a version. Enough is:

 -I/Library/Frameworks/GNUreadline.framework/Headers

or in $HOME:

 -I$HOME/Library/Frameworks/GNUreadline.framework/Headers

 In that case, we would not need modified readline headers.

This way I wanted to go before (saving some -F trouble for some -I
trouble), but proper mac frameworks should also have proper mac
framework headers.

 However, I really don't like the above, since we're reimplenting
 something gcc gives us for free.  And if we *do* rely on gcc's
 standard searching (as is the case now), then I agree with Christian
 that modified headers are necessary for GNUreadline to work as a
 framework.

yes.

[...]

With static linking the whole framework issue may become obsolete.

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


Re: can't build plugins-1.0 with ghc-6.9

2008-01-07 Thread Don Stewart
Please start with the hs-plugins repo on code.haskell.org, since it's
already updated for ghc 6.8,

http://code.haskell.org/~dons/code/hs-plugins/

valery.vv:
 Hi,
 
 (The message below contains bunch of preformatted sections.
 I hope it's still readable, otherwise, please, let me know.)
 
 My quest is to install lambdabot (for the sake of offline [EMAIL PROTECTED]'
 and [EMAIL PROTECTED]' commands), and the one depends on `plugins'.
 
 1) plugins.cabal should be updated
 --
 
 A patch to .cabal file[1] is needed to get rid of config-time
 warning[2] and resolve build-time errors[3].
 
   [1]
   vvv:~/src/plugins-1.0$ diff -u plugins.cabal{.orig,}
   --- plugins.cabal.orig  2008-01-06 22:23:44.657177486 +0200
   +++ plugins.cabal   2008-01-06 22:25:45.160728537 +0200
   @@ -33,6 +33,6 @@
src/Language/Hi/hschooks.c
includes: Linker.h
extensions:   CPP, ForeignFunctionInterface
   -Build-Depends:base, Cabal, haskell-src
   +Build-Depends:base, Cabal, haskell-src, array, containers,
 directory, random, process
ghc-options:  -Wall -O -fasm -funbox-strict-fields
 -fno-warn-missing-signatures
   -hs-source-dir: src
   +hs-source-dirs: src
 
   [2]
   vvv:~/src/plugins-1.0$ runhaskell Setup configure --prefix=$HOME --user
   Warning: The field hs-source-dir is deprecated, please use 
 hs-source-dirs
   Configuring plugins-1.0...
   [...]
 
   [3]
   vvv:~/src/plugins-1.0$ runhaskell Setup build
   Preprocessing library plugins-1.0...
   Building plugins-1.0...
 
   src/Language/Hi/Binary.hs:90:7:
   Could not find module `Data.Array.Base':
 it is a member of package array-0.1, which is hidden
 
 2) it doesn't build with Cabal-1.3.2
 
 
 `InstalledPackageInfo' is a type alias in GHC's Cabal[4], not a data
 constructor; `plugins' library[5] gets confused[6].
 
   [4]
   vvv:~/src$ diff -u
 cabal-1.2.2.0/Distribution/InstalledPackageInfo.hs
 ghc/libraries/Cabal/Distribution/InstalledPackageInfo.hs
   --- cabal-1.2.2.0/Distribution/InstalledPackageInfo.hs  2007-11-01
 17:02:35.0 +0200
   +++ ghc/libraries/Cabal/Distribution/InstalledPackageInfo.hs
 2007-12-17 17:53:21.691532864 +0200
   @@ -46,7 +46,7 @@
-- This module is meant to be local-only to Distribution...
 
module Distribution.InstalledPackageInfo (
   -   InstalledPackageInfo(..),
   +   InstalledPackageInfo_(..), InstalledPackageInfo,
   ParseResult(..), PError(..), PWarning,
   emptyInstalledPackageInfo,
   parseInstalledPackageInfo,
   @@ -72,8 +72,8 @@
-- 
 -
-- The InstalledPackageInfo type
 
   -data InstalledPackageInfo
   -   = InstalledPackageInfo {
   +data InstalledPackageInfo_ m
   +   = InstalledPackageInfo_ {
   -- these parts are exactly the same as PackageDescription
   package   :: PackageIdentifier,
license   :: License,
   @@ -87,8 +87,8 @@
   category  :: String,
   -- these parts are required by an installed package only:
exposed   :: Bool,
   -   exposedModules:: [String],
   -   hiddenModules :: [String],
   +   exposedModules:: [m],
   +   hiddenModules :: [m],
importDirs:: [FilePath],  -- contain sources in case of 
 Hugs
libraryDirs   :: [FilePath],
hsLibraries   :: [String],
   @@ -107,9 +107,11 @@
}
deriving (Read, Show)
 
   -emptyInstalledPackageInfo :: InstalledPackageInfo
   +type InstalledPackageInfo = InstalledPackageInfo_ String
   +
   +emptyInstalledPackageInfo :: InstalledPackageInfo_ m
emptyInstalledPackageInfo
   -   = InstalledPackageInfo {
   +   = InstalledPackageInfo_ {
package   = PackageIdentifier  noVersion,
license   = AllRightsReserved,
copyright = ,
 
   [5]
   vvv:~/src/plugins-1.0$ sed -n 64,66p src/System/Plugins/PackageAPI.hs
   updImportDirs f pk@(InstalledPackageInfo { importDirs = idirs }) =
   pk { importDirs = f idirs }
   updLibraryDirs f pk@(InstalledPackageInfo { libraryDirs = ldirs }) =
 
   [6]
   vvv:~/src/plugins-1.0$ runhaskell Setup build
   Preprocessing library plugins-1.0...
   Building plugins-1.0...
   [ 1 of 24] Compiling System.Plugins.Process (
 src/System/Plugins/Process.hs, dist/build/System/Plugins/Process.o )
   [ 2 of 24] Compiling System.Plugins.Parser (
 src/System/Plugins/Parser.hs, dist/build/System/Plugins/Parser.o )
   [ 3 of 24] Compiling System.Plugins.ParsePkgConfCabal (
 src/System/Plugins/ParsePkgConfCabal.hs,
 dist/build/System/Plugins/ParsePkgConfCabal.o )
   [ 4 of 24] Compiling System.Plugins.PackageAPI (
 src/System/Plugins/PackageAPI.hs,
 dist/build/System/Plugins/PackageAPI.o )
 
   src/System/Plugins/PackageAPI.hs:64:20:
 

Re: readline on macs

2008-01-07 Thread Judah Jacobson
On Jan 7, 2008 6:55 AM, Christian Maeder [EMAIL PROTECTED] wrote:
 Judah Jacobson wrote:
  On Jan 5, 2008 10:29 AM, Thorkil Naur [EMAIL PROTECTED] wrote:
  The alternative is to use static linking of gmp (as suggested by chak)
  _and_ readline (version 5), so that user programs are also statically
  linked with these libs.

 I just have succeeded in linking ghc-6.8.2 statically with libreadline.a
 and libncurses.a in the compiler directory by setting:

Readline is distributed under the GPL, not the LGPL (which gmp is).
Does the above cause a licensing problem? (I don't have much
experience in that area; hopefully someone can explain this issues
involved.)

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


Re: wish for more-usable bindist

2008-01-07 Thread Bryan O'Sullivan
Simon Marlow wrote:

 The i386 machine I use here for building the bindists is running a
 rather old version of RedHat.

Might that be the machine you're using to build the source tarballs,
too?  That would probably explain
http://hackage.haskell.org/trac/ghc/ticket/2020 :-)

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


Re: readline on macs

2008-01-07 Thread Ian Lynagh
On Mon, Jan 07, 2008 at 09:19:25AM -0800, Judah Jacobson wrote:
 On Jan 7, 2008 6:55 AM, Christian Maeder [EMAIL PROTECTED] wrote:
  Judah Jacobson wrote:
   On Jan 5, 2008 10:29 AM, Thorkil Naur [EMAIL PROTECTED] wrote:
   The alternative is to use static linking of gmp (as suggested by chak)
   _and_ readline (version 5), so that user programs are also statically
   linked with these libs.
 
  I just have succeeded in linking ghc-6.8.2 statically with libreadline.a
  and libncurses.a in the compiler directory by setting:
 
 Readline is distributed under the GPL, not the LGPL (which gmp is).
 Does the above cause a licensing problem? (I don't have much
 experience in that area; hopefully someone can explain this issues
 involved.)

Perhaps the best answer is for someone to make editline bindings for
Haskell?

I believe this would solve the problem twice: OS X comes with editline,
and it's BSD licensed so we can happily statically link against it. The
latter may help us on Windows too.

Everything I know about editline is third-hand, but AIUI the APIs are
very similar, so it shouldn't be hard to alter GHC to use editline
instead.


Thanks
Ian

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


Re: wish for more-usable bindist

2008-01-07 Thread Ian Lynagh
On Mon, Jan 07, 2008 at 11:38:21AM +0100, Christian Maeder wrote:
 Simon Marlow wrote:
  The i386 machine I use here for building the bindists is running a
  rather old version of RedHat.  I do intend to upgrade it at some point,
  but it's entirely possible for someone else to build a bindist too.
 
 I wonder why (all) the (various) buildbots do not produce (tested) bindists.

Two problems I can think of:

It would increase the disk usage: You need another copy of everything
that gets installed, plus the tarball of it.

We would need a way to publish the bindists that get produced. Currently
it's done by a few machines at MSR having passwordless access to
www.haskell.org.


Thanks
Ian

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


Re: GHC Core question

2008-01-07 Thread Tim Chevalier
On 1/7/08, Neil Mitchell [EMAIL PROTECTED] wrote:
 Hi

  How are you printing out the Core?

 showSDoc $ ppr c

 where c :: [CoreBind]

  It looks like the unique ids are
  missing (you can see them if you pass the -ppr-debug flag, which can
  be set using the API)

 I have now set the -ppr-debug flag, but that has no effect. It's not
 entirely surprising, as I guess setting the flag only applies through
 the GHC session, and this code is being run outside that. How can I
 print the output (to a file) using the unique id's?


Good point about the session, I forgot about that. It looks like you
can call showSDocDebug instead of showSDoc (see utils/Outputable.lhs),
which acts as if -dppr-debug is set, but I haven't actually tried it.

 Can I invoke CoreTidy using the GHC API?


Yes, but you'll need to grab a post-Dec-25 build if you haven't
already, since I added this recently. Once you have, see
compileToCoreSimplified in main/GHC.hs.

Cheers,
Tim

-- 
Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt
It's easy to consider women more emotional than men when you don't
consider rage to be an emotion. -- Brenda Fine
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: wish for more-usable bindist

2008-01-07 Thread Spencer Janssen
On Fri, Jan 04, 2008 at 08:24:32PM -0500, Isaac Dupree wrote:
 the i386 linux ghc bindist still uses readline 4 
 http://haskell.org/ghc/download_ghc_682.html, which is hard to get:
 readline 5.0 came out almost three and a half years ago 
 ftp://ftp.cwru.edu/pub/bash/

 And I don't want to pollute my Ubuntu system with compatibility RPMs; in 
 fact I intend to install the bindist as my local user so I don't pollute it 
 with extra GHCs either, except I can't.  Could there be a bindist with 
 modern readline, or perhaps is it possible to statically link with 
 readline?

 ~Isaac

Here's a little trick I picked up from Stefan O'Rear:

sed -e 's/readline.so.4/readline.so.5' --in-place ~/lib/ghc-6.8.2/ghc-6.8.2

Surprisingly, this produces a working GHC.


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


Re: can't build plugins-1.0 with ghc-6.9

2008-01-07 Thread Valery V. Vorotyntsev
On 1/7/08, Don Stewart [EMAIL PROTECTED] wrote:
 Please start with the hs-plugins repo on code.haskell.org, since it's
 already updated for ghc 6.8,

 http://code.haskell.org/~dons/code/hs-plugins/

Missed shot. :)

  vvv:~/src/hs-plugins$ runhaskell Setup build
  Preprocessing library plugins-1.1...
  Building plugins-1.1...
  [ 1 of 16] Compiling System.Plugins.Process (
src/System/Plugins/Process.hs, dist/build/System/Plugins/Process.o )
  [ 2 of 16] Compiling System.Plugins.Parser (
src/System/Plugins/Parser.hs, dist/build/System/Plugins/Parser.o )
  [ 3 of 16] Compiling System.Plugins.ParsePkgConfCabal (
src/System/Plugins/ParsePkgConfCabal.hs,
dist/build/System/Plugins/ParsePkgConfCabal.o )
  [ 4 of 16] Compiling System.Plugins.PackageAPI (
src/System/Plugins/PackageAPI.hs,
dist/build/System/Plugins/PackageAPI.o )

  src/System/Plugins/PackageAPI.hs:64:20:
  Not in scope: data constructor `InstalledPackageInfo'

  src/System/Plugins/PackageAPI.hs:66:21:
  Not in scope: data constructor `InstalledPackageInfo'

No problems with the .cabal file, though.

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


Re: wish for more-usable bindist

2008-01-07 Thread Ian Lynagh
On Mon, Jan 07, 2008 at 11:34:08AM +0100, Christian Maeder wrote:
 You may try my version built on:
 
 [EMAIL PROTECTED]:~ uname -a
 Linux denebola 2.6.18.8-0.7-bigsmp #1 SMP Tue Oct 2 17:21:08 UTC 2007
 i686 i686 i386 GNU/Linux
 
 using: gcc version 4.1.2 20061115 (prerelease) (SUSE Linux)
 
 http://www.dfki.de/sks/hets/linux/versions/ghc-6.8.2-i386-unknown-linux.tar.bz2

Greats, I've put this on the download page.


Thanks
Ian

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


Any Debian Etch packages for GHC 6.8.2?

2008-01-07 Thread Wagner Ferenc
Hi,

speaking of binary dists, does anybody know of some Debian Etch
packages of GHC 6.8.2?  If nothing else is available, I'm ready to
repackage a .tar.gz as a .deb, but I wonder if there's anything better
available already...
-- 
Thanks,
Feri.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Any Debian Etch packages for GHC 6.8.2?

2008-01-07 Thread Ravi Nanavati
Well... I built some (not all) of the 6.8.2-related packages in
Haskell Unsafe on etch. It's a little tricky because you need to get
some build dependencies from unstable and some from Haskell Unsafe (as
source and then build them on etch), but it is possible to work that
out. I could reconstruct the details, if you're interested (or just
put the .debs somewhere they can be downloaded).

I should also add that you need to be careful about uninstalling ghc
libraries before changing ghc versions. Otherwise the wrong ghc-pkg is
used and the uninstallation (or upgrade when you are installing new
packages) fails. I wonder if libghc6 libraries shouldn't depend on the
particular version of ghc they were compiled with (so they
automatically go if you change ghc versions).

 - Ravi

On 1/7/08, Wagner Ferenc [EMAIL PROTECTED] wrote:
 Hi,

 speaking of binary dists, does anybody know of some Debian Etch
 packages of GHC 6.8.2?  If nothing else is available, I'm ready to
 repackage a .tar.gz as a .deb, but I wonder if there's anything better
 available already...
 --
 Thanks,
 Feri.
 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

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


Re: GHC Core question

2008-01-07 Thread Neil Mitchell
Hi

  I have now set the -ppr-debug flag, but that has no effect. It's not
  entirely surprising, as I guess setting the flag only applies through
  the GHC session, and this code is being run outside that. How can I
  print the output (to a file) using the unique id's?
 

 Good point about the session, I forgot about that. It looks like you
 can call showSDocDebug instead of showSDoc (see utils/Outputable.lhs),
 which acts as if -dppr-debug is set, but I haven't actually tried it.

That does indeed work - and I can now see exactly why you don't leave
it on all the time!


  Can I invoke CoreTidy using the GHC API?
 

 Yes, but you'll need to grab a post-Dec-25 build if you haven't
 already, since I added this recently. Once you have, see
 compileToCoreSimplified in main/GHC.hs.

/me upgrades

Many thanks,

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


Re: readline on macs

2008-01-07 Thread Judah Jacobson
On Jan 7, 2008 11:46 AM, Ian Lynagh [EMAIL PROTECTED] wrote:

 On Mon, Jan 07, 2008 at 09:19:25AM -0800, Judah Jacobson wrote:
  On Jan 7, 2008 6:55 AM, Christian Maeder [EMAIL PROTECTED] wrote:
   Judah Jacobson wrote:
On Jan 5, 2008 10:29 AM, Thorkil Naur [EMAIL PROTECTED] wrote:
The alternative is to use static linking of gmp (as suggested by chak)
_and_ readline (version 5), so that user programs are also statically
linked with these libs.
  
   I just have succeeded in linking ghc-6.8.2 statically with libreadline.a
   and libncurses.a in the compiler directory by setting:
 
  Readline is distributed under the GPL, not the LGPL (which gmp is).
  Does the above cause a licensing problem? (I don't have much
  experience in that area; hopefully someone can explain this issues
  involved.)

 Perhaps the best answer is for someone to make editline bindings for
 Haskell?

 I believe this would solve the problem twice: OS X comes with editline,
 and it's BSD licensed so we can happily statically link against it. The
 latter may help us on Windows too.

 Everything I know about editline is third-hand, but AIUI the APIs are
 very similar, so it shouldn't be hard to alter GHC to use editline
 instead.

Editline provides readline/[readline.h,history.h] which provide a
subset of the readline API and (I've checked) contain all of the
functions that ghci uses.

One possiblility is to add a configure --with-libedit flag to the
readline package which would permit linking against libedit and #ifdef
out all functions that it doesn't support.  Note that the package
already #defines HAVE_READLINE_4 and HAVE_READLINE_5 to permit
compiling against multiple versions of readline, so adding
HAVE_GNU_READLINE or HAVE_LIBEDIT wouldn't be much worse, IMHO.

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