[Haskell-cafe] is closing a class this easy?

Dougal Stanton ithika at gmail.com
Sat Jul 18 08:47:27 EDT 2009


On Fri, Jul 17, 2009 at 4:38 PM, Conor
McBride<conor at strictlypositive.org> wrote:

> class Private x where
>
> public :: (forall x. Public x => x -> y) -> y
> public f = f Pike
>
> data Pike = Pike
> instance Private Pike
> instance Public Pike
>
> --------------------------------------
>
> But if I don't tell 'em Pike, I've ensured that
> blah can only be used in the argument to public.

Well I appreciated this bit even if no-one else did! :-) Also, that's
a nifty trick if it works!


D


More information about the Haskell-Cafe mailing list