Mysterious error from ghc6.2

2004-03-11 Thread George Russell
# ghc -c FunnyError.hs

FunnyError.hs:7:
Couldn't match `Bool' against `[Char]'
Expected type: Bool
Inferred type: [Char]
In the definition of `b': b x Foo = ()
In the definition for method `b'
FunnyError.hs:9:
tcLookup: `FunnyError.$dmb' is not in scope
In the definition of `b': b = FunnyError.$dmb
In the definition for method `b'
In the instance declaration for `A Int'
The first error is correct, but the second error message is most peculiar,
is it not?
{- ghc6.2 -}
module FunnyError where

class A x where
   a :: x - ()
   b :: x - Bool - ()
   b x Foo = () -- deliberate type error

instance A Int where
   a _ = ()
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: Mysterious error from ghc6.2

2004-03-11 Thread Simon Peyton-Jones
Ha.  A long-standing infelicity, thank you.  I've fixed the HEAD.

Simon, this could go in the 6.2 branch I believe

Simon

| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of George Russell
| Sent: 11 March 2004 10:32
| To: [EMAIL PROTECTED]
| Subject: Mysterious error from ghc6.2
| 
| # ghc -c FunnyError.hs
| 
| FunnyError.hs:7:
|  Couldn't match `Bool' against `[Char]'
|   Expected type: Bool
|   Inferred type: [Char]
|  In the definition of `b': b x Foo = ()
|  In the definition for method `b'
| 
| FunnyError.hs:9:
|  tcLookup: `FunnyError.$dmb' is not in scope
|  In the definition of `b': b = FunnyError.$dmb
|  In the definition for method `b'
|  In the instance declaration for `A Int'
| 
| 
| The first error is correct, but the second error message is most
peculiar,
| is it not?
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Bug in the installation scripts (trivial)

2004-03-11 Thread Maurizio Colucci
Hello,
I just installed ghc on Mandrake Linux 10, from the file 
[EMAIL PROTECTED]

I was getting an error when I ran ghc and ghci:


Hsc static flags: -static
*** Parser:

interactive:1:
Could not find interface file for `GHC.Exception'
locations searched:
GHC/Exception.hs
GHC/Exception.lhs
/usr/local/lib/ghc-6.2/imports/GHC/Exception.hi

interactive:1:
Could not find interface file for `GHC.Handle'
locations searched:
GHC/Handle.hs
GHC/Handle.lhs
/usr/local/lib/ghc-6.2/imports/GHC/Handle.hi

interactive:1:
Could not find interface file for `GHC.IO'
locations searched:
GHC/IO.hs
GHC/IO.lhs
/usr/local/lib/ghc-6.2/imports/GHC/IO.hi

interactive:1:
Could not find interface file for `System.IO.Error'
locations searched:
System/IO/Error.hs
System/IO/Error.lhs
/usr/local/lib/ghc-6.2/imports/System/IO/Error.hi

