RE: Problem with lexically scoped type variables.

2006-10-03 Thread Simon Peyton-Jones
:05 | To: Simon Peyton-Jones | Cc: glasgow-haskell-users@haskell.org | Subject: Re: Problem with lexically scoped type variables. | | | Oh I see. Well, you'd need to put the type annotation for s back in: | | t1 = runST ( (trav f [1..10] (1,52) = \ (s::STRef s (Set Int)) - seen | s

Problem with lexically scoped type variables.

2006-10-02 Thread Mirko Rahn
relax the rules for lexically scoped type variables a bit? Regards, Mirko Rahn -- -- Mirko Rahn -- Tel +49-721 608 7504 -- --- http://liinwww.ira.uka.de/~rahn/ --- ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http

Re: Problem with lexically scoped type variables.

2006-10-02 Thread Brian Hulley
Mirko Rahn wrote: In ghc-6.4.2 this works as expected, but ghc-6.5.20061001 says B.hs:40:44: A pattern type signature cannot bind scoped type variables `s' unless the pattern has a rigid type context Why are the rules for lexically scoped type variables so complicated? Could we

RE: Problem with lexically scoped type variables.

2006-10-02 Thread Simon Peyton-Jones
| Simon Peyton-Jones asks for programs that are broken by the proposed | change. Here is a nearly real world one: You may not like this but this should work: Instead of | t1 = runST (trav f [1..10] (1,52) = \ (s::STRef s (Set Int)) - seen s) try t1 = runST ( (trav f [1..10] (1,52) = \ s -

Re: Problem with lexically scoped type variables.

2006-10-02 Thread Mirko Rahn
Simon Peyton-Jones wrote: | t1 = runST (trav f [1..10] (1,52) = \ (s::STRef s (Set Int)) - seen s) try t1 = runST ( (trav f [1..10] (1,52) = \ s - seen s) :: forall s. ST s [Int] ) No, the problem is that t1 should use another implementation than t2. This version cannot

RE: Problem with lexically scoped type variables.

2006-10-02 Thread Simon Peyton-Jones
| | t1 = runST (trav f [1..10] (1,52) = \ (s::STRef s (Set Int)) - seen | s) | | try | | t1 = runST ( (trav f [1..10] (1,52) = \ s - seen s) | :: forall s. ST s [Int] ) | | No, the problem is that t1 should use another implementation than t2. | This version cannot discriminate

Re: Problem with lexically scoped type variables.

2006-10-02 Thread Mirko Rahn
Oh I see. Well, you'd need to put the type annotation for s back in: t1 = runST ( (trav f [1..10] (1,52) = \ (s::STRef s (Set Int)) - seen s) :: forall s. ST s [Int] ) ...and reach the starting point again. This version gives the same error message as the original one. But

RE: lexically-scoped type variables in GHC 6.6

2006-09-07 Thread Simon Peyton-Jones
| With reference to the documentation [about lexically scoped type variables] that just appeared in darcs: For the benefit of others, the draft 6.6 documentation is here http://www.haskell.org/ghc/dist/current/docs/users_guide/type-extensions .html#scoped-type-variables | Result type

Re: lexically-scoped type variables in GHC 6.6

2006-09-07 Thread Brian Hulley
Ross Paterson wrote: data T = forall a. MkT [a] k :: T - T k (forall a. MkT [t]) = MkT t3 where t3::[a] = [t,t,t] What was wrong with the example in the documentation? k :: T - T k (MkT [t::a]) = MkT t3 where t3::[a] = [t,t,t] The type of (t) is (a) -

Re: lexically-scoped type variables in GHC 6.6

2006-09-07 Thread Brian Hulley
see what the type variable is supposed to represent without having to track down the original data declaration. If the problem is that pattern type signatures normally have an implicit forall (which stops them introducing lexically scoped type variables), perhaps the implicit forall could

lexically-scoped type variables in GHC 6.6

2006-09-06 Thread Ross Paterson
With reference to the documentation that just appeared in darcs: Result type signatures are now equivalent to attaching the signature to the rhs, i.e. redundant. How about finishing the decoupling of type variable binding from pattern type signatures by introducing an (optional) pattern form

RE: Lexically scoped type variables

2006-02-06 Thread Simon Peyton-Jones
| -Original Message- | From: Christian Maeder [mailto:[EMAIL PROTECTED] | Sent: 02 February 2006 17:19 | To: Simon Peyton-Jones; GHC Users Mailing List | Subject: Re: Lexically scoped type variables | | | Simon Peyton-Jones wrote: | | I'm very interested to know whether you like it or hate

Re: Lexically scoped type variables

2006-02-06 Thread Christian Maeder
Simon Peyton-Jones wrote: I took a look. Here's a typical example: newVariableListFromSet :: Ord a = VariableSetSource a - VariableList a newVariableListFromSet (variableSetSource :: VariableSetSource a) = let attachListOp parallelX (listDrawer :: ListDrawer a pos) = do

RE: Lexically scoped type variables

2006-02-06 Thread Simon Peyton-Jones
| That was exactly my problem. How should I find out the type of | attachListOp (I have not written this bit of code)? Could I somehow ask | ghci-6.4.1 to do it for me? (Unsatisfactory but would work) You could compile with -ddump-ds and look at the output. Simon

Re: Lexically scoped type variables

2006-02-06 Thread Christian Maeder
Simon Peyton-Jones wrote: (Unsatisfactory but would work) You could compile with -ddump-ds and look at the output. Yes, I did work (for VariableList.hs) attachListOp :: forall pos . ParallelExec - ListDrawer a pos - IO (IO ()) Thanks, Christian (I need to get a new ghc-6.5 without the

Re: Lexically scoped type variables

2006-01-18 Thread Christian Maeder
Simon Peyton-Jones wrote: I'm very interested to know whether you like it or hate it. In the latter case, I'd also like to know whether you also have programs that will be broken by the change. I don't use GADTs yet and I assume this change will not (seriously) break our code, but let me/us

Lexically scoped type variables

2006-01-17 Thread Simon Peyton-Jones
Dear GHC users As part of a revision of GHC to make type inference for GADTs simpler and more uniform, I propose to change the way in which lexically- scoped type variables work in GHC. (Indeed, I have done so, and will commit it shortly.) This message explains the new system, highlighting

Re: Lexically scoped type variables

2006-01-17 Thread Johannes Waldmann
On the syntax of type signatures: I'd like to be able to write e. g. do x :: Int - randomRIO ( 0, 10 ) print x Currently I have to put ( x :: Int ) in parentheses. Is this necessary? -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- http://www.imn.htwk-leipzig.de/~waldmann/