RE: installHandler, sleep, and interrupts.

2001-10-30 Thread Simon Marlow

 When interrupting this program, the signal handler does not 
 get called:
 
 module Main where
 import Posix
 
 main = do
 installHandler 2 (Catch (putStrLn Hello, world!)) Nothing
 sleep 600
 -- putStr 

Try using Concurrent.threadDelay instead of Posix.sleep, since the
latter doesn't let other threads run while it is sleeping (it should do;
I'll fix this in my rewrite of Posix).

Cheers,
Simon

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



Re: Changed behaviour when reading from FIFOs!

2001-10-30 Thread Volker Stolz

On Mon, Oct 29, 2001 at 02:52:25PM -, Simon Marlow wrote:
  The blocking is essential since I need to be able to use MVars
  between the threadWaitRead  the hGetLine (remember the note I
  sent about fork()ing).
 
 Sorry, I can't remember that - could you remind me?  The hGetLine
 already blocks if there's no data in the FIFO, the extra threadWaitRead
 will only work if the Handle is in NoBuffering mode, because otherwise
 there might be data in the handle buffer waiting to be read which
 threadWaitRead would be unable to detect.

I'm using 'fork' (the real thing, not forkIO), in a Concurrent
Haskell programm and I need a way to lock out multiple readers
from the same file handle because of the sharing when forking.
-- 
Volker Stolz * [EMAIL PROTECTED] * PGP + S/MIME

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



RE: Small cosmetic bug

2001-10-30 Thread Simon Marlow


 I discovered a minor cosmetic bug today. After my
 undescribable hapiness about the fact that GHCi now has the
 :i command, I started playing around, and discovered the
 following ugly output:
 
   Prelude :i []
   -- [] is a data constructor
   [] :: forall t_12. [t_12]

Thanks, I've fixed this.

Cheers,
Simon

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



Re: Building GHC 5.02 on Solaris x86

2001-10-30 Thread Ian Lynagh


Thanks for your help Simon.

Unfortunately I think I have spent enough time on this, and not enough
on what I would like it for, without getting there - I may try again in
the future if the porting process becomes better documented/tested.


Ian


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



RE: ByteCodeLink.lookupIE PrelTup.Z73T{-72m-}

2001-10-30 Thread Simon Marlow

 Hi, I got the following error message:

