Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Pattern matching over functions (Giacomo Tesio)


----------------------------------------------------------------------

Message: 1
Date: Wed, 7 Dec 2011 11:34:28 +0100
From: Giacomo Tesio <[email protected]>
Subject: [Haskell-beginners] Pattern matching over functions
To: [email protected]
Message-ID:
        <cahl7psehyijccyaytga5nn4rx6vnenu-juslewl+xkzrzxu...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi Haskellers,

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:

f1 :: a -> b

f2 :: a -> b

f3 :: c -> a -> b

map :: (a -> b) -> T a -> T b
map f1 = anEquivalentOfF1InTCategory
map f2 = anEquivalentOfF2InTCategory
map f3 $ c = anEquivalentOfF3withCInTCategory
map unknown = aGenericMapInTCategory

Is it "just" the implementation complexity of the feature in ghc that
prevents this?
Or is it "conceptually" wrong?

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.


Giacomo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20111207/b4177171/attachment-0001.htm>

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 42, Issue 8
****************************************

Reply via email to