On Mon, Sep 17, 2012 at 10:59 AM, Ryan Ingram <[email protected]> wrote:
> The problem is that the function 'element' is ambiguous, for the reasons > MigMit pointed out. > > The standard solution to this problem is to add a dummy argument to fix > the type argument to the type function: > > data Proxy a = Proxy > > class ... => ReplaceOneOf full where > type Item full :: * > > -- implementations can just ignore the first argument > element :: Proxy full -> Item full -> [Item full] -> Bool > > replaceOneOf :: ... > ... > | element (Proxy :: Proxy full) x from = ... > > Now the choice of which 'element' to use can be determined by the type of > the proxy. It might be best if we point users to a "standard" Proxy type so we don't end up lots of packages defining distinct/incompatible types for the same code. Edward Kmett's "tagged" package has a Proxy type.
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