___ ___ _
   / _ \ /\  /\/ __(_)
  / /_\// /_/ / /  | |  GHC Interactive, version 5.02, for Haskell 98.
 / /_\\/ __  / /___| |  http://www.haskell.org/ghc/
 \/\/ /_/\/|_|  Type :? for help.
 
 Loading package std ... linking ... done.
 Compiling FormulaType  ( FormulaType.hs, interpreted )
 Compiling Reqtypes ( Reqtypes.hs, interpreted )
 Compiling Reqparser( Reqparser.hs, interpreted )
 ghc-5.02: panic! (the `impossible' happened, GHC version 5.02):
   ByteCodeLink.lookupIE PrelTup.Z73T{-72m-}

GHC uses tuples in its internal translation of mutually recursive function groups.  In 
this case, there is a group of 73(!) mutually recursive functions, and the simplifier 
wasn't able to simplify away the tuple.  Since we don't have 73-tuples defined in the 
Prelude, the linker failed.

Ok, so what are we doing about this.  Well, the problem that prevented the simplifier 
from eliminating the tuple has been fixed, so 5.02.1 will work with this code.  The 
underlying problem, namely that the compiler generates references to out-of-range 
tuples, probably won't be fixed in time for 5.02.1, but we're looking into it.

Thanks for the report.

Cheers,
Simon

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



RE: installHandler, sleep, and interrupts.

2001-10-30 Thread Anders Lau Olsen


I later ran into another problem that may or may not be related with the
first. This is the program I am running:

module Main where
import Posix

main = do
installHandler sigCONT (Catch (putStrLn - resumed -)) Nothing
forever $ do
c - getChar
putChar c

forever = sequence_ . repeat

This is the output from a conversation with the shell:

% ./program 
[2] 8959
[2]  + Suspended (tty input) ./program
% fg
./program
a
a
b
b
c
c
d
d
e
e- resumed -

The handler is run not shortly after the signal is received, but only
after a sufficient amount of I/O or processing has been done by the main
process.

Anders Lau Olsen


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



RE: ghc --make feature request

2001-10-30 Thread Simon Peyton-Jones

| Note that in GHC, the version number of a function can 
| often change for hard-to-spot reasons.  You just need to 
| change (for example) the strictness properties of the 
| function, which can be very easy to do when making changes to 
| your code.  The compiler cares about (much) more than just 
| the types of imported objects.  I tend to expect recompiles 
| whenever something depends on a function I've changed, even 
| if I don't think the changes were very significant.

But you get many many fewer such unexpected changes when
you do not use -O or (I believe) when you use ghci.   Reason:
without -O ghc exports only type info across module boundaries.

So I'd still
like to understand why Martin is seeing so much recompilation.

S

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



Re: ghc compiled program crashes

2001-10-30 Thread Sven Eric Panitz


 From: Julian Seward (Intl Vendor) [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 X-OriginalArrivalTime: 30 Oct 2001 09:55:44.0099 (UTC) 
FILETIME=[0A82EB30:01C16129]



 Sven

 | from time to time ghc compiled programs simply crash on
 | my windows2000 without any meaningfull error message. I guess 
 | this has something to do with storage management (I vaguely 
 | remember having read something about errors durcing gc on 
 | this list, but did not find the corresponding posts in the archive).

 ghc-5.02 has a known bug on Win32 only, which causes all
 programs compiled with it to die silently when the heap size
 reaches 128 megabytes.  This is fixed in the upcoming 5.02.1.

 You did not say what version ghc you are using or give any
 other details.  If you tell us more we might be able to help
 more.

 J


Sorry that I was not more specific in my previous mail. Yes, it is
the known bug of heaps larger than 128m on Windows. Simon M. 
helped me to figure that out yesterday evening.

Thanks to both of you

Sven Eric



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



Re: problem definind a function

2001-10-30 Thread Andre W B Furtado

The following code works...

 = \x y - (x+y - length [1..(gcd x y)] = round (((fromIntegral
x)+1)/2) )

-- Andre


 hello,

 Does anybody know why it is not possible to define the folowing function
 in ghc?

 = \x y - (x+y - length [1..(gcd x y)] = round ((x+1)/2)) )

 The message obtained was this one:

 No instance for (RealFrac Int)
 arising from use of `round' at num-s-divs.hs:253
 In the second argument of `(=)', namely `round ((x + 1) / 2)'
 In a lambda abstraction:
 (((x + y) - (length [1 .. (gcd x y)])) = (round ((x + 1) / 2)))

 Thanks in advance,

 J. I. GarcĂ­a

 ___
 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: functor

2001-10-30 Thread Frank Atanassow

Wolfgang Jeltsch wrote (on 29-10-01 23:43 +0100):
 you cannot use sections with types and (-). Furthermore the variable must 
 begin with a lowercase letter. So you have to write
 instance Functor (-) a where.

Erp, I said that the Functor class has arity *. Actually, it has arity 1
(i.e., it is a unary relation on types), with the argument being of kind
*-*. This is one of the infelicities of the class system.

-- 
Frank Atanassow, Information  Computing Sciences, Utrecht University
Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands
Tel +31 (030) 253-3261 Fax +31 (030) 251-379

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



varying number of arguments restriction

2001-10-30 Thread Hal Daume

I'm curious why the following code is invalid (from a language design
point of view):

 foo :: [(Int, String)] - String
 foo [] = 
 foo = snd . head

ghc complains:

