Re: RFC: include a cabal-install executable in future GHC releases

2014-05-03 Thread Ashley Yakeley
I couldn't find them, and they're not listed at 
http://www.haskell.org/cabal/download.html (except OS X), or at 
http://www.haskell.org/haskellwiki/Cabal-Install, or at 
http://hackage.haskell.org/package/cabal-install.


-- Ashley

On 2014-05-03 17:00, Carter Schonwald wrote:
I think there's now hosted official cabal install binaries online. 
 I'm Afk but they should be a short google away. Should be linked more 
prominently though


On Saturday, May 3, 2014, Ashley Yakeley ash...@semantic.org 
mailto:ash...@semantic.org wrote:


So I want to install GHC + cabal on a new system, building cabal
packages with profiling and documentation. Here's what I have to do:

1. Download, unpack and install GHC.

2. Download and unpack cabal-install, and run bootstrap.sh. As
part of the bootstrap, it will download and build a bunch of packages.

3. Delete the downloaded packages (rm -rf ~/.ghc/*) because they
were built without profiling or documentation.

4. Call cabal update to get a default .cabal/config file.

5. Edit .cabal/config to switch on library-profiling,
executable-profiling, and documentation.

6. Build my stuff.

This would be much simplified if binary versions of cabal-install
were available. (It would be even simpler if they were just
included in the GHC builds -- I could eliminate 2  3.)

-- Ashley Yakeley
___
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: Kind Demotion

2012-09-17 Thread Ashley Yakeley

My workaround is to wrap types of all kinds as kind *:

  data WrapType (a :: k)

...or better yet, as its own kind:

  data WrappedType = forall a. WrapType a

Now I can make an apples-to-apples comparison of types of different 
kinds, e.g. WrapType [] and WrapType Bool. All I need now is a way 
of applying wrapped types:


  type family WrapApply
(f :: WrappedType) (x :: WrappedType) :: WrappedType
  type instance WrapApply
(WrapType (f :: ka - kfa)) (WrapType (a :: ka)) = WrapType (f a)

-- Ashley Yakeley

On 17/09/12 06:05, Richard Eisenberg wrote:

I see what you're getting at, but the problem is more fundamental than just the 
lack of a type *. GHC has no notion of equality between kinds other than 
syntactic identity. If two kinds are other than syntactically identical, they 
are considered distinct. This fact basically renders your approach doomed to 
failure. Furthermore, a promoted datatype and the unpromoted datatype are 
distinct entities with the same names, so you can't just use a variable both at 
the kind level and the type level (variable ka in your final ConstructedT 
example). It is not hard to write a Demote type family that computes an 
unpromoted datatype from its promoted kind, but that type family will interfere 
with type inference.

That's all the bad news. The good news is that some of us are working out how 
to extend GHC's rich notion of type equality to the kind level, which would 
also allow intermingling of type- and kind-variables. We're still a little ways 
out from starting to think about implementing these ideas, but there's a good 
chance that what you want will be possible in the (not-so-terribly-long-term) 
future.

Richard

On Sep 17, 2012, at 12:41 AM, Ashley Yakeley wrote:


TypeRep does indeed resemble * as a type.

I'm working on a system for reification of types, building on my open-witness 
package (which is essentially a cleaner, more Haskell-ish alternative to 
TypeRep).

Firstly, there's a witness type to equality of types:

  data EqualType :: k - k - * where
MkEqualType :: EqualType a a

Then there's a class for matching witnesses to types:

  class SimpleWitness (w :: k - *) where
matchWitness :: w a - w b - Maybe (EqualType a b)

Then I have a type IOWitness that witnesses to types. Through a little Template 
Haskell magic, one can declare unique values of IOWitness at top level, or just 
create them in the IO monad. Internally, it's just a wrapper around Integer, 
but if the integers match, then it must have come from the same creation, which 
means the types are the same.

  data IOWitness (a :: k) = ...
  instance SimpleWitness IOWitness where ...
OK. So what I want to do is create a type that's an instance of SimpleWitness that represents types 
constructed from other types. For instance, [Integer] is constructed from [] and 
Integer.

  data T :: k - * where
DeclaredT :: forall ka (a :: ka). IOWitness a - T a
ConstructedT ::
  forall kfa ka (f :: ka - kfa) (a :: ka). T f - T a - T (f a)

  instance SimpleWitness T where
matchWitness (DeclaredT io1) (DeclaredT io2) = matchWitness io1 io2
matchWitness (ConstructedT f1 a1) (ConstructedT f2 a2) = do
  MkEqualType - matchWitness f1 f2
  MkEqualType - matchWitness a1 a2
  return MkEqualType
matchWitness _ _ = Nothing

But this doesn't work. This is because when trying to determine whether f1 a1 ~ f2 a1, even though f1 a1 has the same kind as f2 
a2, that doesn't mean that a1 and a2 have the same kind. To solve this, I need to include in ConstructedT a witness 
to ka, the kind of a:

  ConstructedT ::
forall kfa ka (f :: ka - kfa) (a :: ka).
  IOWitness ka - T f - T a - T (f a)

  matchWitness (ConstructedT k1 f1 a1) (ConstructedT k2 f2 a2) = do
MkEqualType - matchWitness k1 k2
MkEqualType - matchWitness f1 f2
MkEqualType - matchWitness a1 a2
return MkEqualType

Sadly, this doesn't work, for two reasons. Firstly, there isn't a type for *, 
etc. Secondly, GHC isn't smart enough to unify two kinds even though you've 
given it an explicit witness to their equality.

-- Ashley Yakeley

On 16/09/12 20:12, Richard Eisenberg wrote:

If you squint at it the right way, TypeRep looks like such a type *. I believe 
José Pedro Magalhães is working on a revision to the definition of TypeRep 
incorporating kind polymorphism, etc., but the current TypeRep might work for 
you.

Your idea intersects various others I've been thinking about/working on. What's 
the context/application?

Thanks,
Richard

On Sep 16, 2012, at 7:09 PM, Ashley Yakeley wrote:


Now that we have type promotion, where certain types can become kinds, I find 
myself wanting kind demotion, where kinds are also types. So for instance there 
would be a '*' type, and all types of kind * would be demoted to values of it. 
Is that feasible?

-- Ashley Yakeley


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http

Kind Demotion

2012-09-16 Thread Ashley Yakeley
Now that we have type promotion, where certain types can become kinds, I 
find myself wanting kind demotion, where kinds are also types. So for 
instance there would be a '*' type, and all types of kind * would be 
demoted to values of it. Is that feasible?


-- Ashley Yakeley


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


Re: Kind Demotion

2012-09-16 Thread Ashley Yakeley

TypeRep does indeed resemble * as a type.

I'm working on a system for reification of types, building on my 
open-witness package (which is essentially a cleaner, more Haskell-ish 
alternative to TypeRep).


Firstly, there's a witness type to equality of types:

  data EqualType :: k - k - * where
MkEqualType :: EqualType a a

Then there's a class for matching witnesses to types:

  class SimpleWitness (w :: k - *) where
matchWitness :: w a - w b - Maybe (EqualType a b)

Then I have a type IOWitness that witnesses to types. Through a little 
Template Haskell magic, one can declare unique values of IOWitness at 
top level, or just create them in the IO monad. Internally, it's just a 
wrapper around Integer, but if the integers match, then it must have 
come from the same creation, which means the types are the same.


  data IOWitness (a :: k) = ...
  instance SimpleWitness IOWitness where ...

OK. So what I want to do is create a type that's an instance of 
SimpleWitness that represents types constructed from other types. For 
instance, [Integer] is constructed from [] and Integer.


  data T :: k - * where
DeclaredT :: forall ka (a :: ka). IOWitness a - T a
ConstructedT ::
  forall kfa ka (f :: ka - kfa) (a :: ka). T f - T a - T (f a)

  instance SimpleWitness T where
matchWitness (DeclaredT io1) (DeclaredT io2) = matchWitness io1 io2
matchWitness (ConstructedT f1 a1) (ConstructedT f2 a2) = do
  MkEqualType - matchWitness f1 f2
  MkEqualType - matchWitness a1 a2
  return MkEqualType
matchWitness _ _ = Nothing

But this doesn't work. This is because when trying to determine whether 
f1 a1 ~ f2 a1, even though f1 a1 has the same kind as f2 a2, that 
doesn't mean that a1 and a2 have the same kind. To solve this, I 
need to include in ConstructedT a witness to ka, the kind of a:


  ConstructedT ::
forall kfa ka (f :: ka - kfa) (a :: ka).
  IOWitness ka - T f - T a - T (f a)

  matchWitness (ConstructedT k1 f1 a1) (ConstructedT k2 f2 a2) = do
MkEqualType - matchWitness k1 k2
MkEqualType - matchWitness f1 f2
MkEqualType - matchWitness a1 a2
return MkEqualType

Sadly, this doesn't work, for two reasons. Firstly, there isn't a type 
for *, etc. Secondly, GHC isn't smart enough to unify two kinds even 
though you've given it an explicit witness to their equality.


-- Ashley Yakeley

On 16/09/12 20:12, Richard Eisenberg wrote:

If you squint at it the right way, TypeRep looks like such a type *. I believe 
José Pedro Magalhães is working on a revision to the definition of TypeRep 
incorporating kind polymorphism, etc., but the current TypeRep might work for 
you.

Your idea intersects various others I've been thinking about/working on. What's 
the context/application?

Thanks,
Richard

On Sep 16, 2012, at 7:09 PM, Ashley Yakeley wrote:


Now that we have type promotion, where certain types can become kinds, I find 
myself wanting kind demotion, where kinds are also types. So for instance there 
would be a '*' type, and all types of kind * would be demoted to values of it. 
Is that feasible?

-- Ashley Yakeley


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




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


Re: [Haskell] Re: ANNOUNCE: GHC version 6.10.2

2009-04-05 Thread Ashley Yakeley

Duncan Coutts wrote:


In the mean time you can just:

$ cabal install time


Where do I get the cabal command? I'm installing GHC on a new machine 
and I was hoping it would be included. I can't obtain it via cabal 
install cabal-install because I don't have the cabal command and I 
don't know how to tie the knot in this case.


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


Re: Breakage with ghc-6.10

2008-10-10 Thread Ashley Yakeley
On Fri, 2008-10-10 at 09:08 -0700, Duncan Coutts wrote:
 Data/Time/Clock/CTimeval.hs:1:11:
 Warning: -ffi is deprecated: use -XForeignFunctionInterface or
 pragma {-# LANGUAGE ForeignFunctionInterface#-} instead
 
 no location info:
 Failing due to -Werror.
 
 Nooo!!
 
 This is the reason that hackage now rejects the use of -Werror in
 released packages. It causes unnecessary breakage when new compilers
 add new warnings.

Warnings in a build process should be fixed, not ignored (and, I would
say, fixed by whoever introduced the warning or otherwise broke the
build).

Hackage, on the other hand, is right to reject -Werror in .cabal files,
as there the build is really part of the install process and should be
as lenient as possible. I pass --ghc-options=-Wall -Werror to cabal in
a Makefile in most of my projects, so that my development build process
is strict.

-- 
Ashley Yakeley

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


importing in place and packages

2006-12-22 Thread Ashley Yakeley
I'm compiling the files for package javavm with GHC 6.6 (using 
-package-name javavm). As part of the compilation process, I need a 
runnable program that uses the modules I've compiled in place:


  import JVMBoot

But I get this error when compiling my Main module (ShowClasses.hs):

ShowClasses.hs:23:1:
Bad interface file: JVMBoot.hi
Something is amiss; requested module  main:JVMBoot differs from 
name found in the interface file javavm:JVMBoot


Really I want to import javavm:JVMBoot, not main:JVMBoot. I tried this, 
but GHC doesn't like it (because it's not Haskell):


 import javavm:JVMBoot

I tried compiling ShowClasses.hs with -package-name javavm. This let 
me compile, but then I get this on link:


/usr/bin/ld: Undefined symbols:
_ZCMain_main_closure
___stginit_ZCMain
collect2: ld returned 1 exit status

I tried adding a -main-is in the compile step, but this didn't help.

Is there any way to create a main function that calls files imported in 
place that are in some package? I have the same issue when writing 
tests for my time package.


--
Ashley Yakeley

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


Re: importing in place and packages

2006-12-22 Thread Ashley Yakeley

Simon Peyton-Jones wrote:


Anyway, the solution for you is to install it.


I can't install it, the package isn't finished being built at that 
point. Or perhaps I could find a way of installing the partial package 
to the user database.


I build part of package javavm. Then I use that to build ShowClasses. 
Then I run ShowClasses to generate more source files. Then I use those 
to build the rest of javavm.


--
Ashley Yakeley

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


Re: Major type-class overhaul

2006-11-15 Thread Ashley Yakeley

Simon Peyton-Jones wrote:


3. Dictionaries are packaged in data constructors



This feature has been often requested, becuase it allows you to
package a dictionary into an ordinary (non-existential) data type, and
be able to use it.


Indeed, one can now simply reify class instances:

  data NumInst a where
MkNumInst :: Num a = NumInst a

  intInst :: NumInst Int
  intInst = MkNumInst

  plus :: NumInst a - a - a - a
  plus MkNumInst p q = p + q

Expect a whole new batch of type shenanigans from Oleg.

--
Ashley Yakeley
Seattle, WA

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


Re: Missing Folder in ghc?

2006-03-02 Thread Ashley Yakeley

Simon Marlow wrote:

It looks like you expected to build GHC by grabbing the darcs repo and 
reading the README file - that isn't a route I anticipated :-)  I'll 
make sure the README gets updated at some point.


Thanks. Now the build process gets stuck here:


==fptools== make all -wr -f Makefile;
 in /home/ashley/Projects/Collected/Haskell/ghc/libraries/base

rm -f GHC/Base.o; if [ ! -d GHC/Base_split ]; then mkdir GHC/Base_split; 
else /usr/bin/find GHC/Base_split -name '*.o' -print | xargs rm -f 
__rm_food; fi;
../../ghc/compiler/ghc-inplace -H16m -O -fglasgow-exts -cpp -Iinclude 
-#include HsBase.h -funbox-strict-fields -ignore-package base -O 
-Rghc-timing -fgenerics  -fgenerics -split-objs-c GHC/Base.lhs -o 
GHC/Base.o  -ohi GHC/Base.hi



The compiler just sits and does nothing for hours. It doesn't even use 
any CPU, it seems to be just waiting for something (in state S+ 
according to ps). I tried running the command with -H64m, but that 
didn't help. With -v it gives this:


Glasgow Haskell Compiler, Version 6.5, for Haskell 98, compiled by GHC 
version 6.4
Using package config file: 
/home/ashley/Projects/Collected/Haskell/ghc/ghc/driver/package.conf.inplace

Using package config file: /home/ashley/.ghc/i386-linux-6.5/package.conf
package haskell98-1.0 will be ignored due to missing dependencies:
  base-1.0
package template-haskell-1.0 will be ignored due to missing dependencies:
  base-1.0
package unix-1.0 will be ignored due to missing dependencies:
  base-1.0
package Cabal-1.1.4 will be ignored due to missing dependencies:
  base-1.0
package parsec-2.0 will be ignored due to missing dependencies:
  base-1.0
package haskell-src-1.0 will be ignored due to missing dependencies:
  base-1.0
package network-1.0 will be ignored due to missing dependencies:
  base-1.0
package QuickCheck-1.0 will be ignored due to missing dependencies:
  base-1.0
package HUnit-1.1 will be ignored due to missing dependencies:
  base-1.0
package mtl-1.0 will be ignored due to missing dependencies:
  base-1.0
package fgl-5.2 will be ignored due to missing dependencies:
  base-1.0
package stm-1.0 will be ignored due to missing dependencies:
  base-1.0
package readline-1.0 will be ignored due to missing dependencies:
  base-1.0
Hsc static flags: -static
*** Literate pre-processor:
/home/ashley/Projects/Collected/Haskell/ghc/ghc/utils/unlit/unlit -h 
GHC/Base.lhs GHC/Base.lhs /tmp/ghc28900_0.lpp

*** C pre-processor:
gcc -E -undef -traditional -v -I include -I 
/home/ashley/Projects/Collected/Haskell/ghc/ghc/includes 
-D__HASKELL1__=5 -D__GLASGOW_HASKELL__=605 -D__HASKELL98__ 
-D__CONCURRENT_HASKELL__ -Dlinux_BUILD_OS=1 -Di386_BUILD_ARCH=1 
-Dlinux_HOST_OS=1 -Di386_HOST_ARCH=1 -x c /tmp/ghc28900_0.lpp -o 
/tmp/ghc28900_0.hscpp

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr 
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-shared 
--with-system-zlib --libexecdir=/usr/lib --enable-nls 
--without-included-gettext --enable-threads=posix --program-suffix=-4.0 
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt 
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm 
--enable-java-awt=gtk --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre 
--enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu

Thread model: posix
gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
 /usr/lib/gcc/i486-linux-gnu/4.0.2/cc1 -E -traditional-cpp -quiet -v -I 
include -I /home/ashley/Projects/Collected/Haskell/ghc/ghc/includes 
-D__HASKELL1__=5 -D__GLASGOW_HASKELL__=605 -D__HASKELL98__ 
-D__CONCURRENT_HASKELL__ -Dlinux_BUILD_OS=1 -Di386_BUILD_ARCH=1 
-Dlinux_HOST_OS=1 -Di386_HOST_ARCH=1 /tmp/ghc28900_0.lpp -o 
/tmp/ghc28900_0.hscpp -mtune=i486 -undef

ignoring nonexistent directory /usr/local/include/i486-linux-gnu
ignoring nonexistent directory /usr/include/i486-linux-gnu
#include ... search starts here:
#include ... search starts here:
 include
 /home/ashley/Projects/Collected/Haskell/ghc/ghc/includes
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.0.2/include
 /usr/include
End of search list.
*** Checking old interface for GHC.Base:
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 2851
*** Simplify:


It stops and waits there. This is my machine:

$ uname -a
Linux rollright 2.6.12-10-386 #1 Mon Feb 13 12:13:15 UTC 2006 i686 GNU/Linux

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


Re: Missing Folder in ghc?

2006-03-01 Thread Ashley Yakeley

Simon Marlow wrote:
The configure script has mis-detected your GHC version somehow.  Could 
you look through the output of configure, and see what it says about 
GHC?


Nothing special:

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
Canonicalised to: i386-unknown-linux
checking for path to top of build tree... 
/home/ashley/Projects/Collected/Haskell/ghc

checking for ghc... /usr/bin/ghc
checking version of ghc... 6.4
checking for nhc... no
checking for nhc98... no
checking for hbc... no


Also look in mk/config.mk, at the value of GhcCanonVersion.


GHC = /usr/bin/ghc
GhcDir  = $(dir $(GHC))
GhcVersion  = 6.4
GhcMajVersion   = 6
GhcMinVersion   = 4
GhcPatchLevel   = 0

# Canonicalised ghc version number, used for easy (integer) version
# comparisons.  We must expand $(GhcMinVersion) to two digits by
# adding a leading zero if necessary:
ifneq $(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9) 
GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
else
GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
endif


Maybe you switched GHC versions but didn't reconfigure?


I think the problem is that I called autoconf etc. before I called 
darcs-all get, but not after. Calling autoreconf fixed the problem.


--
Ashley Yakeley

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


Re: Missing Folder in ghc?

2006-02-28 Thread Ashley Yakeley

Lemmih wrote:

Did you run 'sh darcs-all get'?


Oh, that wasn't in the README. Thanks. But now I get this:

/usr/bin/ghc -H16m -O -I. -Iinclude -Rghc-timing  -I../../../libraries 
-fglasgow-exts -no-recomp-c System/Directory/Internals.hs -o 
System/Directory/Internals.o  -ohi System/Directory/Internals.hi


System/Directory/Internals.hs:1:0:
Module `System.Directory.Internals' is a member of package base-1.0.
To compile this module, please use -ignore-package base-1.0.

I'm using GHC 6.4.

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


Re: Duplicate instance declarations

2005-12-27 Thread Ashley Yakeley

Bulat Ziganshin wrote:

Hello all

why the folowing is not allowed even with all extensions enabled both
in Hugs and GHC?

class BufStream h where

class CharStream h where
instance (CharStream h) = BufStream h where

class MemoryStream h where
instance (MemoryStream h) = BufStream h where


Try this:

class (BufStream h) = CharStream h where

class (BufStream h) = MemoryStream h where


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


Re: ANNOUNCE: Visual Haskell version 0.0

2005-09-27 Thread Ashley Yakeley
In article 
[EMAIL PROTECTED]
ft.com,
 Simon Marlow [EMAIL PROTECTED] wrote:

 A quick note about the license: this is a binary release with a BSD
 license.  We changed the license at the last minute, and didn't have
 time to re-roll the installer.  You have the option of using Visual
 Haskell either under the click-through license in the installer (a
 Microsoft shared source license for non-commercial use) or the more
 liberal BSD license in the documentation.

Will you be coming out with another installer? I'm not comfortable 
clicking accept on the MSR license...

-- 
Ashley Yakeley, Seattle WA

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


Re: ANNOUNCE: GHC version 6.4

2005-03-14 Thread Ashley Yakeley
Simon Marlow [EMAIL PROTECTED] wrote:

=
 The (Interactive) Glasgow Haskell Compiler -- version 6.4
=
 
 The GHC Team is delighted to announce a new major release of GHC.

Some issues:

1. ghc -M complains about multiply-defined Main modules.
entered as 
http://sourceforge.net/tracker/index.php?func=detailaid=1162736group_i
d=8032atid=108032

2. What's up with Warning: orphan instances?

3. I notice show for rationals now does 3%2 instead of 3 % 2. 
Probably better, though it does break one of my tests...

4. It looks like Data.FiniteMap has been renamed Data.Map, or something. 
There's no Data.Map at http://haskell.org/haddock/libraries/, do these need 
to be updated?

5. Apparently a bunch of stuff is in different pacakges, such as mtl. Is 
there documentation about what's in what package? Perhaps Haddock should 
show packages or something? I'm not yet familiar enough with Cabal to 
know what the best way of doing this is.

-- 
Ashley Yakeley, Seattle WA

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


recursive group context bug?

2005-01-16 Thread Ashley Yakeley
I suspect someone's come across this before, so maybe there's an 
explanation for it.

This does not compile:

module Bug where
{
p :: IO ();
p = q = id;

q :: (Monad m) = m (IO ());
q = return p;
}

Bug.hs:3:
Mismatched contexts
When matching the contexts of the signatures for
  p :: IO ()
  q :: forall m. (Monad m) = m (IO ())
The signature contexts in a mutually recursive group should all be 
identical
When generalising the type(s) for p, q


The code looks correct to me. Why must the signature contexts be 
identical in this case?

-- 
Ashley Yakeley, Seattle WA

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


Re: Using Haskell with Java

2005-01-08 Thread Ashley Yakeley
In article 
[EMAIL PROTECTED],
 Dmitri Pissarenko [EMAIL PROTECTED] wrote:

 Can Haskell and Java parts of a system co-operate?

See my JVM-Bridge,
https://sourceforge.net/projects/jvm-bridge/

-- 
Ashley Yakeley, Seattle WA

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


Re: F#

2004-06-03 Thread Ashley Yakeley
In article [EMAIL PROTECTED],
 Manuel M T Chakravarty [EMAIL PROTECTED] wrote:

 Generally, phrases such as XYZ is excellent within certain niches
 sounds like cheap propaganda to me.  If you replace Haskell by Linux, I
 am sure you'll find similar statements on other Microsoft web pages ;-)

Doubtless. I think if they're casting about for excuses not to use 
Haskell, they're unlucky not to have hit on time/space issues. Anyway, 
I've rewritten it for them:

Purely functional languages like Haskell are excellent to write
in, but non-trivial work is involved with implementing a lazy
language in a strict run-time environment. ...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: F#

2004-06-01 Thread Ashley Yakeley
In article [EMAIL PROTECTED],
 Manuel M T Chakravarty [EMAIL PROTECTED] wrote:

 On Fri, 2004-05-21 at 10:07, John Sharley wrote:
  I note this remark on the Microsoft Research site
  (http://research.microsoft.com/projects/ilx/fsharp.aspx)
  quote
  Purely functional languages like Haskell are excellent within certain
  niches, but unfortunately some simple programming exercises can quickly turn
  into problems that require a PhD. to solve.
  /quote
  
  Are the Microsoft Research people working on GHC or anyone else on this list
  also of this opinion? If so, why?
 
 This is a clear case of FUD:
 
   http://en.wikipedia.org/wiki/FUD

I agree. It's been changed now, however:

Purely functional languages like Haskell are excellent 
within certain niches, but non-trivial problems exist 
with language interoperability between lazy and strict 
languages.

Given your work on FFI, would you care to comment? I wonder if F# really 
is as obviously preferable to a Haskell# as they claim?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Happy Question

2004-03-01 Thread Ashley Yakeley
My hand-written S-expression parser for HScheme is very very slow. 
Really quite a bit slower than it ought to be. So I'd like to switch to 
Happy instead.

The problem is my parser should be monadic, but the monad type is 
generalised (basically of the form (context m) = m). Is there a way of 
switching on monadic-ness, so I can have a monadic happyError, but 
without giving type signatures to happyThen and happyReturn? Or else 
allowing a class context for the type signatures?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


GHC Warning Request

2003-12-28 Thread Ashley Yakeley
When -fwarn-unused-imports is switched on, import M() should not issue 
a warning. In 6.2, it does.

The idea is that I only wish to import instance declarations here, and 
that's the obvious way of making that explicit. I'm using -Werror (new 
in 6.2, thanks), and most of the time I'm interested in knowing about 
superfluous imports.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ANNOUNCE: GHC version 6.0.1

2003-08-04 Thread Ashley Yakeley
In article [EMAIL PROTECTED],
 Ian Lynagh [EMAIL PROTECTED] wrote:

 Debian packages are now in the archive for unstable; just apt-get
 update and apt-get install ghc6 ghc6-prof ghc6-doc. There are also
 ghc6-hopengl, ghc6-threaded-rts and ghc6-libsrc packages. It should
 enter testing in 10 days time.

/usr/bin/ghc etc. links don't work out of the box. It looks like your 
post-install script needs to call update-alternatives on the four links.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Ways and Build Tags for Optimisation

2003-05-30 Thread Ashley Yakeley
In article 
[EMAIL PROTECTED]
ft.com,
 Simon Marlow [EMAIL PROTECTED] wrote:

  -rw-r--r--1 ashley   ashley2117554 May 28 04:04 HBase.hi
  -rw-r--r--1 ashley   ashley2119865 May 28 08:15 HBase.p hi
  -rw-r--r--1 ashley   ashley  72669 May 28 16:20 HBase.q hi
 
 Wow :-)

It looks like the problem is very data-heavy Unicode property files. For 
instance, Org.Org.Semantic.HBase.Text.UnicodeNames exports just one 
value:

   getCharacterName :: Char - String

Inside the module is an Array Char String created from a 
[(Char,String)] that is a long list of Unicode character names. The 
file is automatically generated from a downloaded data file. For 
instance:

 getCharacterName '\x189F'
MONGOLIAN LETTER MANCHU ALI GALI DDHA

For some reason, even though only getCharacterName is exported, when 
optimisation is switched on, the interface file balloons a thousandfold:

$ ls -l UnicodeNames.*hi
-rw-r--r--1 ashley   ashley5854480 May 28 02:49 UnicodeNames.hi
-rw-r--r--1 ashley   ashley5854497 May 28 06:56 UnicodeNames.p_hi
-rw-r--r--1 ashley   ashley   2385 May 28 15:59 UnicodeNames.q_hi

What's the best way to stop this? Is it reasonable to simply switch off 
profiling just for these few files?

Also, I'd like to make all that data disappear when a binary program 
that doesn't use it is stripped; currently it doesn't. Any ideas?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Ways and Build Tags for Optimisation

2003-05-29 Thread Ashley Yakeley
I'd like to include three different flavours of my HBase package, with 
these combinations of optimisation and profiling:

  release:   optimised (with -O -fvia-C)
  profiling: optimised and profiled
  quick: neither

The release and profiling flavours take forever to compile, so it's 
useful to have a quick flavour to speed up the development cycle. The 
trouble is, any Haskell program using the release flavour of HBase also 
compiles very slowly, even if it itself does not use -O. If nothing 
else, this may be due to the huge interface file for the root import:

$ ls -Al HBase.*hi
-rw-r--r--1 ashley   ashley2117554 May 28 04:04 HBase.hi
-rw-r--r--1 ashley   ashley2119865 May 28 08:15 HBase.p_hi
-rw-r--r--1 ashley   ashley  72669 May 28 16:20 HBase.q_hi

So what I'd like to do is include the quick version with suffices 
.q_hi and .q_o within the hbase package, just as profiling has .p_hi 
and .p_o. However, simply using -hisuf and -osuf seems not to be 
sufficient to force GHC to use those suffices when looking for files 
within HBase.

I looked in fptools/ghc/compiler/main/DriverState.hs to see how GHC does 
this sort of thing for profiling: the file speaks of ways and build 
tags but I can't find any reference to these in the GHC manual. How 
would I use one of the user ways?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ANNOUNCE: GHC vesrion 5.04.3 released

2003-03-24 Thread Ashley Yakeley
In article [EMAIL PROTECTED],
 Wolfgang Thaller [EMAIL PROTECTED] wrote:

 A Mac OS X installer package is now available at
 http://www.uni-graz.at/imawww/haskell/GHC.5.04.3.dmg
 
 It includes profiling libraries (this time, they should work), but not 
 the documentation (use the online docs instead).
 This binary requires Mac OS X 10.2 (Jaguar). It will not work on Mac OS 
 X 10.1.

Profiling libraries are still buggy. This file fails to link with 
profiling set:

module Main where
{
import System.IO;

main :: IO ();
main = putStrLn (show ReadMode);
}

$ ghc -prof ProfTest.hs -o ProfTest_p
ld: warning table of contents of library: 
/usr/local/lib/ghc-5.04.3/libHSbase_p.a not sorted slower link editing 
will result (use the ranlib(1) -s option)
ld: Undefined symbols:
_GHCziHandle_ReadMode_static_info
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 5.04.3
$ uname -a
Darwin Avebury.local. 6.4 Darwin Kernel Version 6.4: Wed Jan 29 18:50:42 
PST 2003; root:xnu/xnu-344.26.obj~1/RELEASE_PPC  Power Macintosh powerpc
$

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Type Inference Infelicity

2003-03-19 Thread Ashley Yakeley
This should compile, shouldn't it?

-- ghc -c -fglasgow-exts TestInfer.hs
module TestInfer where
{
class C t a b | t a - b;
instance C Char a Bool;

data P t a = forall b. (C t a b) = MkP b;

data Q t = MkQ (forall a. P t a);

f' :: Q Char;
f' = MkQ (MkP True :: forall a. P Char a);

f :: Q Char;
f = MkQ (MkP True);
}

GHC 5.04.2 for MacOS X complains about f, but not about f':

TestInfer.hs:15:
Could not deduce (C t a Bool) from the context ()
Probable fix:
Add (C t a Bool) to the When generalising the type of an 
expression
Or add an instance declaration for (C t a Bool)
arising from use of `MkP' at TestInfer.hs:15
In the first argument of `MkQ', namely `(MkP True)'
In the definition of `f': MkQ (MkP True)

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


ghcfilt

2003-02-25 Thread Ashley Yakeley
Is there a ghcfilt equivalent of c++filt that will unmangle 
'z'-escaped GHC symbols?

Is the mangling written up somewhere? I might be able to write 
something...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Bug in GHC 5.04.2 for Mac OS X

2003-01-30 Thread Ashley Yakeley
At 2003-01-30 20:27, I wrote:

GPR13 is indeed considered nonvolatile, so it looks like the JVM is 
correct and the function made by createAdjustor is wrong.

See enclosed example.

-- 
Ashley Yakeley, Seattle WA



GPR13Bug.tar.gz
Description: Binary data


Re: Native Threads in the RTS

2002-11-26 Thread Ashley Yakeley
At 2002-11-26 09:37, Alastair Reid wrote:

  1) forkNativeThread :: IO () - IO ()
 The fresh Haskell thread is bound to a fresh native thread.

  2) forkIO :: IO () - IO ()
 The fresh Haskell thread is not bound to a native thread.

Are you sure you intend to change the type of forkIO? Currently it's

  forkIO :: IO () - IO ThreadId


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: -Werror Request

2002-11-21 Thread Ashley Yakeley
At 2002-11-20 01:38, Simon Peyton-Jones wrote:

Done!

Thanks!

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



-Werror Request

2002-11-13 Thread Ashley Yakeley
If it's not too much work, I'd like to request a -Werror option for GHC 
that would turn warnings into errors. Sometimes warnings one would like 
to catch get lost in a long make process.

Thanks...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Database library?

2002-10-16 Thread Ashley Yakeley

At 2002-10-16 09:49, Bryn Keller wrote:

Does anyone have a GHC-friendly library for accessing databases, 
specifically Oracle and MSSQL?

My HBase project includes HMySQL, for accessing MySQL databases. It's 
kind of a separate project from HBase (because it uses FFI), but it's in 
the same CVS repository. It's rather incomplete at the moment.

http://sourceforge.net/projects/hbase/

HBase proper includes an interesting monad for generating SQL SELECT 
statements. But HBase is it's own little world, replacing the Prelude...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Rts.h and C++ Annoyance

2002-10-13 Thread Ashley Yakeley
It seems I can't compile Rts.h as C++ on Linux. Curiously it compiles OK 
on Darwin.

$ gcc -x c -c /usr/lib/ghc-5.04/include/Rts.h
$ gcc -x c++ -c /usr/lib/ghc-5.04/include/Rts.h
In file included from /usr/lib/ghc-5.04/include/Stg.h:210,
 from /usr/lib/ghc-5.04/include/Rts.h:20:
/usr/lib/ghc-5.04/include/gmp.h:1970: declaration of C function `class 
ostream  operator (ostream , const __mpq_struct *)' conflicts with
/usr/lib/ghc-5.04/include/gmp.h:1969: previous declaration `class ostream 
 operator (ostream , const __mpz_struct *)' here
/usr/lib/ghc-5.04/include/gmp.h:1971: declaration of C function `class 
ostream  operator (ostream , const __mpf_struct *)' conflicts with
/usr/lib/ghc-5.04/include/gmp.h:1970: previous declaration `class ostream 
 operator (ostream , const __mpq_struct *)' here
/usr/lib/ghc-5.04/include/gmp.h:1973: declaration of C function `class 
istream  operator (istream , __mpq_struct *)' conflicts with
/usr/lib/ghc-5.04/include/gmp.h:1972: previous declaration `class istream 
 operator (istream , __mpz_struct *)' here
/usr/lib/ghc-5.04/include/gmp.h:1974: declaration of C function `class 
istream  operator (istream , __mpf_struct *)' conflicts with
/usr/lib/ghc-5.04/include/gmp.h:1973: previous declaration `class istream 
 operator (istream , __mpq_struct *)' here
$ gcc --version
2.95.4
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 5.04
$ uname -a
Linux server 2.4.18-686 #1 Sun Apr 14 11:32:47 EST 2002 i686 unknown
$


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Building Both Regular and Profiling Libraries

2002-10-10 Thread Ashley Yakeley

At 2002-10-10 01:23, Ketil Z. Malde wrote:

Ashley Yakeley [EMAIL PROTECTED] writes:

 I did notice that for -osuf you seem to need the '.' but for -hisuf you 
 don't...

Weird, I've never seen that behavior (GHC 5.02 and 5.04, x86-Linux and
Sparc-Solaris).  I just checked with 5.04 on my Linux box, and 5.02 on
a Sun, just to make sure.

What system and compiler version are you using?

My mistake, I'm using -o, which overrides -osuf...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Building Both Regular and Profiling Libraries

2002-10-09 Thread Ashley Yakeley

Is there a good strategy for building both regular and profiling variants 
of libraries? One of the problems is that the .hi files are not 
compatible, so I need to both kinds of those too. Should I be giving them 
separate names or something? How do people deal with this?

Right now I do a 'make clean' and then rebuild with profiling options, 
but that's kind of annoying...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Building Both Regular and Profiling Libraries

2002-10-09 Thread Ashley Yakeley

At 2002-10-09 04:21, Simon Peyton-Jones wrote:

Yes there is.  In your build.mk, set GhcLibWays = p

This is discussed a lot in the Building Guide, which I commend to you if
you are building GHC.

I'm not building GHC. I just want to build my own stuff and I don't have 
a build.mk...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Building Both Regular and Profiling Libraries

2002-10-09 Thread Ashley Yakeley

At 2002-10-09 07:48, Hal Daume III wrote:

Is this the sort of thing you're looking for?

Yes, thanks. I now have these in my Makefile:


HCPOPTS = -prof -hisuf p_hi -osuf .p_o -auto-all +RTS -K32M 
-RTS

depend-entries: $(HC_SRCS)
$(HC) -M -optdep-s -optdepp $(HCFLAGS) $^


I did notice that for -osuf you seem to need the '.' but for -hisuf you 
don't...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: -package-name

2002-10-08 Thread Ashley Yakeley

At 2002-10-08 03:04, Simon Peyton-Jones wrote:

Definitely not.  

Definitely not worthwhile? Should I be using -package-name foo when 
compiling for my package foo?

Packages are the unit of distribution, and the unit of
library archive, in GHC.
If you import a module Foo, GHC has to figure out which libBaz.a to
link.  

I assumed that GHC linked to all libraries mentioned in all those 
packages specified with -package.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: -package-name

2002-10-08 Thread Ashley Yakeley

At 2002-10-08 04:26, Simon Peyton-Jones wrote:

Ah, it's the -package flag we are planning to get rid of!  

Aha. So how will GHC find all the various module imports? I'd rather be 
using -package foo than -i/usr/local/share/foo/haskell/imports. Or is 
there going to be some standard, official place for everyone's .hi files 
to be installed in, such as the GHC imports directory?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



-package-name

2002-10-07 Thread Ashley Yakeley

Is the -package-name mechanism still worthwhile now that we have 
hierarchical modules?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: replacing the Prelude (again)

2002-07-15 Thread Ashley Yakeley

At 2002-07-15 01:05, Simon Peyton-Jones wrote:

I quite like the fact that you would then have to say 

   import MyPrelude as Prelude

thereby stressing that you are importing the Prelude stuff.

Doesn't this assume your Prelude stuff is all in one module? Or can you 
import several modules as Prelude?

As a Prelude-replacer, my preference is rather towards keeping it as it 
is... it seems a bit simpler and easier to understand.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: ANNOUNCE: GHC version 5.04 released

2002-07-11 Thread Ashley Yakeley

At 2002-07-11 11:22, Eray Ozkural wrote:

 A Windows installer for 5.04 is now available via the GHC downloads
 page: http://haskell.org/ghc/download_ghc_504.html

/me pings debian people. we can't lag behind windows, come on ;)

I'm sure Michael Weber is working on it even as we speak...


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Dynamic Libraries on MacOS X

2002-06-11 Thread Ashley Yakeley

At 2002-06-10 04:03, Simon Marlow wrote:

It sounds like frameworks are similar in concept to GHC's packages.

They solve a similar problem in a quite different way. A framework is a 
bundle: an actual directory with everything inside it, libraries, 
header files, localised strings, whatever, with a particular internal 
structure that does clever stuff with symbolic links to handle multiple 
versions.

Frameworks and other bundles (such as applications) may be relocated by 
the user, though frameworks generally need to be in certain standard 
places so that other tools can find them. Bundles may be uninstalled 
simply by deleting the directory. Generally the Mac GUI shows the 
directory as an object rather than a folder, though there's a special 
menu option to open the directory up like any folder.

By contrast, GHC packages are virtual i.e. the stuff is not necessarily 
all in one directory. And if any of it gets moved, the package.conf file 
would need to be updated.

For code-generating tools, you point to frameworks on the command-line 
much as you do libraries. For instance, just as you do -lfoo 
-L./foolibs to refer to libfoo and to search for libraries in 
./foolibs/, you'd do -framework foo -F ./foofws to refer to 
foo.framework and to search in ./foofws/ for frameworks (there are also 
standard places to search). The Darwin C compiler can use this to find 
include files, and then you can pass the same options to the linker, and 
it will find the libraries.

Too bad frameworks aren't standard on all UNIX, they are an excellent way 
of packaging software.

 *) add two command line options that get passed on to the 
 linker (-framework for linking with a framework and -F for 
 specifying framework search paths)
 *) add corresponding entries to package.conf

You mean add a new package for each framework?

I think Wolfgang means add new package specification components, such as 
frameworks and frameworks_dir. They just need to be passed on to the 
linker.

One interesting possibility would be to allow support for .hi files in 
frameworks. This would mean GHC would look inside frameworks specified by 
the -framework flag and frameworks package.conf entries for .hi files, 
in addition to -I and import_dirs. This would mean a bit more code but 
I believe Apple provides APIs for dealing with bundles easily.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



GHC Ownership

2002-06-11 Thread Ashley Yakeley

At 2002-06-11 08:18, Simon Marlow wrote:

This is *so* annoying when all we're trying to do is write free software 
here.   

This reminds me... who legally owns GHC?

 * the University of Glasgow?

 * Simon and Simon?

 * Microsoft?

 * many different people and institutions?


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Replacing the Prelude

2002-06-03 Thread Ashley Yakeley

Ping!

At 2002-05-14 07:17, Simon Peyton-Jones wrote:

Ashley writes

|  I was hoping to do something similar for 'do' notation by redefining
|  (), (=) etc., but unfortunately GHC is quite insistent 
| that 'do' notation quite specifically refers to GHC.Base.Monad 

Dylan replies

| I'm surprised that ghc uses the fromInteger and fromRational 
| that are in scope; I thought there was general agreement that 
| it should use the Prelude.from{Integer,Rational} in scope.

Ashley is referring to a GHC extension.  Normally, GHC uses
Prelude.fromInteger etc, regardless of what is in scope.  But if you
say -fno-implicit-prelude, GHC will instead use whatver fromInteger
is in scope.  (This is documented in the manual.)

Ashley's question, as I understand is whether something similar
could be done for monads. 

Answer: I think so, without much bother.   I'm beavering away on
a Haskell workshop paper at the moment, but ping me in a fortnight
to do it.

Simon
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Overlapping Instance Thoughts

2002-05-28 Thread Ashley Yakeley

At 2002-05-21 07:25, Simon Peyton-Jones wrote:

Overlapping instances are a terrific swamp and while they
are interesting I don't think I'm going to spend a lot of
time on them in the near future, I'm afraid.  But perhaps
someone else can..

I would say the overlapping instances issue is one of the more important 
ones in the extended language. I'm sure most Haskell programmers have 
been tripped up by it at least once or twice. It's certainly the thing I 
most frequently bang my head against.

There are in fact some different issues here.

1. There are instances that don't actually overlap, but only because of 
class contexts:

class C a;
class D a;
instance C Bool;
instance (D a) = C a;

GHC rejects this, because it only looks at the instance heads, not the 
contexts. Ideally GHC would accept this as non-overlapping, but then 
prohibit instances of different classes that caused the two instances to 
overlap, such as this:

instance D Bool;

2. There's also times when the programmer would like instances that 
really do overlap. Now GHC already has a -fallow-overlapping-instances 
flag to allow overlaps where one is a strict subset of the other: the 
more special case takes priority over the more general. But sometimes 
this isn't enough. For instance, while writing a Scheme interpreter, I 
wanted to do something like this:

newtype Constant a = MkConstant a;

-- members omitted
class (Monad m) = MonadGettableReference m r where ...

instance (Monad m) =
 MonadGettableReference m Constant where ...

instance (MonadGettableReference m r) =
 MonadGettableReference (SchemeCPS r (m p)) r where ...

Unfortunately the two instances overlap, here:

MonadGettableReference (SchemeCPS Constant (m p)) Constant

In fact it wouldn't actually matter which instance was used in this case, 
and I suspect that's typical of good class design. So perhaps an 
-fallow-incoherent-instances flag that just arbitrarily picked one might 
be helpful. Better would be some mechanism for allowing the programmer to 
specify which instances defer to which. Or else extend 
-fallow-overlapping-instances to allow disambiguating instances:

class C a b;
instance C a ();
instance C () a;
instance C () ();

Here, the third instance is precisely the overlap of the other two. But 
apparently this too has problems:

I don't understand all the implications of this.
For example, what if we have an instance that
doesn't match C () () now, but may do 'later'
when a type variable has been instantiated.

I don't doubt Simon PJ when he says this is a terrific swamp. I think any 
work anyone might wish to do cutting through the swamp that ended up in 
the language would be very valuable.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: -fallow-overlapping-instances Request

2002-05-18 Thread Ashley Yakeley

At 2002-05-17 03:54, Johannes Waldmann wrote:

From a type-theoretic viewpoint, 
instance declarations are relations between (sets of) trees 
(= elements of the respective data types).
So one needs representations of such relations
with effective decidability of overlapping-ness, most-sepcific-ness and such.

Yeah but unfortunately GHC doesn't look at the contexts of instance 
declarations. It has a straightforward but rather conservative concept of 
overlapping and most specific. I'd like to see that fixed too, but 
that's a separate issue.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



-fallow-overlapping-instances Request

2002-05-17 Thread Ashley Yakeley

Currently -fallow-overlapping-instances only allows overlapping instances 
if one is a strict subset of the other. This is good (determinate), but 
sometimes you really need two instances that partially overlap. It would 
be nice if this could be disambiguated simply with another instance 
declaration. For instance:

class C a b;
instance C a ();
instance C () a;
instance C () ();

As you can see, the first two instances partially overlap, but the third 
one disambiguates. I think it would be nice if GHC 
-fallow-overlapping-instances allowed this.

This would take some of the pain out of overlapping instance resolution...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Exceptions and IO

2002-05-16 Thread Ashley Yakeley

My confusion surrounding exceptions in the IO monad comes from the fact 
that IO failures and bottom are not cleanly separated. I had always 
assumed the IO monad looked something like this:

 newtype IO a = IO (RealWorldState - Either IOFailure 
(RealWorldState,a))

 return a = IO (\r - Right (r,a))
 fail s = IO (\r - Left (userFailure s))

This would make sense, I think, because it's so easy this way for 
Prelude.catch to catch all IOFailures but leave pure bottom exceptions 
alone, just as the report says. But in fact IO looks more like this:

 newtype IO a = IO (RealWorldState - (RealWorldState,a))

 return a = IO (\r - (r,a))
 fail s = IO (\r - throw (userError s))

...which means Prelude.catch has to separate out exceptions caused by 
fail from those caused by error, etc. and there's confusion between 
bottom and exceptions that happen entirely in IO.

-- 
Ashley Yakeley, Seattle WA


-- ghc -package lang TestException.hs -o TestException  ./TestException
module Main where
{
import IORef;
import qualified Exception;

getPureException :: a - IO (Maybe Exception.Exception);
getPureException a = (Exception.catch (seq a (return Nothing)) (return . 
Just));

showIOS :: String - IO String - IO ();
showIOS s ios = do
{
putStr (s ++ : );
mpe - getPureException ios;
case mpe of
{
Just pe - putStrLn (pure exception (++ (show pe) ++));
Nothing - Exception.catch (Prelude.catch (do
{
result - ios;
mrpe - getPureException result;
case mrpe of
{
Just pe - putStrLn (returned pure exception 
(++ (show pe) ++));
Nothing - putStrLn (value (++ (show result) 
++));
};
}) (\e - putStrLn (IO failure ( ++ (show e) ++))) 
)
(\e - putStrLn (IO other exception ( ++ (show e) 
++)));
};
};

evaluate' :: a - IO a;
evaluate' a = a `seq` return a;

evaluate'' :: a - IO a;
evaluate'' a = (Exception.catch (seq a (return a)) (\e - fail (show e)));

main :: IO ();
main = do
{
putStrLn * value;
showIOS return text   
(return text);
showIOS return undefined  return text   (return undefined  
return text);
putStrLn ;

putStrLn * returned pure exception;
showIOS return undefined  
(return undefined);
showIOS return (seq undefined text)   (return (seq undefined 
text));
showIOS return ()  return undefined (return ()  return 
undefined);
showIOS return undefined = return   (return undefined = 
return);
putStrLn ;

putStrLn * IO failure;
showIOS fail text
 (fail text);
showIOS ioError (userError text)  (ioError 
(userError text));
putStrLn ;

putStrLn * IO other exception;
showIOS undefined  return text  (undefined  
return text);
showIOS return ()  undefined(return ()  
undefined);
showIOS ioError (ErrorCall text)  (ioError 
(Exception.ErrorCall text));
showIOS ioError (AssertionFailed text)(ioError 
(Exception.AssertionFailed text));
putStrLn ;

putStrLn * pure exception;
showIOS undefined
 undefined;
showIOS seq undefined (return text)   (seq undefined (return 
text));
showIOS seq undefined (return undefined)  (seq undefined (return 
undefined));
showIOS error text(error 
text);
showIOS throw (userError text)
(Exception.throw (userError text));
showIOS throw (ErrorCall text)
(Exception.throw (Exception.ErrorCall text));
showIOS throw (AssertionFailed text)  (Exception.throw 
(Exception.AssertionFailed text));
putStrLn ;

putStrLn * evaluate functions;
showIOS evaluate undefined
(Exception.evaluate undefined);
showIOS evaluate' undefined

RE: Prelude.catch vs. Exception.catch

2002-05-15 Thread Ashley Yakeley

At 2002-05-14 04:10, I wrote:

what's the motivation for this change?

Well I think it's more intuitive.

FWIW, I'd like to retract this pending further investigation. I'm still 
not sure I fully understand how exceptions and failures work in the IO 
monad.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Ashley Yakeley

At 2002-05-14 02:24, Simon Marlow wrote:

This is bizarre: the definition of evaluate in Exception is exactly the
one you gave above, yet they behave differently.  You may have uncovered
a compiler bug, I'll look into it.

I might ask which is correct: according to the rules for seq, evaluate' 
undefined should be bottom, but we want Expression.evaluate undefined 
to be a failing IO action.

I think the compiler is correct but the definition given in the 
documentation is wrong.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Prelude.catch vs. Exception.catch

2002-05-13 Thread Ashley Yakeley

At 2002-05-13 08:44, Simon Marlow wrote:

Prelude.catch catches IO exceptions only, because this is what the
Haskell report specifies.

OK

The idea is
that if you want to use Exceptions in their full glory, you:
...
   import qualified Exception

I've noticed something a bit unusual about Exception.catch. It seems it 
can't catch return undefined by itself. Consider these values of type 
IO String:

 iouPure :: IO String;
 iouPure = undefined;

 iouError :: IO String;
 iouError = error error;

These aren't even an IO actions, they're simply bottom. Straightforward 
enough. But they _will_ be caught by Exception.catch.

 iouFail :: IO String;
 iouFail = fail failure;

 iouEvaluate :: IOString;
 iouEvaluate = Exception.evaluate undefined;

These two are IO actions that fail when executed. They will also be 
caught by Exception.catch.

 iouReturn :: IO String;
 iouReturn = return undefined;

This one is an IO action that succeeds when executing. It _won't_ be 
caught by Exception.catch, which will instead simply return the undefined 
value.

I'm not sure what to make of this...


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Prelude.catch vs. Exception.catch

2002-05-12 Thread Ashley Yakeley

I notice that Prelude.catch and Exception.catch behave differently, even 
though they both have the same type signature (and name). Exception.catch 
catches exceptions that Prelude.catch does not.

For instance, it is possible to bind pure functional exceptions into the 
IO monad using Exception.evaluate:

peUndef :: String;
peUndef = undefined;

ioUndef :: IO String;
ioUndef = Exception.evaluate peUndef;

These can be caught with Exception.catch:

main :: IO ();
   main = do
{
  result - Exception.catch (ioUndef)
(\e - return (got exception:  ++ (show e)));
hPutStr stderr (result ++ \n);
};

got exception: Prelude.undefined

...but not with Prelude.catch:

main :: IO ();
   main = do
{
  result - Prelude.catch (ioUndef)
(\e - return (got exception:  ++ (show e)));
hPutStr stderr (result ++ \n);
};


Fail: Prelude.undefined

What's up with that?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Replacing the Prelude

2002-05-12 Thread Ashley Yakeley

I have recently been experimenting writing code that replaces large 
chunks of the Prelude, compiling with -fno-implicit-prelude. I notice 
that I can happily redefine numeric literals simply by creating functions 
called 'fromInteger' and 'fromRational': GHC will use whatever is in 
scope for those names.

I was hoping to do something similar for 'do' notation by redefining 
(), (=) etc., but unfortunately GHC is quite insistent that 'do' 
notation quite specifically refers to GHC.Base.Monad (i.e. Prelude.Monad, 
as the Report seems to require). I don't suppose there's any way of 
fooling it, is there? I was rather hoping 'do' notation would work like a 
macro in rewriting its block, and not worry about types at all.

I accept that this might be a slightly bizarre request. There are a 
number of things I don't like about the way the Prelude.Monad class and 
'do' notation are set up, and it would be nice to be able to experiment 
with alternatives.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



What's the '0' for in the version number?

2002-05-03 Thread Ashley Yakeley

Why is it GHC 5.02.2, 5.03 etc.? Wouldn't it be easier with 5.2.2, 
5.3?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: ghc-pkg info

2002-04-22 Thread Ashley Yakeley

At 2002-04-21 12:52, Sven Panne wrote:


It would be nice if ghc-pkg had options to display the value 
of $libdir or at least the given conf file. [...]


I had *major* pains with this for the upcoming HOpenGL release, too.  :-P

Right. I need to find the location of Rts.h. Ideally, I would do 

 ghc-pkg -s rts --field=include_dirs

...and look in each one (if there were more than one). Unfortunately that 
just returns $libdir/include. It would be nice if either there were an 
option that expanded out the $libdir in fields, or else one that just 
returned $libdir.

In the mean time, I'll pull it out of ghc -v...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: New Patches Binary for MacOS X

2002-04-18 Thread Ashley Yakeley

At 2002-04-15 12:29, Wolfgang Thaller wrote:

The binary package for MacOS X is now available at
http://www.kfunigraz.ac.at/imawww/haskell/GHC.dmg

It fails to build TypedObject.hs.

$ /usr/local/bin/ghc -fvia-C -pgmccc -pgmacc -package lang -package 
concurrent -fglasgow-exts -fallow-undecidable-instances -package-name 
javavm -c TypedObject.hs -o TypedObject.o +RTS -K20m
stack overflow: use +RTS -Ksize to increase it

TypedObject.hs is this:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/jvm-bridge/sourc
e/Haskell/TypedObject.hs?rev=1.6

Actually, what I recommend you do is fetch JVM-Bridge from CVS and build 
it yourself. It's quite straightforward.

Go here to find it:
http://sourceforge.net/cvs/?group_id=32318

Follow the instructions in source/Building.


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: ghc-pkg info

2002-04-18 Thread Ashley Yakeley

At 2002-04-18 02:37, Wolfgang Thaller wrote:

Those shell scripts were installed by a standard make install, so I 
expect them to be there for any platform - it has nothing to do with 
MacOS X.

Must be a new thing in the source. Your previous port of 5.03 had 
symlinks there.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: adding package

2002-04-10 Thread Ashley Yakeley

At 2002-04-10 01:42, Serge D. Mechveliani wrote:

I am not a system user, have not right to modify it. 
Please, what is the regular way out?

Installing a GHC package modifies the GHC installation. You need to ask 
an administrator to do it, or else install your own private GHC and 
modify that.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Fundep/Existential Types in 5.03

2002-04-09 Thread Ashley Yakeley

At 2002-04-09 20:02, I wrote:

Does anyone even know of a workaround? Given this, find an implementation 
of 'f' that retrieves the contents of its 'D' argument:

  class C a b | a - b

  data D a = forall b. (C a b) = MkD b

  f :: (C a b) = D a - b
  -- f (MkD b) = bwon't compile

It's very annoying if it can't be done.

Oh, I suppose I can always do this:

  data D a b = MkD b

...so perhaps in all fairness it's not quite so annoying.


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Fundep/Existential Types in 5.03

2002-04-05 Thread Ashley Yakeley

Consider this:

  module Test3 where

  class C a b | a - b where
m :: a - b

  data D a = forall b. (C a b) = MkD a

  f :: (C a b) = D a - b
  f (MkD a) = m a

This compiles fine under GHC 5.02.2. But under 5.03, it gives an error:

Model/Test3.hs:9:
Inferred type is less polymorphic than expected
Quantified type variable `b' escapes
When checking an existential match that binds
and whose type is D a - b1
In the definition of `f': f (MkD a) = m a

I consider that the 5.02.2 behaviour is preferable, and that this is a 
perfectly good program. 'b' does not escape because it is fundep on 'a', 
which is specified in the type-signature. There can be only one.

What was changed in 5.03 and why?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC for MacOS X binary - ranlib and libgmp

2002-03-27 Thread Ashley Yakeley

At 2002-03-27 01:26, Wolfgang Thaller wrote:

... and that's probably why libgmp was already installed on my 
system, and I never even thought about it. For now, you'll have to 
get it from someplace else...

OK, I'll use the one in the 5.00.2 port. I'm currently attempting to 
build JVM-Bridge, which uses createAdjustor. I'll let you know how it 
works out...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC for MacOS X binary now available

2002-03-27 Thread Ashley Yakeley

At 2002-03-22 15:52, Wolfgang Thaller wrote:

A tar.gz file (14.5MB) of GHC for MacOS X is now available for download at:
http://www.foldr.org/Software/Haskell/ghc/ghc-5.03-13032002-MacOSX.tar.gz

Do you have 'gcc' installed on your system? It's not there by default on 
OS X, but your GHC seems to want it. My workaround is to pass these to 
GHC:

-pgmc cc -pgma cc -pgml cc

(actually I use $(CC) instead of cc in my Makefile). Consider using 'cc' 
instead of 'gcc' for default programs.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Double your money in 30 days

2002-03-03 Thread Ashley Yakeley

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

Loading package std ... linking ... done.
Prelude 0 * 2
0


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC on MacOS X

2002-03-02 Thread Ashley Yakeley

At 2002-03-02 14:21, Wolfgang Thaller wrote:

The results: another unregistered build, a PowerPC implementation
of createAdjustor (foreign export dynamic now works!).

Excellent! I will be porting JVM-Bridge to it as soon as it's ready.

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Strictness information?

2002-02-19 Thread Ashley Yakeley

At 2002-02-19 09:21, Simon Peyton-Jones wrote:

'V' means 'eValuates'.  So your function is strict in both arguments.
It's intended to be internal compiler stuff which is while it's not
properly documented, I'm afraid.

I'd quite like to see intelligible .hi files that look like Haskell, even 
if they are autogenerated...

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Binary Compatibility

2002-02-05 Thread Ashley Yakeley

Apologies if this has been covered before. What compatibility is there 
between code compiled in different versions of GHC?

My JVM-Bridge was compiled under 5.02 and assembled as package 'javavm'. 
Will that package work if added to GHC 5.02.2? What about 5.03?

-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: ANNOUNCE: GHC 5.03.20020204 snapshot release

2002-02-05 Thread Ashley Yakeley

At 2002-02-05 06:36, Julian Seward (Intl Vendor) wrote:

   - newtypes support deriving *any* class for which the
 underlying type is also an instance.

How about multi-parameter classes where there are instances for the 
underlying type on more than one parameter: is it possible to specify 
which parameter the newtype is being derived on?

   - Linear implicit parameters: a highly experimental feature.

What are they?


-- 
Ashley Yakeley, Seattle WA

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: notes on ghc-5.02.2. Reply

2002-01-24 Thread Ashley Yakeley

At 2002-01-24 06:52, Ketil Z. Malde wrote:

GHC is in Debian, you probably want to use a cutting-edge release
(i.e. sid or at least woody) to be reasonably current.

ghc5 in woody and sid is 5.02. If anyone would has a deb for the latest 
release, that would be very useful...

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: question about kinds

2002-01-18 Thread Ashley Yakeley

At 2002-01-18 13:10, Hal Daume III wrote:

Now, I want to say that if some data type 'd' is Traversable and another
data type 'e' is Traversable, then the combined data type is
Traversable.  That is, for example, I want to say that a Tree of Lists is
traversable, or that a List of Trees, or a List of Lists is traversable.

If the Tree type constructor is Traversable, then it's Traversable no 
matter what it's applied to. You've provided a instance for traversing 
Trees of anything, it's going to overlap with any instance for Trees 
of Lists.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Yell

2002-01-12 Thread Ashley Yakeley

At 2002-01-12 10:22, Hal Daume III wrote:

This seconds the yell.

In the mean time Hugs has some documentation:
http://www.cse.ogi.edu/PacSoft/projects/Hugs/pages/hugsman/exts.html#sect7.
4


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: State Transformer

2002-01-11 Thread Ashley Yakeley

At 2002-01-11 06:18, Jorge Adriano wrote:

The whole problem is with passing the 'r' as a parameter, which is precisly 
what I'm trying to avoid.

You could always pass it implicitly (using -fglasgow-exts):

--
testfunc = do
   r - newSTRef ('x',0)
   (do
  foo
  bar
with ?ref = r)
   (c,n) - readSTRef r
   return n

foo :: (Num a,?ref :: STRef s (Char,a)) = ST s ()
foo = do
(c,n) - readSTRef ?ref
writeSTRef ?ref ('a', n+1)

bar :: (Num a,?ref :: STRef s (t,a)) = ST s ()
bar = do
(c,n) - readSTRef ?ref
writeSTRef ?ref (c,n+2)

tryTestFunc = runST testfunc
--

Curiously, GHC isn't smart enough to infer the types of foo and bar by 
itself.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Yell

2002-01-11 Thread Ashley Yakeley

This message constitutes a yell.

http://www.haskell.org/ghc/docs/latest/set/implicit-parameters.html

Thanks in advance...


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



ANN: Release 0.1 of Haskell/Java VM Bridge

2001-12-16 Thread Ashley Yakeley

The first release, 0.1, of Haskell/Java VM Bridge is now available.

Haskell/Java VM Bridge allows Haskell programs access to the Java Virtual 
Machine. Features include:

* On-the-fly creation of Java classes with Haskell functions
  for methods.

* Lifted monads which do all the necessary JNI preloading and
  'env'-pointer variable handling for you. These can be 
  automatically generated via a tool (MakeJVMModule).

* Integration of garbage collectors, type-class based 
  overloading, and a tool (MakeClassModule) which uses Java 
  reflection etc. to generate a Haskell module etc., etc. 

It is, however, only available for Unix and works only with GHC.

This release should be 'beta' quality, but has undergone little testing.

You will need:

  An x86 machine running some form of Unix;

  GHC 5.02 or later;

  The appropriate JVM, installed in the appropriate place:

 - IBM JDK/JRE 1.3 for x86, installed in /usr/lib/ibm-java/IBMJava2-13/

 - Blackdown Port of Sun's JRE 1.3/Sun JDK 1.3 for x86, installed in 
  /usr/lib/j2sdk1.3/ and /usr/lib/j2re1.3/

No documentation is currently available, sorry. Two examples have been 
included: a trivial hello world program, and a program that shows a 
Java Frame containing an instance of a Haskell-defined subclass of Canvas 
that has a Haskell 'paint' method that draws an oval. You should be able 
to figure out most of it from that... and of course the source is 
available from SourceForge CVS.

Be sure to download the correct .tar.gz file for your Java VM. Simple 
installation instructions are included in the file.

http://semantic.org/jvm-bridge/haskell-jvm-bridge-1_3.IBM.classic-0.1.i686
.tar.gz
http://semantic.org/jvm-bridge/haskell-jvm-bridge-1_3.Blackdown.classic.na
tive_threads-0.1.i686.tar.gz
SourceForge's file release system is currently broken. When it's fixed, 
I'll put it there too.

Haskell/JVM Bridge and source code is licensed under the GNU Lesser GPL.

http://sourceforge.net/projects/jvm-bridge/

I hope to build an Darwin/OS X version just as soon as there's a port of 
GHC 5.02 with a working createAdjustor.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC 5.02.1 on Mac OS X

2001-12-02 Thread Ashley Yakeley

At 2001-12-02 14:39, Nicolas Oury wrote:

do you know if there is a port of gh 5.02.1 on MacOSX?

The latest I know of is GHC 5.00.2. And even that is incomplete, it 
doesn't seem to include a createAdjustor for 'foreign export dynamic' 
functions (if you happen to need that, as I do).

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



GHC Installation Location

2001-10-25 Thread Ashley Yakeley

Is there an easy way to get 'ghc' or one of the other binaries to tell me 
where the GHC installation directory is? I want to put the includes 
directory in a gcc -I flag in my makefile.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: GHC Installation Location

2001-10-25 Thread Ashley Yakeley

At 2001-10-25 03:01, Simon Marlow wrote:

I've wondered at various times in the past whether there ought to be a
link from /usr/local/includes/ghc to /usr/local/lib/ghc-5.02/includes.

Won't help, my GHC is installed at /usr/lib/ghc-5.02/, exactly where the 
Debian package put it. And now that location is hard-coded in my Makefile.

But the usual way around this problem is to use 'ghc' as your C compiler
- then the -I flag gets injected automatically.

GHC didn't seem to want to compile my .cpp file -- instead it quietly and 
successfully did nothing. Also I had to do this:

extern C {
#include Rts.h
}

...which I've recently entered a bug in SourceForge about.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: GHC Installation Location

2001-10-25 Thread Ashley Yakeley

At 2001-10-25 03:18, Ashley Yakeley wrote:

I've wondered at various times in the past whether there ought to be a
link from /usr/local/includes/ghc to /usr/local/lib/ghc-5.02/includes.

Won't help, my GHC is installed at /usr/lib/ghc-5.02/, exactly where the 
Debian package put it.

Actually I suppose this means I could write
#include ghc/Rts.h

At 2001-10-25 09:05, Mieszko Lis wrote:

I'm not sure this would be so good when you want to have two versions of ghc
installed on the same machine...

Currently the Debian ghc5 package installs links such as /usr/bin/ghc 
using the 'alternatives' system. You'd just need to add a 
/usr/include/ghc one to that alternatives group.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Multi-parameter OOP

2001-10-19 Thread Ashley Yakeley

At 2001-10-19 08:02, George Russell wrote:

a naive user (like me a month ago) might expect that this to work, so that
toBool (WrappedA a) (WrappedB b) will return False unless a is an A1, and 
b a B1, in which case it returns True.

I think existential types are arranged so that Haskell never needs to 
store type information in them at run-time. So you'll never be able to do 
dynamic OOP with them.

One possible extension to Haskell for dynamic OOP, which I never tire of 
suggesting, is the extensible datatype, for instance:

module P
data BaseType = B1 | B2 | _

module Q
data DerivedType = D1 | D2
data BaseType |= BD DerivedType


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



createAdjustor on Darwin

2001-10-18 Thread Ashley Yakeley

The Darwin (Mac OS X) port of GHC 5.00.2 appears to be missing 
createAdjustor. As I understand it createAdjustor does some kind of 
architecture-specific thing with the stack, or something.

Is anyone working on porting GHC 5.02 to Darwin? Will createAdjustor be 
included? I need it because I do dynamic exporting of callback functions 
through the FFI...

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-10-10 Thread Ashley Yakeley

At 2001-10-10 01:19, I wrote:

foreign import foo raw_foo :: Ptr () - IO (Ptr ());

foo :: Ptr SomeLinkedList - IO (ConstPtr Char);
foo = importFunction raw_foo;

Actually I don't need to convert the pointers, do I? If I have (Storable 
SomeLinkedList), I can just declare

foreign import foo foo :: Ptr SomeLinkedList - IO (Ptr Char);

and it should work. The only thing that's missing is a ConstPtr type...

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



5.02 .deb?

2001-10-06 Thread Ashley Yakeley

Is there a Debian package for GHC 5.02?

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-24 Thread Ashley Yakeley

At 2001-09-23 23:12, Manuel M. T. Chakravarty wrote:

 I was just hoping for GHC to be able to spit out headers for 'foreign 
 import' functions that the user could then define. This merely means a 
 map from some restricted set of Haskell function types to C types.

Functionality like that is not part of the FFI.  However, it
would surely be possible to write an extra tool that
accomplishes just what you want.  (It was a general design
rule to avoid in the basic FFI features that would be
complicated to define/implement and can as easily be
implemented by a tool.)

Right. This would be very similar to the 'javah' tool used in the Java 
world. That works on compiled .class files, I suppose the equivalent 
would be a module that plugged in to the GHC motherboard.

Moreover, the case where you bind to existing C functions is
much more common than where you bind to C functions that you
have written yourself.  

Right, but it's a more ambitious goal for the FFI designer, at least if 
they want to do it completely. As you point out, there are restrictions 
on just what existing C functions you can bind to. If your function looks 
like this:

 const char* foo (struct SomeLinkedList*);

...you have no choice but to write 'impedance-matching' code for that 
function.

structs are not allowed as arguments to foreign imported
functions.

Exactly! And neither are const pointers. But argument const-ness, at 
least, can be safely ignored.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-23 Thread Ashley Yakeley

At 2001-09-23 00:45, Manuel M. T. Chakravarty wrote:

No, unfortunately not.  Consider, for example, that storage
qualifiers would have to be generated correctly and there is
no way to determine form a Haskell type whether a `const'
modifier needs to be added.

I would assume that Ptr types would always be mapped to non-const 
pointers. Do you have an example of a Haskell type for a foreign import 
function, for which the corresponding C function type would be ambiguous?

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-23 Thread Ashley Yakeley

At 2001-09-23 04:02, Manuel M. T. Chakravarty wrote:

 I would assume that Ptr types would always be mapped to non-const 
 pointers. Do you have an example of a Haskell type for a foreign import 
 function, for which the corresponding C function type would be ambiguous?

Take, for example, the following excerpt of the Linux man
pages

But do you have an example of a Haskell type for a foreign import 
function, for which the corresponding C function type would be ambiguous?

At 2001-09-21 02:20, Manuel M. T. Chakravarty wrote:

One could attempt to generate C prototypes from the Haskell
type declarations or similar things, btu it doesn't work
out.

Surely one can still do this? This was what we were discussing, was it 
not? A C type for any given Haskell function type, not necessarily the 
other way around...

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-23 Thread Ashley Yakeley

At 2001-09-23 04:04, Marcin 'Qrczak' Kowalczyk wrote:

It would be impossible then to directly call a C function with a
parameter declared as a const pointer. It's illegal in C to have
mismatching prototypes of the same function.

You can always do this:

  module MyModule where
  {
  foreign import StringCopy :: Ptr Int8 - Ptr Int8 - IO ();
  }

which autogenerates this header:

  extern C
  {
  void MyModule__StringCopy(signed char* a,signed char* b);
  }

which the user can implement like this:

  char* strcat(char* dest, const char* src);

  void MyModule__StringCopy(char* dest,char* src)
  {
  strcat(dest,src);
  }

(assuming char and signed char are identical).


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-23 Thread Ashley Yakeley

At 2001-09-23 15:56, Marcin 'Qrczak' Kowalczyk wrote:

 But do you have an example of a Haskell type for a foreign import 
 function, for which the corresponding C function type would be ambiguous?

Ptr CChar (as an argument). It could be either char * or const char *.

It's always char*. A Haskell function passed a Ptr CChar is not prevented 
from modifying the contents of the pointer simply due to its 
type-declaration. In C, a char* can be implicitly converted to a const 
char* where necessary (but not the other way around).

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Alternative Design for Finalisation

2001-09-21 Thread Ashley Yakeley

At 2001-09-21 09:40, Marcin 'Qrczak' Kowalczyk wrote:

 (apologies for the different spelling of finalize - apparently both are
 correct and I randomly settled on the 'z' version some time ago).

I guess 's' is British and 'z' is American.

Chambers (of Cambridge, England) has both.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-20 Thread Ashley Yakeley

At 2001-09-19 23:45, Manuel M. T. Chakravarty wrote:

 What if the type is polymorphic (e.g. 
 declared as 'Storable a = Ptr a' rather than something like 'Ptr Word8')?

Also possible, as the argument to `Ptr' is just dummy.

What? What about 'withObject'? A Haskell 'Ptr a' is a C array-pointer of 
whatever corresponds to 'a'. I don't think the argument is dummy.

Consider this:

 int foo (char selector,char* arg)
  {
  if (selector == 100)
   return reinterpret_castunsigned char*(arg)[1];
  if (selector == 200)
   return reinterpret_castunsigned short*(arg)[1];
  return 0;
  }

 foreign import foo foo :: Storable a = Word8 - Ptr a - IO Int32;
 
 a - withObject ([1,2] :: [Word8]) (foo 100);
 b - withObject ([3,4] :: [Word16]) (foo 200);

Will this work as expected? I expect 'a' to be 2 and 'b' to be 4...

 3. What about ForeignPtr? Can instances of 'Storable a = ForeignPtr a' 
 be used in FFI?

They can be passed to C, but you can't get them back.  (The
storange manager wouldn't know what finaliser to attach.)

OK. Are ForeignPtrs intelligible in the C function as pointers to the 
named type?

 4. Does newForeignPtr work safely with null pointers, and will the 
 finalizer get called? For instance:
 
  fp - newForeignPtr nullPtr finalFunc;
  let {isNull = (foreignPtrToPtr fp) == nullPtr};
  r - withForeign fp (\p - foo p);
 
 Will foo be passed nullPtr? Will finalFunc ever get called? Is my use, 
 above, of foreignPtrToPtr safe, and will isNull be True?

Should work.  From the storage managers point of view, a
`Ptr' is just an uninterpreted bit-pattern.  A glorified
`Int'. 

So you are saying that the ForeignPtr code is not interested in the 
pointer-ness of the Ptr contents of a ForeignPtr, except when a 
ForeignPtr is used as an FFI argument?

Presumably this also means that one can create two separate ForeignPtrs 
around the same Ptr, each with their own finaliser set. Presumably they 
would not be equal (note that Eq (ForeignPtr a)). Is this correct?

Also, I assume that a ForeignPtr is eligible for garbage collection 
whenever it is no longer 'reachable', even if the Ptr it contains is 
reachable. Is that correct?

Is there anything resembling Java's 'soft' and 'weak references'?

 Of course, you should better make sure that
`finalFunc' can handle getting a `nullPtr'.

Of course...

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Ptr and ForeignPtr Questions

2001-09-20 Thread Ashley Yakeley

At 2001-09-20 02:14, Simon Marlow wrote:

I'll just add that the docs have been updated for 5.02,

Do you have a URL for that?

And don't forget that using foreignPtrToPtr is quite dangerous; much
better to use withForeignPtr instead, otherwise you might find the
ForeignPtr being finalised earlier than you expect.

This is because foreignPtrToPtr is not in the IO monad, correct?

 foreignPtrToPtr :: ForeignPtr a - Ptr a;

A function like this:

 ioForeignPtrToPtr :: ForeignPtr a - IO (Ptr a);
 ioForeignPtrToPtr fp = withForeignPtr fp return;

...would surely be safe? The 5.00 documentation claims that it isn't, 
however, but I don't see why.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-20 Thread Ashley Yakeley

At 2001-09-20 02:31, I wrote:

int foo (char selector,char* arg)
...
  if (selector == 200)

I guess that should be

int foo (unsigned char selector,char* arg)


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Ptr and ForeignPtr Questions

2001-09-20 Thread Ashley Yakeley

At 2001-09-20 02:46, Simon Marlow wrote:

No, it's not safe.  The reason is that the compiler can track a
ForeignPtr to discover when it dies, in order to run the finalizer, but
it can't track a Ptr.  As soon as you drop all references to the
ForeignPtr then the finalizer will run, even if you converted it to a
Ptr and you're still using it.

OK, there are different types of safety. The risk here is that the 
finalisers may have been called by the time you use the Ptr. But if you 
don't mind that, for instance, if for some reason the finalisers don't 
render the Ptr invalid, I assume you can still use the Ptr.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Alternative Design for Finalisation

2001-09-20 Thread Ashley Yakeley

If ForeignPtrs work the way I think they do, then I'm surprised they're 
designed as pointers. I believe the 'pointer' functionality is orthogonal 
to the 'finalisable' functionality and should be separated like this:

--
data Finalisable a  -- abstract handle to finalisable object
instance Eq (Finalisable a);
newFinalisable  :: a - IO () - IO (Finalisable a);
addFinaliser:: Finalisable a - IO () - IO (); 
withFinalisable :: Finalisable a - (a - IO b) - IO b;
touchFinalisable:: Finalisable a - IO ();
finalisableContents :: Finalisable a - a;

type ForeignPtr a = Finalisable (Ptr a);
newForeignPtr  :: Ptr a- IO () - IO (ForeignPtr a);
newForeignPtr = newFinalisable;
addForeignPtrFinalizer :: ForeignPtr a - IO () - IO () ;
addForeignPtrFinalizer = addFinaliser;
withForeignPtr :: ForeignPtr a - (Ptr a - IO b) - IO b;
withForeignPtr = withFinalisable;
touchForeignPtr:: ForeignPtr a - IO ();
touchForeignPtr = touchFinalisable;
foreignPtrToPtr:: ForeignPtr a - Ptr a;
foreignPtrToPtr = finalisableContents;
--

I am slightly bothered by the type of 
finalisableContents/foreignPtrToPtr. Shouldn't it be in the IO monad? 
Apart from 'finalisers already run' risk, is it safe?

But 'castForeignPtr' would not be definable, unless you wanted to do 
something like this:

--
instance Functor Finalisable;
castForeignPtr  :: ForeignPtr a - ForeignPtr b;
castForeignPtr = fmap castPtr;
--

...which I don't believe is appropriate.

The only time when ForeignPtrs act like Ptrs is when they are used as FFI 
arguments. But I believe that's purely syntactic sugar for 
withForeignPtr, and would be no loss.

--
foreign import foo fooFP :: ForeignPtr a - IO ();
foreign import foo fooP  :: Ptr a - IO ();

fooFP' :: ForeignPtr a - IO ();
fooFP' fp = withForeignPtr fp fooP;
--


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-20 Thread Ashley Yakeley

At 2001-09-20 06:55, Manuel M. T. Chakravarty wrote:

The FFI does not ensure any type consistency between the
arguments to `Ptr'/`ForeignPtr' and the corresponding C
types.

I've been using 'Ptr Word8' with newArray to pass lists of bytes to C 
functions. They appear as unsigned char arrays in the C function. Is this 
wrong, or not guaranteed?

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Ptr and ForeignPtr Questions

2001-09-20 Thread Ashley Yakeley

At 2001-09-20 19:32, Manuel M. T. Chakravarty wrote:

What I meant with the remark that you quote is that if you
would use

  foreign import foo :: Ptr Int - IO Float

with

  float foo (float *x)
  {
return *x;
  }

the system will not complain, but your program may dump
core.

What if the C looked like this:

  float foo (int *x)
  {
return *x;
  }

...?

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Ptr and ForeignPtr Questions

2001-09-19 Thread Ashley Yakeley

The documentation for FFI in the GHC user's guide seems to be out of date 
with regard to passing Ptrs across.

1. My reference is 
http://www.haskell.org/ghc/docs/latest/set/ffi.html
(from http://www.haskell.org/ghc/docs/latest/set/book-users-guide.html)
Is this the latest documentation available?

2. My understanding is that you can use any instance of 'Storable a = 
Ptr a' as an FFI argument and return type for both imported and exported 
functions? Is this correct? What if the type is polymorphic (e.g. 
declared as 'Storable a = Ptr a' rather than something like 'Ptr Word8')?

3. What about ForeignPtr? Can instances of 'Storable a = ForeignPtr a' 
be used in FFI?

4. Does newForeignPtr work safely with null pointers, and will the 
finalizer get called? For instance:

 fp - newForeignPtr nullPtr finalFunc;
 let {isNull = (foreignPtrToPtr fp) == nullPtr};
 r - withForeign fp (\p - foo p);

Will foo be passed nullPtr? Will finalFunc ever get called? Is my use, 
above, of foreignPtrToPtr safe, and will isNull be True?


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Converting [Word8] to CString

2001-09-15 Thread Ashley Yakeley

I'm looking for a function that will convert a [Word8] byte-array to a 
CString (i.e. a C byte array) for the purposes of FFI.

 foreign import JVMBridge JVMBridge_FindClass rawFindClass ::
  JavaVM - CString - IO JVMObjectRef;

 makeCString :: [Word8] - IO CString;

It has to work correctly with _any_ list of bytes. And it has to be the 
_same_ list of bytes that comes through on the native side.

Note that we are only dealing with bytes here, this has nothing whatever 
to characters, text, charsets, Unicode, encodings or any of 
that nonsense.

If this really can't be done, is there another type I can use? In some 
cases, the external function may call back into Haskell.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Converting [Word8] to CString

2001-09-15 Thread Ashley Yakeley

At 2001-09-15 02:15, Marcin 'Qrczak' Kowalczyk wrote:

Fri, 14 Sep 2001 23:40:42 -0700, Ashley Yakeley [EMAIL PROTECTED] pisze:

 I'm looking for a function that will convert a [Word8] byte-array
 to a CString (i.e. a C byte array) for the purposes of FFI.

You can use newArray which allocates the C byte array using malloc
so it must be freed by free, and cast the resulting pointer from
Ptr Word8 to CString using castPtr.

Thank you. I ended up doing this and simply using Ptr Word8 as the FFI 
type.

Curiously, the GHC user's guide sec. 8.2.4.1 seems to suggest that Ptr 
types are illegal as arguments in foreign import function declarations. I 
think this is the source of my confusion.
http://www.haskell.org/ghc/docs/latest/set/sec-primitive.html#SEC-PRIM-TYPE
S


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC FFI Return Type Bug

2001-08-07 Thread Ashley Yakeley

At 2001-08-07 11:13, Carl R. Witty wrote:

You can see that the code for f is:
   call g
   andl $255,%eax
   ret
So gcc believes that a function which returns a value of type unsigned
char is not responsible for clearing the high 3 bytes of %eax.

This is to be expected; in most cases the caller will not be doing any 
kind of extension and so the high three bytes won't need to be masked at 
all. Only the caller knows whether extension is necessary, and (as 
Sigbjorn points out) whether it needs to do signed or unsigned extension.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



GHC FFI Return Type Bug

2001-08-05 Thread Ashley Yakeley

Has anyone else come across this? I've only tried this with Word8 but I 
suspect this is a problem with all return types smaller than four bytes.

I've entered this as GHC bug #448104.
http://sourceforge.net/tracker/index.php?func=detailaid=448104group_id=8
032atid=108032

Here's the C code:

extern C
{
unsigned char foo();
}

inline void use(const char* s)
{
}

unsigned char foo()
{
const char* s = ;
use(s);
return 0;
}

...and the Haskell looks something like this:

 foreign import foo :: IO Word8

do {
 w8 - foo;
 putStrLn (show (w8 :: Word8));
}

...and the result is this:
1074803712

Kind of an unusual Word8 value! But note that the low byte of this value 
is zero.

My setup:

$ ghc -v
Glasgow Haskell Compiler, Version 5.00, for Haskell 98, compiled by GHC 
version 5.00
Using package config file: /usr/lib/ghc-5.00/package.conf
Hsc static flags: -static -fignore-interface-pragmas 
-fomit-interface-pragmas -fdo-lambda-eta-expansion -flet-no-escape

$ uname -a
Linux server 2.2.19pre17 #1 Tue Mar 13 22:37:59 EST 2001 i686 unknown


-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



  1   2   >