Re: [Haskell-cafe] Curiose types

2007-05-28 Thread Rodrigo Queiro
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 =

Re: [Haskell-cafe] Curiose types

2007-05-28 Thread David House
On 28/05/07, Rodrigo Queiro [EMAIL PROTECTED] wrote: After a little too long trying, I managed to get code from which the type system will infer that type, without using 'undefined': Yes, but you do it by writing a coerce :: a - b, which is surely cheating. -- -David House, [EMAIL PROTECTED]

[Haskell-cafe] Curiose types

2007-05-27 Thread Andrew Coppin
As I lay in bed last night, a curios fact occurred to me. (Yes, I don't get out very much...) Consider the map function: map :: (a - b) - [a] - [b] There are two ways you can think about this function. First, you can see it as meaning map :: (a - b) - ([a] - [b]) Which is beautifully

Re: [Haskell-cafe] Curiose types

2007-05-27 Thread Tomasz Zielonka
On Sun, May 27, 2007 at 11:12:47AM +0100, Andrew Coppin wrote: So, clearly, (-) is not associative. That's right. Now I'm left wondering why you can bracket the type for map in two different ways Are you sure you can? Best regards Tomasz ___

Re: [Haskell-cafe] Curiose types

2007-05-27 Thread Stefan Holdermans
Andrew, Which is beautifully symmetric. Alternatively, you can think about how you actually use it: 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

Re: [Haskell-cafe] Curiose types

2007-05-27 Thread Thomas Schilling
On 5/27/07, Andrew Coppin [EMAIL PROTECTED] wrote: map :: (a - b) - [a] - [b] map :: (a - b) - ([a] - [b]) Which is beautifully symmetric. Alternatively, you can think about how you actually use it: map :: ((a - b) - [a]) - [b] No, now you're confusing things. The uncurried function

Re: [Haskell-cafe] Curiose types

2007-05-27 Thread Stefan O'Rear
On Sun, May 27, 2007 at 02:10:40PM +0200, Stefan Holdermans wrote: Andrew, Which is beautifully symmetric. Alternatively, you can think about how you actually use it: map :: ((a - b) - [a]) - [b] I am not following here: what do you mean? Clearly, this is not a valid typing for

Re: [Haskell-cafe] Curiose types

2007-05-27 Thread Stefan Holdermans
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