Varying number of arguments for function `foo'

I don't understand why this should be invalid?  Basically, as I read
it, I say, well, for a parameter s, calling foo s:

does s match [] ?  if so, return  otherwise, try the next definition
of foo (which must match in this case).

obviously i can rewrite:

foo [] = 
foo s  = (snd . head) s

but this is uglier.

 - hal

-- 
Hal Daume III

 Computer science is no more about computers| [EMAIL PROTECTED]
  than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume

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



Re: varying number of arguments restriction

2001-10-30 Thread Ashley Yakeley

At 2001-10-30 11:01, Hal Daume wrote:

obviously i can rewrite:

foo [] = 
foo s  = (snd . head) s

but this is uglier.

I'm not sure. I actually prefer it written out so that the number of 
arguments in the cases matches (as GHC enforces).

-- 
Ashley Yakeley, Seattle WA


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



Re: varying number of arguments restriction

2001-10-30 Thread Brian Boutel

Ashley Yakeley wrote:
 
 At 2001-10-30 11:01, Hal Daume wrote:
 
 obviously i can rewrite:
 
 foo [] = 
 foo s  = (snd . head) s
 
 but this is uglier.
 
 I'm not sure. I actually prefer it written out so that the number of
 arguments in the cases matches (as GHC enforces).
 

It's defined in the Report, not a GHC idiosyncracy. As to why, I don't
really remember, but I suspect it had to do with a desire by some
members of the Haskell Committee to require that the patterns in all
clauses of a function binding were disjoint, so that reasoning about
programs could deal with each clause independently. This was not
adopted, and the alternative top-to-bottom, left-to-right, semantics
were, but there was still a feeling that good style demanded
disjointness.

In that style, the second clause could be written

foo ((x,y):xs) = y

I don't know whether this is still true, but it used to be argued that
this was likely to be more efficient because compilers could produce
really good pattern-matching code.

--brian

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



Vim syntax files for .lhs files using \begin{code} and \end{code}

2001-10-30 Thread Nicholas Nethercote

Hi,

The Vim syntax file for literate Haskell programs handles code lines that
begin with a '' character fine.  But in GHC much of the code is defined
between \begin{code} and \end{code} pairs, and that shows up as one
giant comment.

Does anybody know where I might be able to obtain a Vim syntax file that
handles these constructs?  I made a feeble attempt myself, but Vim's
syntax highlighting language defeated me.

Thanks.
--
Nick Nethercote
[EMAIL PROTECTED]



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



Re: Vim syntax files for .lhs files using \begin{code} and \end{code}

2001-10-30 Thread Max Kirillov

Hi.

That's my hacked syntax files

Max.

On Tue, Oct 30, 2001 at 02:22:07PM +, Nicholas Nethercote wrote:
 Hi,
 
 The Vim syntax file for literate Haskell programs handles code lines that
 begin with a '' character fine.  But in GHC much of the code is defined
 between \begin{code} and \end{code} pairs, and that shows up as one
 giant comment.
 
 Does anybody know where I might be able to obtain a Vim syntax file that
 handles these constructs?  I made a feeble attempt myself, but Vim's
 syntax highlighting language defeated me.
 
 Thanks.
 --
 Nick Nethercote
 [EMAIL PROTECTED]
 
 
 
 ___
 Haskell-Cafe mailing list
 [EMAIL PROTECTED]
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 Vim syntax file
 Language: Haskell
 Maintainer:   John Williams [EMAIL PROTECTED]
 Last Change:  2001 May 10
 Thanks to Ryan Crumley for suggestions and John Meacham for
 pointing out bugs.

 Options-assign a value to these variables to turn the option on:

 hs_highlight_delimiters - Highlight delimiter characters--users
   with a light-colored background will
   probably want to turn this on.
 hs_highlight_boolean - Treat True and False as keywords.
 hs_highlight_types - Treat names of primitive types as keywords.
 hs_highlight_more_types - Treat names of other common types as keywords.
 hs_highlight_debug - Highlight names of debugging functions.

 Remove any old syntax stuff hanging around
if version  600
  syn clear
elseif exists(b:current_syntax)
  finish
endif

 (Qualified) identifiers (no default highlighting)
syn match ConId \(\[A-Z][a-zA-Z0-9_']*\.\)\=\[A-Z][a-zA-Z0-9_']*\
syn match VarId \(\[A-Z][a-zA-Z0-9_']*\.\)\=\[a-z][a-zA-Z0-9_']*\

 Infix operators--most punctuation characters and any (qualified) identifier
 enclosed in `backquotes`. An operator starting with : is a constructor,
 others are variables (e.g. functions).
syn match hsVarSym 
\(\[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%\*\+/=\?@\\^|~.][-!#$%\*\+/=\?@\\^|~:.]*
syn match hsConSym \(\[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%\*\+./=\?@\\^|~:]*
syn match hsVarSym `\(\[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`
syn match hsConSym `\(\[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`

 Reserved symbols--cannot be overloaded.
syn match hsDelimiter  (\|)\|\[\|\]\|,\|;\|_\|{\|}

 Strings and constants
syn match   hsSpecialChar  contained 
\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\\\'\\abfnrtv]\|^[A-Z^_\[\\\]]\)
syn match   hsSpecialChar  contained 
\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)
syn match   hsSpecialCharError contained \\\|'''\+
syn region  hsString   start=++  skip=+\|\\+  end=++  
contains=hsSpecialChar
syn match   hsCharacter[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'lc=1 
contains=hsSpecialChar,hsSpecialCharError
syn match   hsCharacter^'\([^\\]\|\\[^']\+\|\\'\)' 
contains=hsSpecialChar,hsSpecialCharError
syn match   hsNumber   \[0-9]\+\\|\0[xX][0-9a-fA-F]\+\\|\0[oO][0-7]\+\
syn match   hsFloat\[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\

 Keyword definitions. These must be patters instead of keywords
 because otherwise they would match as keywords at the start of a
 literate comment (see lhs.vim).
syn match hsModule  \module\
syn match hsImport  \import\.*he=s+6 contains=hsImportMod
syn match hsImportMod   contained \\(as\|qualified\|hiding\)\
syn match hsInfix   \\(infix\|infixl\|infixr\)\
syn match hsStructure   \\(class\|data\|deriving\|instance\|default\|where\)\
syn match hsTypedef \\(type\|newtype\)\
syn match hsStatement   \\(do\|case\|of\|let\|in\)\
syn match hsConditional \\(if\|then\|else\)\

 Not real keywords, but close.
if exists(hs_highlight_boolean)
   Boolean constants from the standard prelude.
  syn match hsBoolean \\(True\|False\)\
endif
if exists(hs_highlight_types)
   Primitive types from the standard prelude and libraries.
  syn match hsType 
\\(Int\|Integer\|Char\|Bool\|Float\|Double\|IO\|Void\|Addr\|Array\|String\)\
endif
if exists(hs_highlight_more_types)
   Types from the standard prelude libraries.
  syn match hsType 
\\(Maybe\|Either\|Ratio\|Complex\|Ordering\|IOError\|IOResult\|ExitCode\)\
  syn match hsMaybe\Nothing\
  syn match hsExitCode \\(ExitSuccess\)\
  syn match hsOrdering \\(GT\|LT\|EQ\)\
endif
if exists(hs_highlight_debug)
   Debugging functions from the standard prelude.
  syn match hsDebug \\(undefined\|error\|trace\)\
endif


 Comments
syn match   hsLineComment  --.*
syn region  hsBlockComment start={-  end=-} contains=hsBlockComment
syn region  hsPragma   start={-# end=#-}

 Literate comments--any line not starting with '' is a comment.
if exists(b:hs_literate_comments)
  syn region  hsLiterateComment   start=^ end=^
endif

if exists(b:hs_literate_tex_comments)
  syn region  

Re: What does this error message mean

2001-10-30 Thread Richard Watson

At 9:38pm on Oct 30, 2001, [EMAIL PROTECTED] wrote:

 My (current) problem lies in whatPic, which returns the error
 Program error: {whatPic Facing2_North (1,6)}
 if I type in
 whatPic North (1,6)
 or just call it through the draw2 function (which is supposed to be the
 main drawing function, and it actually works.. Well it did yesterday until
 I did something :D

The problem is in whatPic.
Messages like
   Program error: {whatPic Facing2_North (1,6)}
say that there is no matching function RHS for the arguments
specified.

In your case the arguments did match the patterns specified in
whatPic, but neither of the two function guards was true.

Try this to check:

whatPic :: Facing2 - (Int,Int) - Pic
whatPic facin (x,y) | corridorType facin (x,y) == (2, rTurn1) = corrl_1
| corridorType facin (x,y) == (2, rTurn2) = corrl_2
| otherwise = error whatPic: cases exhausted



-- Richard


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



Some more news about DM-haskell..

2001-10-30 Thread Anders Elfgren


Hehe sure :) If I DO finish it that is :)

It should actually be close to being at the state where I just have to add
different images and when to display them. Then I need to work on some
kind of function to allow it to take 'w','s','n'and 'e' as input, or if I
can, the arrow keys.

Btw, I see that when I hit reply in Pine I only send to the person that
sent me the mail, not the whole list, so I'm going to make an alias for
it.

For those of you that don't know, I've managed to find the problem with
the help of some fellow members of this list :)


On Tue, 30 Oct 2001, Andre W B Furtado wrote:

 Will you release your game when it is done? It seems very interesting and I
 woud like to check how it will look like...
 
 -- Andre


PS. Andre, there's a.. um.. game I guess, for Linux called Text-mode
Quake. Search for it on www.google.com and you should find something
interesting :D



-
Anders Elfgren  || AKA: Srekel and Farfar
Homepage: http://hem.passagen.se/srekel || Alt email: [EMAIL PROTECTED] 
ICQ: 4596105|| AIM: Srekel
- Kaka e gott   || - Cs e halva mitt liv
-



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