Hi Haskellers, <div><br><div>I'm wondering why, given that functions and referential transparency are first class citizens in haskell, it isn't possible to write a mapping function this way:</div></div><div><br></div>
<div>f1 :: a -> b</div><div><br></div><div>f2 :: a -> b</div><div><br></div><div>f3 :: c -> a -> b</div><div><br></div><div>map :: (a -> b) -> T a -> T b</div><div>map f1 = anEquivalentOfF1InTCategory</div>
<div>map f2 = anEquivalentOfF2InTCategory</div><div>map f3 $ c = anEquivalentOfF3withCInTCategory</div><div>map unknown = aGenericMapInTCategory</div><div><br></div><div>Is it "just" the implementation complexity of the feature in ghc that prevents this? </div>
<div>Or is it "conceptually" wrong?</div><div><br></div><div>At a first look, I thought that most of complexity here should be related to function's equality, but than I thought that the function full name should uniquely map from the category of meanings in the programmer mind to the category of implementations available to the compiler's.</div>
<div><br></div><div><br></div><div>Giacomo</div>