[clean-list] What am I missing ?

sebastien FURIC sebastien.furic@tni.fr
Thu, 05 Jul 2001 15:16:27 +0200


 Hello,

 When I compile the following program, I get a type error:

Type error: [test.icl,10,partition_]: specified type is too polymorphic
(contains monomorphic type variables)

 If I delete the line where the type of partition_ is declared I have no
error. Why is the declared type wrong ?

 Thanks,

 Sebastien Furic.

---


module test

import StdEnv

partition :: (!a -> Bool) ![a] -> ([a], [a])
partition f l = partition_ l [] []
where
 partition_ :: ![a] [a] [a] -> ([a], [a])
 partition_ [] accepted rejected = (accepted, rejected)
 partition_ [x : xs] accepted rejected
  | f x  = partition_ xs [x : accepted] rejected
  | otherwise = partition_ xs accepted [x : rejected]

Start :: ([Int], [Int])
Start = partition (\x -> isEven x) [0,1,2,3,4,5,6,7,8,9]