[nem-bug] [Nemerle 0000693]: type inference fails when concatenating list comprehensions

feedback at nemerle.org feedback at nemerle.org
Sat Jun 24 00:29:27 CEST 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=693> 
======================================================================
Reported By:                aleksey
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   693
Category:                   Compiler (type engine)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             06-24-2006 00:29 CEST
Last Modified:              06-24-2006 00:29 CEST
======================================================================
Summary:                    type inference fails when concatenating list
comprehensions
Description: 
Type inference fails on infamous haskell "quicksort" example:

def quicksort(l)
{
	| [] => []
	| x :: xs =>
		quicksort($[y | y in xs, y<x])
		+ [x]
		+ quicksort($[y | y in xs, y>=x])
}
System.Console.WriteLine(quicksort([2,1,3])

quicksort.n: cannot find the operator `op_GreaterThanOrEqual' on ? and
 System.Object+

When rewritten the following way, it successfully compiles and works:
def quicksort(l)
{
	| [] => []
	| x :: xs =>
		def lo = quicksort($[y | y in xs, y<x]);
		def hi = quicksort($[y | y in xs, y>=x]);
		lo + [x] + hi
}
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
06-24-06 00:29 aleksey        New Issue                                    
======================================================================




More information about the bugs mailing list