After a little too long trying, I managed to get code from which the type system will infer that type, without using 'undefined':
*Main> :t map
map :: ((a -> a1) -> [a]) -> [a1]
import
System.IO.Unsafe
import Data.IORef
import Prelude hiding (map)
import qualified Prelude as P
coerce a = unsafePerformIO (coerce' a)
where
ref = unsafePerformIO $ newIORef []
coerce' a = do
writeIORef ref [a]
b <- readIORef ref
return (head b)
map' a2b f = P.map a2b (f a2b)
map = map' coerce
>>> map :: ((a -> b) -> [a]) -> [b]
>>
>> I am not following here: what do you mean? Clearly, this is not a
>> valid typing for map. Moreover, modulo undefinedness, there are no
>> functions with this typing.
>
> map _ = []
Ah, well, and that one, of course... :-)
Cheers,
Stefan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe