[Haskell-cafe] Is there a name for this?

Eric devnull1999 at yahoo.com
Sun Mar 8 16:11:48 UTC 2015

Given a class Foo:
> class Foo f where>     bar :: f -> Bool>     baz :: f -> Char -> Int
does the record type Foo'
>  data Foo' = Foo' {>      bar' :: Bool,>      baz' :: Char -> Int>      }>  >  instance Foo Foo' where>      bar = bar'>      baz = baz'
where the fields of the record Foo' are just implementations of the functions of Foo have any special name?
In some sense it's a canonical instance of Foo; we could trivially write a universal
> toFoo' :: Foo f => f -> Foo'
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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150308/59bb8c40/attachment.html>

More information about the Haskell-Cafe mailing list