So...there's just no good way to avoid the duplication?<br><br><div class="gmail_quote">On Tue, Jan 20, 2009 at 11:10 PM, wren ng thornton <span dir="ltr"><<a href="mailto:wren@freegeek.org">wren@freegeek.org</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;">Andrew Wagner 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="Ih2E3d">
Strange little bit of code:<br>
<a href="http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=829#a829" target="_blank">http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=829#a829</a><br>
<br>
If I do any of the following, all of which seem natural to me, it fails to<br>
typecheck:<br>
<br></div>
1. move f out of the 'where' clause (with or without a type signature)<br>
2. put the same type signature on f as is on (/\)<br>
3. replace f with (/\) completely<div class="Ih2E3d"><br>
<br>
What's going on here?<br>
</div></blockquote>
<br>
> :t (nub .) . (++)<br>
(nub .) . (++) :: (Eq a) => [a] -> [a] -> [a]<br>
<br>
> :t foldr (map . (nub .) . (++))<br>
foldr (map . (nub .) . (++)) :: (Eq a) => [[a]] -> [[a]] -> [[a]]<br>
<br>
The type you give to (/\) is more restrictive than the type of the expression, and f uses the generality of the expression.<br><font color="#888888">
<br>
-- <br>
Live well,<br>
~wren<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">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>
</font></blockquote></div><br>