capitalization unplugged

From: Sebastian Hanowski <seha_at_informatik.uni-kiel.de>
Date: Fri, 26 Oct 2007 10:21:25 +0200

* Am 25.10.07 schrieb Wolfgang Lux:
> </shameless plug>
>
> Regards
> Wolfgang
>
> PS: Thanks for the example. IMHO, it is just another good argument to
> enforce
> a capitalization convention in Curry.

This is not intended to heat up a debate on syntax, it's just how I like
to make use of the absence of a capitalization convention: While
(standard) Curry doesn't have typeclasses allowing an overloaded 'fmap'
operation, I got to the habit of using the same name for the
typeconstructor and for its mapping functional.

        data Tree a = Leaf a | Node (Tree a) (Tree a)

        Tree :: (a -> b) -> Tree a -> Tree b
        Tree f (Leaf a) = Leaf (f a)
        Tree f (Node l r) = Node (Tree f l) (Tree f r)

-- Tree (id :: a -> a) == id :: Tree a -> Tree a
  
-- Tree (g . f) == (Tree g) . (Tree f)

That might look odd to some, but it saves you from having to invent new
names and it's what you usually get to see in category theory literature.


Best regards,
Sebastian
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Fr Okt 26 2007 - 11:47:41 CEST

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:09 CEST