interactive:1:
Failed to load interface for `GHC.Base':
Could not find interface file for `GHC.Base'
locations searched: /usr/local/lib/ghc-6.2/imports/GHC/Base.hi
*** Deleting temp files
Deleting:
ghc-6.2: panic! (the `impossible' happened, GHC version 6.2):
interactiveUI:setBuffering



--

I've been able to solve it with

cd /usr/local/lib/ghc-6.2/imports/System

ln -s io IO

cd /usr/local/lib/ghc-6.2/imports/

ln -s ghc GHC

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


RE: Bug in the installation scripts (trivial)

2004-03-11 Thread Simon Marlow
 
 I just installed ghc on Mandrake Linux 10, from the file 
 [EMAIL PROTECTED]

[EMAIL PROTECTED] is a mailing list; which distribution
did you use to install GHC?

 I've been able to solve it with
 
 cd /usr/local/lib/ghc-6.2/imports/System
 
 ln -s io IO
 
 cd /usr/local/lib/ghc-6.2/imports/
 
 ln -s ghc GHC

You mean these directories were present but lower case?  We need to know
which distribution this is so we can correct it.

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


Re: Bug in the installation scripts (trivial)

2004-03-11 Thread Maurizio Colucci
On Thursday 11 March 2004 13:01, Simon Marlow wrote:

  I just installed ghc on Mandrake Linux 10, from the file
  [EMAIL PROTECTED]

 [EMAIL PROTECTED] is a mailing list; which distribution
 did you use to install GHC?

Sorry, I had a problem with cut  paste. :-)

The file I used to install is

  ghc-6.2-i386-unknown-linux.tar.bz2

Since the rpm did not work with mandrake (rpm -Uvh complains that 
libreadline.so.4 is not installed, when it is installed in /usr/lib and /lib)


I installed with 

  ./configure
  make install

  I've been able to solve it with
 
  cd /usr/local/lib/ghc-6.2/imports/System
 
  ln -s io IO
 
  cd /usr/local/lib/ghc-6.2/imports/
 
  ln -s ghc GHC

 You mean these directories were present but lower case? 

Yes.

ghci -v and ghc -v were giving a very clear output that they were searching in 
upeprcase directories, which were not present.


 We need to know 
 which distribution this is so we can correct it.


I tried both Mandrake 9.2 and Mandrake 10.0.



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


RE: Bug in the installation scripts (trivial)

2004-03-11 Thread Simon Marlow
   I've been able to solve it with
  
   cd /usr/local/lib/ghc-6.2/imports/System
  
   ln -s io IO
  
   cd /usr/local/lib/ghc-6.2/imports/
  
   ln -s ghc GHC
 
  You mean these directories were present but lower case? 
 
 Yes.
 
 ghci -v and ghc -v were giving a very clear output that they 
 were searching in 
 upeprcase directories, which were not present.

Ok, I've checked the tarball and the directories are correct.  Something
must have gone wrong either during the unpacking or the installation
phase.

Could you unpack the distribution, and check the contents of
ghc-6.2/lib/i386-unknown-linux/imports?

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


RE: Overlapping instances and multi-parameter classes

2004-03-11 Thread Simon Peyton-Jones
I had a look.  It turns out to be an utterly bogus and incorrect test
for overlap in 6.2.

As it happens, I've already re-written that part of the compiler in the
HEAD, to do lazy overlap resolution.  In GHC 6.2 the instances
instance C a Bool
instance C Bool a
are rejected because they overlap (unless you have
-fallow-overlapping-instances).  In GHC HEAD the instances are not
rejected.  Reason: if we are seeking an instance declaration matching (C
Bool Int) then plainly only one of the instances match.  

So GHC HEAD reports overlap only if a lookup finds two matching
instances, rather than when the instance declarations themselves are
declared.  Kind of like lazy reporting of overlap of unqualified names
in the module system.

Anyway, it happens that I'd inadvertently thereby fixed the bug you
found.  Since it's rather a dark corner, I don't propose to fix it for
6.2.

Thanks for reporting it though.

Simon

| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-users-
| [EMAIL PROTECTED] On Behalf Of Mike Gunter
| Sent: 06 March 2004 06:13
| To: [EMAIL PROTECTED]
| Subject: Overlapping instances and multi-parameter classes
| 
| 
| 
| Given the following:
| 
| 
|  import Data.Maybe   ( fromMaybe )
| 
|  data None
|  none = error none evaluated :: None
| 
| these class and instance declarations:
| 
|  classToMaybe2 ba where toMaybe2   :: a - Maybe b
|  instance ToMaybe2 a None where toMaybe2 = const Nothing
|  instance ToMaybe2 aa where toMaybe2 = Just
| 
| compile fine (given -fallow-undecidable-instances and
| -fallow-overlapping-instances).  And the following code:
| 
|  mbPutStrLn  :: ToMaybe2 String a = a - IO ()
|  mbPutStrLn  = putStrLn . fromMaybe None. . toMaybe2
|  main = mbPutStrLn none  mbPutStrLn Hello, world!
| 
| works as I'd expect.  However, if the parameters to the class
| are reversed:
| 
|  {- uncomment to see error message
|  classToMaybe1 ab where toMaybe1   :: a - Maybe b
|  instance ToMaybe1 None a where toMaybe1 = const Nothing
|  instance ToMaybe1 aa where toMaybe1 = Just
|  -}
| 
| I get the following error message (from GHC{,i} 6.2):
| 
| Overlapping instance declarations:
|   OverlapOrder.lhs:27: ToMaybe1 None a
|   OverlapOrder.lhs:28: ToMaybe1 a a
| 
| Why is this?
| 
|   thanks,
|   mike
| ___
| 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


RE: Release Candidate for 6.2.1 available

2004-03-11 Thread Simon Marlow

ghc-6.2.20040304 and later are release candidates for 6.2.1
 
 Get them from here:
 
   http://www.haskell.org/ghc/dist/stable/dist/

This is your last chance to test...  I'm going to freeze the release on
Monday (15 March).

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


ghci can't continue in a situation (HXml Toolbox)

2004-03-11 Thread Ferenc Wagner
   Hello,

Please have a look at the transcript below.  GHC happily
compiles the file with the Makefile, while GHCi chokes on
it.  I would be grateful for any insight into the problem.

Feri.

tba:~/haskell/xml/ $ cat xml2wiki.hs
import System

import XmlInput
import XmlTree
import XmlState

getLength :: String - XState () Int
getLength file = do [xmlTree] - getXmlContents $ newDocument file
io $ putStr $ show xmlTree
return 14

main :: IO ()
main = do [xmlFile] - getArgs
  l - run' $ getLength xmlFile
  putStrLn (show l)

--

tba:~/haskell/xml/ $ cat Makefile
HXT := $(HOME)/haskell/xml/HXmlToolbox-3.01
INCLUDES := 
$(HXT)/hdom:$(HXT)/hparser:$(HXT)/http:$(HXT)/popen:$(HXT)/parsec:$(HOME)/haskell/HTTP
PACKAGES := -package util -package net

xml2wiki: xml2wiki.hs
ghc -o $@ --make -i$(INCLUDES) $(PACKAGES) $

--

tba:~/haskell/xml/ $ cat .ghci
:set -package net -package util
:set 
-i/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom:/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser:/home/wferi/haskell/xml/HXmlToolbox-3.01/http:/home/wferi/haskell/xml/HXmlToolbox-3.01/popen:/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec:/home/wferi/haskell/HTTP

--

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

Loading package base ... linking ... done.
Loading package lang ... linking ... done.
Loading package concurrent ... linking ... done.
Loading package QuickCheck ... linking ... done.
Loading package readline ... linking ... done.
Loading package unix ... linking ... done.
Loading package posix ... linking ... done.
Loading package util ... linking ... done.
Loading package network ... linking ... done.
Loading package net ... linking ... done.
Skipping  Zord64_HARD  ( /home/wferi/haskell/HTTP/Zord64_HARD.lhs, 
/home/wferi/haskell/HTTP/Zord64_HARD.o )
Skipping  ParsecPos( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPos.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPos.o )
Skipping  ParsecError  ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecError.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecError.o )
Skipping  ParsecPrim   ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPrim.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPrim.o )
Skipping  ParsecChar   ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecChar.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecChar.o )
Skipping  ParsecCombinator ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecCombinator.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecCombinator.o )
Skipping  Base64   ( /home/wferi/haskell/xml/HXmlToolbox-3.01/http/Base64.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/http/Base64.o )
Skipping  MD5  ( /home/wferi/haskell/HTTP/MD5.lhs, 
/home/wferi/haskell/HTTP/MD5.o )
Skipping  AssocList( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/AssocList.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/AssocList.o )
Skipping  NTree( /home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/NTree.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/NTree.o )
Skipping  Util ( /home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/Util.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/Util.o )
Skipping  Unicode  ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/Unicode.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/Unicode.o )
Skipping  Parsec   ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/Parsec.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/Parsec.o )
Skipping  XmlCharParser( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/XmlCharParser.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/XmlCharParser.o )
Skipping  POpen( /home/wferi/haskell/xml/HXmlToolbox-3.01/popen/POpen.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/popen/POpen.o )
Skipping  HTTP ( /home/wferi/haskell/xml/HXmlToolbox-3.01/http/HTTP.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/http/HTTP.o )
Skipping  Browser  ( /home/wferi/haskell/xml/HXmlToolbox-3.01/http/Browser.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/http/Browser.o )
Skipping  XmlTreeTypes ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlTreeTypes.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlTreeTypes.o )
Skipping  XmlKeywords  ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlKeywords.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlKeywords.o )
Skipping  XmlTreeFunctions ( 

Re: ghci can't continue in a situation (HXml Toolbox)

2004-03-11 Thread Ferenc Wagner
Simon David Foster [EMAIL PROTECTED] writes:

 I had to remove POpen from HXT to make it work correctly
 with GHC 6.2. I think this because posix now includes
 popen and so it conflicts with the version in HXT. Try
 removing POpen.hs and doing it again, make sure you load
 package posix.

Yep, it seems you are right.  Although I don't really
understand this.  Is POpen a new addition to the old
libraries?  Btw, I didn't need to add -package posix
anywhere, it's probably implied by something else in my
case.

Thank you very much for the quick help!
-- 
Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Release Candidate for 6.2.1 available

2004-03-11 Thread Sigbjorn Finne
An installer for Windows users can now also be found in
that directory.

--sigbjorn

- Original Message - 
From: Simon Marlow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 11, 2004 04:43
Subject: RE: Release Candidate for 6.2.1 available


 
 ghc-6.2.20040304 and later are release candidates for 6.2.1
  
  Get them from here:
  
http://www.haskell.org/ghc/dist/stable/dist/
 
 This is your last chance to test...  I'm going to freeze the release on
 Monday (15 March).
 
 Cheers,
 Simon

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


Re: Release Candidate for 6.2.1 available

2004-03-11 Thread Sven Panne
Just a short note from my side: I've tested both the branch (not the
.tar.bz2) on x86 Linux and the .msi on Win2k. Both seem to work fine...
Cheers,
   S.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell] Re: RFC: DData in hierarchical libraries

2004-03-11 Thread Johannes Waldmann
A few comments on the DData.Map proposal:

* nice work. I might start using it (instead of Data.FiniteMap)
  just because the function names look better :-)
* argument ordering:

  the existing Data.FiniteMap mostly has
  f :: FiniteMap - ... - FiniteMap
  while the proposal uses
  f :: ... - FiniteMap - FiniteMap
  I think the Edison guidelines are quite nice:
  http://www.haskell.org/ghc/docs/edison/users004.html#toc10
  Did you follow them? What exceptions?
* types: some functions are not declared at their most
  general type (I checked by commenting out the decl. and asking ghci)
difference :: forall a1 k a.
  (Ord k) =
  Map k a1 - Map k a - Map k a1
differenceWithKey :: forall a1 k a.
 (Ord k) =
 (k - a1 - a - Maybe a1) - Map k a1 - Map k a
- Map k a1
intersection :: forall a k a1.
(Ord k) =
Map k a - Map k a1 - Map k a
intersectionWith :: forall a k a2 a1.
(Ord k) =
(a1 - a2 - a) - Map k a1 - Map k a2 - Map k a
intersectionWithKey :: forall a k a1 a2.
   (Ord k) =
   (k - a2 - a1 - a) - Map k a2 - Map k a1 - 
Map k a

isSubsetOfBy :: forall a1 k a.
(Ord k) =
(a - a1 - Bool) - Map k a - Map k a1 - Bool
--
-- Johannes Waldmann,  Tel/Fax: (0341) 3076 6479 / 6480 --
-- http://www.imn.htwk-leipzig.de/~waldmann/ -
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


RE: [Haskell] RFC: DData in hierarchical libraries

2004-03-11 Thread Simon Peyton-Jones
I'm glad to see this progressing.  However, it might be better to move
this thread to the libraries mailing list, which is specifically for
this purpose.   Anyone out there on the Haskell list who wants to
contribute to discussion about Haskell libraries?
http://www.haskell.org/mailman/listinfo/libraries

Simon

| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of JP Bernardy
| Sent: 10 March 2004 23:27
| To: Christian Maeder
| Cc: Haskell Mailing List
| Subject: Re: [Haskell] RFC: DData in hierarchical libraries
| 
| 
| Hi,
| 
|  Maybe the documentation to the 0rdered lists
|  section can be improved.
| 
| Could you be more specific about this?
| 
|  The functions Set.fromAscList and
|  Set.fromAscDistinctList should be
|  marked as unsafe, since it's not clear what sets
|  result if the input
|  is not ascending (and/or has duplicates).
| 
| Would you prefix the function name with unsafe? I
| wonder what is the best way to do such a marking.
| 
|  Furthermore, already for
|  Set.fromList I expect it to be linear, if the input
|  list happens to be
|  ascending.
| 
| I'm afraid it's not, unfortunately. I intend not to
| fiddle with the implementation, to avoid the involved
| instability.
| 
|  Set.map is (still) missing. There are two variants
|  of map functions
|  with type:
| 
|  (Ord a, Ord b) = (a - b) - Set a - Set b
| 
|  The first variant requires the function argument f
|  to be strongly
|  ascending, a  b = f a  f b, and corresponds to a
|  map on the
|  associated ascending lists.
| 
|  The second variant does not restrict the function
|  argument but may
|  result in a set of smaller size. Maybe this variant
|  should be called
|  Set.image.
| 
|  The first variant, maybe call it Set.mapAsc, is
| 
| I'd choose mapMonotonic, from Edison.
| 
|  again unsafe, since
|  the argument function may not be ascending. (The
|  descending case can be
|  ignored.)
| 
|  The same argument about ordered lists apply to the
|  Map module. In
|  addition, it would be nice if there were a variant
|  of Map.keys that
|  returns a set of keys, since the invariant that the
|  keys are ascending
|  and distinct may easily get lost, if not captured by
|  the Set type. A
|  straight forward implementation is:
| 
|  Map.keySet = Set.fromDistinctAscList . Map.keys
| 
|  The use of Set.fromDistinctAscList is safe in this
|  case, but - alas -
|  Map needs to import Set. (But maybe there is even a
|  faster
|  implementation of Map.keySet that exploits the
|  internal representation.)
| 
| Fine. I'll come up with a revision soon.
| 
| Thanks for your feedback,
| JP.
| 
| 
| __
| Do you Yahoo!?
| Yahoo! Search - Find what you're looking for faster
| http://search.yahoo.com
| ___
| Haskell mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/haskell
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] RFC: DData in hierarchical libraries

2004-03-11 Thread Daan Leijen
Hi Christian,

(Some have already replied, but I'll say some more about some issues)

On Mon, 08 Mar 2004 12:32:21 +0100, Christian Maeder [EMAIL PROTECTED] wrote:

Set.toAscList is not really necessary as it is the same as Set.toList.
Not necessarily: the lists from Set.toList will be equal for equal Set's, but
may be unordered. Use toAscList or toDescList if you want an ordered variant.
Now, my *implementation* might use toAscList for toList, but that is a separate 
issue.

The functions Set.fromAscList and Set.fromAscDistinctList should be marked as unsafe
I think so too, although I like unchecked better?

Furthermore, already for Set.fromList I expect it to be linear, if the input list happens to be ascending.
That is not the case yet -- making it linear might be possible but
one has to be very careful about lost laziness in that case..
For finite, strict lists, one can of course just check if the list
is ordered in linear time and use fromAscList if that is the case.
The same argument about ordered lists apply to the Map module. In addition, it would be nice if there were a variant of Map.keys that returns a set of keys, since the invariant that the keys are ascending and distinct may easily get lost, if not captured by the Set type.
That seems a good thing. Let's add it.

A straight forward implementation is:

Map.keySet = Set.fromDistinctAscList . Map.keys

The use of Set.fromDistinctAscList is safe in this case, but - alas - Map needs to import Set. (But maybe there is even a faster implementation of Map.keySet that exploits the internal representation.)
Yes, we could do that -- but the circular dependency is terrible, and a wrapper 
module
would need to look at the internal representation of Map/Set :-(
-- Daan.

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


[Haskell] Consultant directory

2004-03-11 Thread Mark T.B. Carroll
I was wondering if it might be a good idea to build up some list of clever
Haskell people who would be happy to do consultancy work on advanced
techniques. Something along the lines of name, location, contact
information, special expertise. I know that there are a couple of
companies out there who are willing to do that sort of thing, but
sprinkled among university faculty, etc. there must be a whole lot more
people out there, often with quite unique expertise regarding how to bend
Haskell to various problem domains, who are willing to help out
interesting projects but not as their full-time job. Of course, who might
volunteer to compile and maintain such a list is another matter, even if
it's thought to be a good idea. (-: Perhaps, collating the information
would most naturally be part of the HCA report compilation process, then
it could just be copied to a separate web page too.

-- Mark (inventing work for people again)
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] What is the best way to write adapters?

2004-03-11 Thread Ben_Yu




Hi,

I have a class:

class Sig a where
  getName :: a - Id
  getParents :: a - [TypeExp]
  getMethods :: a - [MethodDef]
  getFields :: a - [FieldDef]

and a few data structures that are instances of Sig.

They are ClassDef, ProtocolDef, SignatureDef, etc.

Now I have a type Def defined as:

data Def = DefClass ClassDef | DefProtocol ProtocolDef | DefSignature
Signature

And I want to make Def also an instance of Sig.

The code is currently like this:

instance Sig Def where
  getName (DefClass c) = getName c
  getName(DefProtocol p) getName p
  getName(DefSignature s) = getName s
  getParents(DefClass c) = getParents c
  getParents(DefProtocol p) = getParents p
blah blah blah...

But this seems very annoying.

If I have 4 different constructors in Def, and 5 methods of class Sig,
(Please bear with me if I'm using some OO terminology because I'm still a
new FP programmer), I'll have to write 4*5=20 forwarding functions.


I was trying to write something like:
getSig:: Sig a = Def - a
getSig (DefClass c) = c
getSig (DefProtocol p) = p
...

But this does not compile.


So, is there any nice way to save me from typing the x*y forwarding
functions?

Thanks!

Ben.


This message is intended only for the addressee and may contain information
that is confidential or privileged. Unauthorized use is strictly prohibited
and may be unlawful. If you are not the intended recipient, or the person
responsible for delivering to the intended recipient, you should not read,
copy, disclose or otherwise use this message, except for the purpose of
delivery to the addressee. If you have received this email in error, please
delete and advise us immediately.

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


[Haskell] What is the best way to write adapters?

2004-03-11 Thread oleg

 The code is currently like this:

 instance Sig Def where
   getName (DefClass c) = getName c
   getName(DefProtocol p) getName p
   getName(DefSignature s) = getName s
   getParents(DefClass c) = getParents c
   getParents(DefProtocol p) = getParents p
 blah blah blah...

 But this seems very annoying.

 If I have 4 different constructors in Def, and 5 methods of class Sig,
 (Please bear with me if I'm using some OO terminology because I'm still a
 new FP programmer), I'll have to write 4*5=20 forwarding functions.

Adapters seem by necessity higher-ranked functions. The following is
a stubefied code that uses generic adaptors (the function fwd).

 {-# OPTIONS -fglasgow-exts #-}
 module Foo where

 class Sig a where
   getName :: a - Int
   getParents :: a - String
   getMethods :: a - String

 data ClassDef = ClassDef
 data ProtocolDef = ProtocolDef

 instance Sig ClassDef where
 getName _ = 0
 getParents _ = ClassDef Parents
 getMethods _ = ClassDef Methods

 instance Sig ProtocolDef where
 getName _ = 1
 getParents _ = ProtocolDef Parents
 getMethods _ = ProtocolDef Methods

 data Def = DefClass ClassDef | DefProtocol ProtocolDef

 fwd::(forall a. Sig a = a - w) - Def - w
 fwd f (DefClass c) = f c
 fwd f (DefProtocol p) = f p

 instance Sig Def where
 getName = fwd getName
 getParents = fwd getParents
 getMethods = fwd getMethods

Tests:

*Foo getParents ClassDef
ClassDef Parents
*Foo getParents ProtocolDef
ProtocolDef Parents
*Foo getParents (DefClass ClassDef)
ClassDef Parents
*Foo getParents (DefProtocol ProtocolDef)
ProtocolDef Parents
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] What is the best way to write adapters?

2004-03-11 Thread Ben_Yu




Thanks! Oleg.

This works and it looks nice!

And now, my code can be like:

class FwdSig d where
  (forall a. Sig a = a - w) - d - w

All the types that supports such forwarding are instances of FwdSig.

My Def type is:

instance FwdSig Def where
  fwd f (ClassDef c) = f c
  fwd f (ProtDef p) = f p

instance Sig Def where
  getName = fwd getName
  getMethods = fwd getMethods
  ...

My Native type is:

instance FwdSig Native where
  fwd f (NativeSignature s) = f s
  fwd f (NativeProtocol p) = f p

instance Sig Native where
  getName = fwd getName
  getMethods = fwd getMethods
  ...

Many annoying forwarding functions are gone.

The only thing that I hope to be better is this getXXX = fwd getXXX piece
of code. Is it possible to reuse the same piece of code for both Native and
Def and any other possible types?

Inspired by your generic code, I wrote such thing:

instance FwdSig d = Sig d where
  getName = fwd getName
  getMethods = fwd getMethods
  ...

However, my ghc complains about the use of Sig d.

I followed its recommendation and put -fallow-undecidable-instances flag
with the surprise that the FwdSig d=Sig d instance declaration conflicts
with my other instance Sig XXX declarations.

Surely this is not a serious problem, I can live with repeating the
getXXX=fwd getXXX several times. Just curious about how further this can
go.

Ben.





[EMAIL PROTECTED]@haskell.org on 03/11/2004 01:36:30 PM

Please respond to [EMAIL PROTECTED]

Sent by:[EMAIL PROTECTED]


To:[EMAIL PROTECTED]
cc:[EMAIL PROTECTED]

Subject:[Haskell] What is the best way to write adapters?


 The code is currently like this:

 instance Sig Def where
   getName (DefClass c) = getName c
   getName(DefProtocol p) getName p
   getName(DefSignature s) = getName s
   getParents(DefClass c) = getParents c
   getParents(DefProtocol p) = getParents p
 blah blah blah...

 But this seems very annoying.

 If I have 4 different constructors in Def, and 5 methods of class Sig,
 (Please bear with me if I'm using some OO terminology because I'm still a
 new FP programmer), I'll have to write 4*5=20 forwarding functions.

Adapters seem by necessity higher-ranked functions. The following is
a stubefied code that uses generic adaptors (the function fwd).

 {-# OPTIONS -fglasgow-exts #-}
 module Foo where

 class Sig a where
   getName :: a - Int
   getParents :: a - String
   getMethods :: a - String

 data ClassDef = ClassDef
 data ProtocolDef = ProtocolDef

 instance Sig ClassDef where
 getName _ = 0
 getParents _ = ClassDef Parents
 getMethods _ = ClassDef Methods

 instance Sig ProtocolDef where
 getName _ = 1
 getParents _ = ProtocolDef Parents
 getMethods _ = ProtocolDef Methods

 data Def = DefClass ClassDef | DefProtocol ProtocolDef

 fwd::(forall a. Sig a = a - w) - Def - w
 fwd f (DefClass c) = f c
 fwd f (DefProtocol p) = f p

 instance Sig Def where
 getName = fwd getName
 getParents = fwd getParents
 getMethods = fwd getMethods

Tests:

*Foo getParents ClassDef
ClassDef Parents
*Foo getParents ProtocolDef
ProtocolDef Parents
*Foo getParents (DefClass ClassDef)
ClassDef Parents
*Foo getParents (DefProtocol ProtocolDef)
ProtocolDef Parents
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell





This message is intended only for the addressee and may contain information
that is confidential or privileged. Unauthorized use is strictly prohibited
and may be unlawful. If you are not the intended recipient, or the person
responsible for delivering to the intended recipient, you should not read,
copy, disclose or otherwise use this message, except for the purpose of
delivery to the addressee. If you have received this email in error, please
delete and advise us immediately.

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


Re: [Haskell] What is the best way to write adapters?

2004-03-11 Thread Brandon Michael Moore


On Thu, 11 Mar 2004 [EMAIL PROTECTED] wrote:

 Thanks! Oleg.

 This works and it looks nice!

 And now, my code can be like:

 class FwdSig d where
   (forall a. Sig a = a - w) - d - w

 All the types that supports such forwarding are instances of FwdSig.

 My Def type is:

 instance FwdSig Def where
   fwd f (ClassDef c) = f c
   fwd f (ProtDef p) = f p

 instance Sig Def where
   getName = fwd getName
   getMethods = fwd getMethods
   ...

 My Native type is:

 instance FwdSig Native where
   fwd f (NativeSignature s) = f s
   fwd f (NativeProtocol p) = f p

 instance Sig Native where
   getName = fwd getName
   getMethods = fwd getMethods
   ...

 Many annoying forwarding functions are gone.

 The only thing that I hope to be better is this getXXX = fwd getXXX piece
 of code. Is it possible to reuse the same piece of code for both Native and
 Def and any other possible types?

I'm not as handy with the type system as Oleg, but I can help out here.

The problem with your new instance is that if the compiler is trying to
see if Native is an instance of Sig, it can start with the declaration Sig
Native, or the declarations FwdSig a = Sig a, both of which could
potentially derive an instance of Sig Native.

Additionally passing the -fallow-overlapping-instances flag will permit
you to compile a program where instances overlap like this, and will
select the most specific matching instance (looking only at the head).
Your code is fine.

Brandon

 Inspired by your generic code, I wrote such thing:

 instance FwdSig d = Sig d where
   getName = fwd getName
   getMethods = fwd getMethods
   ...

 However, my ghc complains about the use of Sig d.

 I followed its recommendation and put -fallow-undecidable-instances flag
 with the surprise that the FwdSig d=Sig d instance declaration conflicts
 with my other instance Sig XXX declarations.

 Surely this is not a serious problem, I can live with repeating the
 getXXX=fwd getXXX several times. Just curious about how further this can
 go.

 Ben.


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


[Haskell] CFP: Haskell Workshop 2004

2004-03-11 Thread Henrik Nilsson
Please find enclosed the Call For Papers for the 2004 Haskell Workshop,
to be held on 22 September in Snowbird, Utah, USA in association with
ICFP'04.

My apologies for multiple copies.

Best regards,

/Henrik

-- 
Henrik Nilsson
School of Computer Science and Information Technology
The University of Nottingham
[EMAIL PROTECTED]2004 Haskell Workshop
   Snowbird, Utah, USA, 22 September, 2004

 http://www.cs.nott.ac.uk/~nhn/HW2004

   Call For Papers



The Haskell Workshop 2004 is intended to form part of the 2004 International
Conference on Functional Programming (ICFP) as an associated, ACM SIGPLAN
sponsored workshop. It has been accepted by the ICFP'04 workshop committee;
formal approval by the SIGPLAN executive committee is pending. Previous
Haskell Workshops have been held in La Jolla (1995), Amsterdam (1997), Paris
(1999), Montreal (2000), Firenze (2001), Pittsburgh (2002), and Uppsala
(2003).


    Scope

The purpose of the Haskell Workshop is to discuss experience with Haskell,
and possible future developments for the language. The scope of the workshop
includes all aspects of the design, semantics, theory, application, imple-
mentation, and teaching of Haskell. Topics of interest include, but are not
limited to, the following:

  Language Design
with a focus on possible extensions and modifications of Haskell as
well as critical discussions of the status quo;

  Theory
in the form of a formal treatment of the semantics of the present language
or future extensions, type systems, and foundations for program analysis
and transformation;

  Implementation Techniques
including program analysis and transformation, static and dynamic
compilation for sequential, parallel, and distributed architectures,
memory management as well as foreign function and component interfaces;

  Tool Support
in the form of profilers, tracers, debuggers, pre-processors, and so
forth;

  Applications, Practice, and Experience
with Haskell for scientific and symbolic computing, database, multimedia
and Web applications, and so forth as well as general experience with
Haskell in education and industry;

  Functional Pearls
being elegant, instructive examples of using Haskell.
  
Papers in the latter two categories need not necessarily report original
research results; they may instead, for example, report practical experience
that will be useful to others, re-usable programming idioms, or elegant new
ways of approaching a problem. The key criterion for such a paper is that it
makes a contribution from which other practitioners can benefit. It is not
enough simply to describe a program!

The programme committee welcomes short papers and may accept them for brief
presentation at the workshop.


  Submission Details 

Deadline for submission: 4 June, 2004
Notification of acceptance:  5 July, 2004
Final submission due:   30 July, 2004 (tentative)
Haskell Workshop:   22 September, 2004

Authors should submit papers in postscript format, formatted for A4 paper,
to Henrik Nilsson ([EMAIL PROTECTED]) by 4 June 2004. The length should be
restricted to the equivalent of 5000 words (which is approximately 12 pages
in ACM format). The papers will be published by the ACM and will appear in
the ACM Digital Library.

If you are interested in demonstrating a Haskell-related system or tool,
please send a brief demo proposal to Henrik Nilsson ([EMAIL PROTECTED]).


 Programme Committee 

Jörgen Gustavsson   Chalmers
Thomas Hallgren OGI
Jerzy Karczmarczuk  Université de Caen
Daan Leijen Universiteit Utrecht
Henrik Nilsson (chair)  University of Nottingham
Colin Runciman  University of York
Martin Sulzmann National University of Singapore
Valery Trifonov Yale University

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


Re: [Haskell] HaXml and XML Schema

2004-03-11 Thread Steffen Mazanek
Hello,

thank you for the references. Looks promising. I will read
it carefully.

A nice solution I really like was found by Alastair Reid. He
proposed to me (hope it is ok to cite this) the declaration:

data Salutation = [Either Char Name]

We think it will not scale well, too, however, it is elegant due
to its simplicity.

Bye and thx,
Steffen
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] Passing types as arguments

2004-03-11 Thread ajb
G'day everyone.

Some time ago a suggestion came up about passing types as arguments
to functions:

http://www.haskell.org/pipermail/haskell/2003-June/012184.html

As a matter of curiosity, the topic has come up again on the wiki:

http://haskell.org/hawiki/StudyGroup/GraphExamplesInHaskell/WhySum3

For this example, we don't just want to pass types, we also want to
pattern match on them.

I'm curious if anyone else has put any thought to this idea.  Is it just
a syntax issue, or are there bad interactions with other parts of the
type system?

Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe