Readline on Windows?

2004-11-22 Thread Koen Claessen
Hi,

Compiling the following program (Bug.hs):


module Main where

import System.Console.Readline

main =
  do ms - readline Hi 
 print ms


Using GHC 6.2.2 on Windows XP, using the command line:

  ghc --make Bug -o bug

Produces the following message:


Chasing modules from: Bug
Compiling Main ( Bug.hs, Bug.o )
Linking ...
c:/ghc/ghc-6.2.2/libHSreadline.a(Readline__96.o)(.text+0xaa):ghc11748.hc:
undefined reference to `readline'


Tried linking by hand (not using --make), specifying
-package readline, specifying -lreadline; nothing worked.

/Koen

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


Derivable type classes bug?

2004-11-22 Thread Koen Claessen
Hi,

Take a look at the following program, making use of
derivable type classes.


module Bug where

import Data.Generics

class Foo a where
  foo :: a - Int
  foo{| Unit |}_ = 1
  foo{| a :*: b |} _ = 2
  foo{| a :+: b |} _ = 3

instance Foo [a]


GHC 6.2.2 produces the following error message:


Bug.hs:12:
Could not deduce (Foo a) from the context (Foo [a])
  arising from use of `foo' at Bug.hs:12


Why is the context needed? 'foo' is not a recursive
function?

I guess it is because the default declaration is split up
into several instances:


instance Foo Unit where
  foo _ = 1

instance (Foo a, Foo b) = Foo (a :*: b) where
  foo _ = 2

instance (Foo a, Foo b) = Foo (a :+: b) where
  foo _ = 3


Why not generating:


instance Foo Unit where
  foo _ = 1

instance Foo (a :*: b) where
  foo _ = 2

instance Foo (a :+: b) where
  foo _ = 3


when the context is not needed?

(My motivation is: I have a class like this:

  class Arbitrary a = Shrink a where
shrinkSub :: a - [a]
shrinkSub{| ... |} = ... shrink ...

The definition of shrinkSub is not recursive, it calls a
function 'shrink' from the Arbitrary class instead.)

Regards,
/Koen

PS. Has the implementation of Generics changed from some
earlier compiler version (GHC 5.xx)? I have code lying
around that I am almost certain of used to compile with an
earlier version of GHC (that I do not have access to
anymore).


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


[ ghc-Bugs-1069656 ] ghc-ghci inconsisteny

2004-11-22 Thread SourceForge.net
Bugs item #1069656, was opened at 2004-11-19 19:57
Message generated for change (Settings changed) made by simonmar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1069656group_id=8032

Category: None
Group: None
Status: Closed
Resolution: None
Priority: 5
Submitted By: Nightmare (goronsf)
Assigned to: Nobody/Anonymous (nobody)
Summary: ghc-ghci inconsisteny

Initial Comment:
The following program has different semantics in ghc
and ghci. 

main = do putStrLn something
  putStr something else 

It's the linebuffering. NoLineBuffering should be used
on expressions without side-effects. 

So 5*5 should print immediately, and do putStrLn
something should behave the same in both
applications. How doesn't matter that much to me, but
they should be the same. 

--

Comment By: Simon Marlow (simonmar)
Date: 2004-11-22 13:30

Message:
Logged In: YES 
user_id=48280

Buffering of the standard handles does indeed differ in GHCi 
compared to GHC.  The behaviour is a compromise: you don't 
want NoBuffering by default for stdout in a compiled program, 
because it would be too slow.  You probably *do* want 
NoBuffering in an interactive environment, however, because 
you want interactivity.

So, unless we hear from lots of people who want this to 
change, it'll stay as is.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1069656group_id=8032
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: Derivable type classes bug?

2004-11-22 Thread Simon Peyton-Jones
Yes, you guessed right.  Your generic class declaration gives rise to
instance declarations like

| instance (Foo a, Foo b) = Foo (a :*: b) where
|   foo _ = 2

You suggest that it could be cleverer about guessing the context for the
instance decl, and that would make sense.  But this'd then be the *only*
time that the context of an instance decl was inferred, rather than
provided.  So (a) that's unusual (needs explanation etc), and (b) it'd
require some jiggling in the compiler, which is currently set up for
checking instance decls only.

An alternative, I guess, would be to ask the programmer to supply the
context for the instance decls.  But it's hard to see good syntax.  Were
would the context go in the class decl?

Another alternative could be for the programmer to give the
separated-out instance declarations himself, rather than having them
grouped in the class decl.  But we'd still need some way to signal that
the method should be generated generically. Something like

class Foo a where
  foo :: a - Int 
  generic foo   -- New keyword

instance Foo Unit where ...
instance Foo (a :+: b) where ...
etc

