Thanks this was helpful.<br><br>In many of Conal Elliot's writings I see that he shows that his semantic function is a natural transformation. Is that just basically showing the polymorphic nature of his semantic functions, or are there other benifits you get by showing a particular function is a natural transformation?<br>
<br>Daryoush<br><br><div class="gmail_quote">On Thu, Apr 23, 2009 at 12:34 PM, Dan Doel <span dir="ltr"><<a href="mailto:dan.doel@gmail.com">dan.doel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Thursday 23 April 2009 2:44:48 pm Daryoush Mehrtash wrote:<br>
> Thanks for this example I get the point now. (at least i think i do :) )<br>
><br>
> One more question.... This all being on the same category then the functor<br>
> transformation can also be view as a simple morphism too. In this example<br>
> the listToMaybe can be viewed as morphism between list and Maybe types that<br>
> are both in the Hask categroy too. right? If so then what would viewing<br>
> the morphism as natural transformation by you?<br>
<br>
</div>listToMaybe in general wouldn't be a morphism in the category, because<br>
morphisms would be from concrete types to other concrete types. [1] So, if<br>
you'll excuse some notation I just made up (with a little help from GHC core<br>
notation :)):<br>
<br>
listToMaybe@Int :: [Int] -> Maybe Int<br>
listToMaybe@Char :: [Char] -> Maybe Char<br>
listToMaybe@String :: [String] -> Maybe String<br>
<br>
are all morphisms in the alleged Hask category. Each polymorphic function<br>
(similar to the above one, at least) defines a family of morphisms like that.<br>
*But*, that's what a natural transformation is: a family of morphisms, one for<br>
each object in the category, that commute with functor application in a<br>
certain way. Thus, one can look at the fully polymorphic listToMaybe as a<br>
natural transformation:<br>
<br>
listToMaybe :: [] -> Maybe<br>
<br>
-- Dan<br>
<br>
[1] Maybe you could make up a category where polymorphic types are objects as<br>
well, but that doesn't seem to be the way people typically go about applying<br>
category theory to Haskell.<br>
<div><div></div><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br><br>