<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16876">Given a class Foo:</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16877"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16878">> class Foo f where</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16879">> bar :: f -> Bool</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16880">> baz :: f -> Char -> Int</div><div dir="ltr" class="" style=""><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16881">does the record type Foo'</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16861"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16860">> data Foo' = Foo' {</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16859">> bar' :: Bool,</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16858">> baz' :: Char -> Int</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16852">> }</div><div dir="ltr" class="" style="">> </div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16882">> instance Foo Foo' where</div><div dir="ltr" class="" style="">> bar = bar'</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16883">> baz = baz'</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16884"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16885">where the fields of the record Foo' are just implementations of the functions of Foo have any special name?</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16886"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16887">In some sense it's a canonical instance of Foo; we could trivially write a universal</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16920"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16915">> toFoo' :: Foo f => f -> Foo'</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16919"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16916">function.</div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16917"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16918">I ran across this pattern and wondered whether it was useful enough to have received a name. It vaguely resembles a typeclass dictionary or a vtable in an OOP language.</div><div dir="ltr" class="" style=""><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16926">--Eric</div><div class="" style="" id="yui_3_16_0_1_1425795437382_16925"><br class="" style=""></div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1425795437382_16927"><br class="" style=""></div></div></body></html>