Signalling generic-ness like this could even allow generic-ness on a
method-by-method basis.  Kind of like specifying the default method.  I
don't want to eat another keyword, though.  And somehow it'd be better
if the same signal happened for the current case.  But
class Foo a where
  foo :: a - Int
  generic foo
  foo {| Unit |} = ...
seems rather heavy.   

So the possibilities are:

(A).  Infer the instance context.
(B).  Somehow specify the instance contexts in the class decl
(C).  Optionally, give separate instances for Unit, :+: etc, plus a
signal
in the class decl the default method is generic.  Syntax?

I think my preferences would go (C), (A), (B); if we could agree a
syntax for (C).  

Does anyone else have a (somewhat informed) opinion?

Simon

| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of Koen Claessen
| Sent: 16 November 2004 17:17
| To: [EMAIL PROTECTED]
| Subject: Derivable type classes bug?
| 
| Hi,
| 
| Take a look at the following program, making use of
| derivable type classes.
| 
| 
| module Bug where
| 
| import Data.Generics
| 
| class Foo a where
|   foo :: a - Int
|   foo{| Unit |}_ = 1
|   foo{| a :*: b |} _ = 2
|   foo{| a :+: b |} _ = 3
| 
| instance Foo [a]
| 
| 
| GHC 6.2.2 produces the following error message:
| 
| 
| Bug.hs:12:
| Could not deduce (Foo a) from the context (Foo [a])
|   arising from use of `foo' at Bug.hs:12
| 
| 
| Why is the context needed? 'foo' is not a recursive
| function?
| 
| I guess it is because the default declaration is split up
| into several instances:
| 
| 
| instance Foo Unit where
|   foo _ = 1
| 
| instance (Foo a, Foo b) = Foo (a :*: b) where
|   foo _ = 2
| 
| instance (Foo a, Foo b) = Foo (a :+: b) where
|   foo _ = 3
| 
| 
| Why not generating:
| 
| 
| instance Foo Unit where
|   foo _ = 1
| 
| instance Foo (a :*: b) where
|   foo _ = 2
| 
| instance Foo (a :+: b) where
|   foo _ = 3
| 
| 
| when the context is not needed?
| 
| (My motivation is: I have a class like this:
| 
|   class Arbitrary a = Shrink a where
| shrinkSub :: a - [a]
| shrinkSub{| ... |} = ... shrink ...
| 
| The definition of shrinkSub is not recursive, it calls a
| function 'shrink' from the Arbitrary class instead.)
| 
| Regards,
| /Koen
| 
| PS. Has the implementation of Generics changed from some
| earlier compiler version (GHC 5.xx)? I have code lying
| around that I am almost certain of used to compile with an
| earlier version of GHC (that I do not have access to
| anymore).
| 
| 
| ___
| Glasgow-haskell-bugs mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1071030 ] internal error: update_fwd: unknown/strange object 12238336

2004-11-22 Thread SourceForge.net
Bugs item #1071030, was opened at 2004-11-22 15:45
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1071030group_id=8032

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Gour (ggd)
Assigned to: Nobody/Anonymous (nobody)
Summary: internal error: update_fwd: unknown/strange object  12238336

Initial Comment:
Hi! 
 
In my attempt to emerge i.e. compile gtk2hs on amd64 
arch, I've encountered the following problem: 
 
[..] 
../c2hs/c2hs -C-D__signed=signed 
-C-D__GLASGOW_HASKELL__=602 +RTS -H180m 
-M350m-RTS -C-I/usr/include/glib-2.0 
-C-I//usr/lib/glib-2.0/include -C-I/usr/include/gtk-2.0 
-C-I//usr/lib/gtk-2.0/include -C-I/usr/X11R6/include 
-C-I/usr/include/pango-1.0 -C-I/usr/include/freetype2 
-C-I/usr/include/atk-1.0 
-iabstract:buttons:display:entry:general:layout:menuComboToolbar:misc:multiline:ornaments:scrolling:selectors:treeList:windows:gdk:glib:pango:../compat:embedding
  
-o : gtk/gtk.h general/Hierarchy.chs general/Signal.chs 
glib/GValue.chs glib/GList.chs glib/GObject.chs 
pango/PangoTypes.chs treeList/TreeModel.chs 
treeList/TreeViewColumn.chs multiline/TextIter.chs 
gdk/Region.chs abstract/Bin.chs abstract/Box.chs 
abstract/ButtonBox.chs abstract/Container.chs 
abstract/FileChooser.chs abstract/Misc.chs 
abstract/Object.chs abstract/Paned.chs 
abstract/Range.chs abstract/Scale.chs 
abstract/Widget.chs buttons/Button.chs 
buttons/CheckButton.chs buttons/RadioButton.chs 
buttons/ToggleButton.chs display/AccelLabel.chs 
display/Image.chs display/Label.chs 
display/ProgressBar.chs display/Statusbar.chs 
entry/Editable.chs entry/Entry.chs 
entry/EntryCompletion.chs entry/HScale.chs 
entry/SpinButton.chs entry/VScale.chs 
general/Enums.chs general/General.chs 
general/IconFactory.chs general/Style.chs 
layout/Alignment.chs layout/AspectFrame.chs 
layout/Expander.chs layout/Fixed.chs layout/HBox.chs 
layout/HButtonBox.chs layout/HPaned.chs 
layout/Layout.chs layout/Notebook.chs 
layout/Table.chs layout/VBox.chs 
layout/VButtonBox.chs layout/VPaned.chs 
menuComboToolbar/CheckMenuItem.chs 
menuComboToolbar/ComboBox.chs 
menuComboToolbar/ComboBoxEntry.chs 
menuComboToolbar/Combo.chs 
menuComboToolbar/ImageMenuItem.chs 
menuComboToolbar/MenuBar.chs 
menuComboToolbar/Menu.chs 
menuComboToolbar/MenuItem.chs 
menuComboToolbar/MenuShell.chs 
menuComboToolbar/OptionMenu.chs 
menuComboToolbar/RadioMenuItem.chs 
menuComboToolbar/TearoffMenuItem.chs 
menuComboToolbar/Toolbar.chs 
menuComboToolbar/ToolItem.chs misc/Adjustment.chs 
misc/Calendar.chs misc/DrawingArea.chs 
misc/EventBox.chs misc/FileChooserWidget.chs 
misc/GArrow.chs misc/HandleBox.chs 
misc/SizeGroup.chs misc/Tooltips.chs misc/Viewport.chs 
multiline/TextBuffer.chs multiline/TextMark.chs 
multiline/TextTag.chs multiline/TextTagTable.chs 
multiline/TextView.chs ornaments/Frame.chs 
ornaments/HSeparator.chs ornaments/VSeparator.chs 
scrolling/HScrollbar.chs scrolling/ScrolledWindow.chs 
scrolling/VScrollbar.chs selectors/ColorSelection.chs 
selectors/ColorSelectionDialog.chs 
selectors/FontSelection.chs 
selectors/FontSelectionDialog.chs 
treeList/CellRendererPixbuf.chs 
treeList/CellRendererText.chs 
treeList/CellRendererToggle.chs treeList/ListStore.chs 
treeList/TreeModelSort.chs treeList/TreeSelection.chs 
treeList/TreeStore.chs treeList/TreeView.chs 
windows/Dialog.chs windows/FileChooserDialog.chs 
windows/FileSel.chs windows/Window.chs 
gdk/Drawable.chs gdk/GC.chs gdk/Gdk.chs 
gdk/GdkEnums.chs gdk/Keys.chs gdk/Pixbuf.chs 
glib/GError.chs glib/GType.chs glib/GValueTypes.chs 
pango/PangoLayout.chs pango/Rendering.chs 
embedding/Plug.chs embedding/Socket.chs 
c2hs: internal error: update_fwd: unknown/strange 
object  12238336 
Please report this as a bug to 
[EMAIL PROTECTED], 
or http://www.sourceforge.net/projects/ghc/ 
/bin/sh: /bin/sed s/\(.*\)\.chs/\1.hs/: No such file or 
directory 
removing 
make[1]: *** [compile] Error 1 
make[1]: Leaving directory 
`/var/tmp/portage/gtk2hs-0.9.6-r1/work/gtk2hs-0.9.6/gtk' 
make: *** [make-all] Error 1 
 
 
I'm on Gentoo amd64 with dev-lang/ghc-6.2.2-r1. 
 
gaura-nitai gtk2hs # uname -a 
Linux gaura-nitai 2.6.9-gentoo-r1 #23 SMP Mon Nov 15 
21:51:39 CET 2004 x86_64 AMD Athlon(tm) 64 
Processor 3000+ AuthenticAMD GNU/Linux 
 
Sincerely, 
Gour 
 

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1071030group_id=8032
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: Readline on Windows?

2004-11-22 Thread Simon Marlow
On 16 November 2004 17:16, Koen Claessen wrote:

 Compiling the following program (Bug.hs):
 
 
 module Main where
 
 import System.Console.Readline
 
 main =
   do ms - readline Hi 
  print ms
 
 
 Using GHC 6.2.2 on Windows XP, using the command line:
 
   ghc --make Bug -o bug
 
 Produces the following message:
 
 
 Chasing modules from: Bug
 Compiling Main ( Bug.hs, Bug.o )
 Linking ...

c:/ghc/ghc-6.2.2/libHSreadline.a(Readline__96.o)(.text+0xaa):ghc11748.hc
:
 undefined reference to `readline'
 

Sigbjorn describes how to fix this bug here:

http://www.haskell.org/pipermail/glasgow-haskell-users/2004-November/007
370.html

I'll add the information to the FAQ.

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