Re: Terminal does not reset correctly with System.Console.SimpleLineEditor

2004-11-07 Thread Malcolm Wallace
Einar Karttunen [EMAIL PROTECTED] writes:

 It appears that the console is not reset correctly with
 System.Console.SimpleLineEditor. The terminal does not 
 echo characters until it is reset. 

The issue here is the order in which the library makes calls to
hSetBuffering and system(stty icanon echo) to reset the terminal.
For ghc-6, they are in the wrong order, although for nhc98 and ghc-5,
the order doesn't matter.  Hence, a simple fix is to swap these calls
over, as I have just done in CVS.

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


typechecking too eager?

2004-11-07 Thread Keean Schupke
The following code should compile (If the constructor
is valid, so is the function):
data Test = Test (forall a . a)
test a = Test a
However this fails to compile with the following error:
Test.hs:9:9:
   Inferred type is less polymorphic than expected
 Quantified type variable `a' escapes
 It is mentioned in the environment:
   test :: a - Test (bound at Test.hs:9:0)
   a :: a (bound at Test.hs:9:5)
   In the first argument of `Test', namely `a'
   In the definition of `test': test a = Test a
I think this should only generate an error once the value of
'a' is known not to be undefined.
   Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: typechecking too eager?

2004-11-07 Thread Andres Loeh
Hi there,

 The following code should compile (If the constructor
 is valid, so is the function):
 
 data Test = Test (forall a . a)
 test a = Test a
 
 However this fails to compile with the following error:

The current implementation of rank-n polymorphism
(which is documented in the paper Pratical type inference
for arbitrary-rank types) does not guess polymorphic
types for lambda-abstracted values.

In this situation, this means that the variable a
is assumed to have a monorphic type, which then cannot
be passed to Test as an argument.

Knowledge about polymorphism is passed down/inwards,
but not up/outwards.

This definition typechecks only if you add a type
signature:

test :: (forall a . a) - Test

If you want to know the reasons, read the paper. It explains
the problems very well.

Cheers,
  Andres

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


Re: typechecking too eager?

2004-11-07 Thread Keean Schupke
So, does that mean that ideally we would like it to type
check, but for implementation reasons it cannot easily
be done without a type signature?
I can use the type signature no problem.
   Keean.
Andres Loeh wrote:
Hi there,
 

The following code should compile (If the constructor
is valid, so is the function):
data Test = Test (forall a . a)
test a = Test a
However this fails to compile with the following error:
   

The current implementation of rank-n polymorphism
(which is documented in the paper Pratical type inference
for arbitrary-rank types) does not guess polymorphic
types for lambda-abstracted values.
In this situation, this means that the variable a
is assumed to have a monorphic type, which then cannot
be passed to Test as an argument.
Knowledge about polymorphism is passed down/inwards,
but not up/outwards.
This definition typechecks only if you add a type
signature:
test :: (forall a . a) - Test
If you want to know the reasons, read the paper. It explains
the problems very well.
Cheers,
 Andres
 

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


foreign export stdcall on user-defined type and function

2004-11-07 Thread David Lo
Dear all,

I'm new in haskell. I'm assigned to see that a piece of Haskell code
need to be callable from C#. I find that I can convert Haskell to DLL
using ghc --mk-dll.

I find it is fine for simple function but for the following errors are
reported.

foreign export stdcall doComp :: Pattern - CString - IO ()
doComp :: Pattern - CString - IO ()

foreign export stdcall evalDisplay :: RealFrac a = CString -
(Int-VMC (Maybe a)) - IO ()
evalDisplay :: RealFrac a = CString - (Int-VMC (Maybe a)) - IO ()

The errors are as follows:

Compiling Main ( CPL.hs, interpreted )

CPL.hs:29:
Unacceptable argument type in foreign declaration:
forall a b c. (Ind a c, Compare c b) = Pat a b
When checking declaration:
foreign export stdcall doComp doComp :: Pattern- CString - IO ()

CPL.hs:107:
Unacceptable argument type in foreign declaration: {RealFrac a}
When checking declaration:
foreign export stdcall evalDisplay evalDisplay :: forall a. (RealFrac
a) = CString- (Int - VMC (Maybe a)) - IO ()

CPL.hs:107:
Unacceptable argument type in foreign declaration:
Int - VMC (Maybe a)
When checking declaration:
foreign export stdcall evalDisplay evalDisplay :: forall a. (RealFrac
a) =CString- (Int - VMC (Maybe a)) - IO ()

I would like to inquire on how to use foreign function stdcall on self
defined data structure and function. Can I just simply cast them to
string ?

Thank you in advance for your help and attention.

Best Regards,

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