<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Type Synonym Families</title>
	<atom:link href="http://martijn.van.steenbergen.nl/journal/2009/01/11/type-synonym-families/feed/" rel="self" type="application/rss+xml" />
	<link>http://martijn.van.steenbergen.nl/journal/2009/01/11/type-synonym-families/</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Mon, 13 May 2013 18:02:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
	<item>
		<title>By: Martijn</title>
		<link>http://martijn.van.steenbergen.nl/journal/2009/01/11/type-synonym-families/#comment-268</link>
		<dc:creator>Martijn</dc:creator>
		<pubDate>Sat, 17 Jan 2009 10:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://martijn.van.steenbergen.nl/journal/?p=139#comment-268</guid>
		<description>Very nice. :-) Thanks for sharing!</description>
		<content:encoded><![CDATA[<p>Very nice. <img src='http://martijn.van.steenbergen.nl/journal/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Thanks for sharing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Massimiliano Gubinelli</title>
		<link>http://martijn.van.steenbergen.nl/journal/2009/01/11/type-synonym-families/#comment-269</link>
		<dc:creator>Massimiliano Gubinelli</dc:creator>
		<pubDate>Sat, 17 Jan 2009 10:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://martijn.van.steenbergen.nl/journal/?p=139#comment-269</guid>
		<description>Hi, I come across another use of type families looking for a generic curry/uncurry. Here the implementation

{-# LANGUAGE  TypeFamilies,  MultiParamTypeClasses, FlexibleInstances #-}

-- uncurryG converts a function of the form a -&gt; b -&gt; c -&gt; d to the uniform
--  representation (a,(b,(c,()))) -&gt; d
-- curryG converts  the uniform representation (a,(b,(c,()))) -&gt; d to a function
-- of the form a -&gt; b -&gt; c -&gt; d

class Fn a c where
    type Fnq a c :: *
    uncurryG :: Fnq a c -&gt; a -&gt; c
    curryG :: (a -&gt; c) -&gt; Fnq a c

instance Fn () c where
    type Fnq () c = c
    uncurryG f () = f
    curryG f = f ()


instance (Fn b c) =&gt; Fn (a,b) c where
    type Fnq (a,b) c = a -&gt; Fnq b c
    uncurryG f (a,b) = uncurryG (f a) b
    curryG f = a -&gt; curryG (b -&gt; f (a,b))</description>
		<content:encoded><![CDATA[<p>Hi, I come across another use of type families looking for a generic curry/uncurry. Here the implementation</p>
<p>{-# LANGUAGE  TypeFamilies,  MultiParamTypeClasses, FlexibleInstances #-}</p>
<p>&#8211; uncurryG converts a function of the form a -&gt; b -&gt; c -&gt; d to the uniform<br />
&#8211;  representation (a,(b,(c,()))) -&gt; d<br />
&#8211; curryG converts  the uniform representation (a,(b,(c,()))) -&gt; d to a function<br />
&#8211; of the form a -&gt; b -&gt; c -&gt; d</p>
<p>class Fn a c where<br />
    type Fnq a c :: *<br />
    uncurryG :: Fnq a c -&gt; a -&gt; c<br />
    curryG :: (a -&gt; c) -&gt; Fnq a c</p>
<p>instance Fn () c where<br />
    type Fnq () c = c<br />
    uncurryG f () = f<br />
    curryG f = f ()</p>
<p>instance (Fn b c) =&gt; Fn (a,b) c where<br />
    type Fnq (a,b) c = a -&gt; Fnq b c<br />
    uncurryG f (a,b) = uncurryG (f a) b<br />
    curryG f = a -&gt; curryG (b -&gt; f (a,b))</p>
]]></content:encoded>
	</item>
</channel>
</rss>
