[Haskell-cafe] object oriented technique

Gregory Collins greg at gregorycollins.net
Wed Mar 30 15:04:36 CEST 2011


On Wed, Mar 30, 2011 at 6:52 AM, Tad Doxsee <tad.doxsee at gmail.com> wrote:
> Greg,
>
> Thanks for your help.  Is there any significant difference between
> using existential quantification
>
> data ShapeD = forall s. ShapeC => ShapeD s
>
> versus a GADT
>
> data ShapeD  where
>  ShapeD :: ShapeC s => s -> ShapeD
>
> I'm not sure I understood what you meant by "You don't need to write
> more typeclass instances this way."

Sorry, I misspoke -- they're equivalent. Personally I find the
existential easier to read.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the Haskell-Cafe mailing list