Bas van Dijk wrote:
On Wed, Oct 1, 2008 at 3:01 AM, Reiner Pope <[EMAIL PROTECTED]> wrote:
I believe there is no way to simply express this "abstraction over classes",
but the Scrap your boilerplate with class[1] paper discusses this same
problem and present a workaround by defining the class's dictionary of
methods as an explicit type.
What follows is the code to implement their workaround for your example.
First some fairly standard extensions:
{-# LANGUAGE Rank2Types, EmptyDataDecls, FlexibleInstances, KindSignatures
#-}
And some more controversial, but necessary ones:
{-# LANGUAGE UndecidableInstances, OverlappingInstances #-}
Just an observation:
That terrifying list of extensions is needed for this 'full' solution.
To just literally encode what the OP wanted you just need a concrete
dictionary and existentials, AFAIK.
Jules
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe