[Haskell-cafe] Modulo-foo equivalence classes in Haskell?

Diego Navarro dnavarro at gmail.com
Thu Feb 1 07:44:09 EST 2007


> newtype Y = Y { unY :: X }
>
> instance Eq Y where (==) = foo
>
> nub' :: [X] -> [X]
> nub' = map unY . sort . map Y
>

Yes, I thought of that. I'm really thinking of how I can generalize
the Eq class so I dont have to go around manually "lifting" operations
that are already defined (like operations on integers for modulo-n
rings)

-- Diego Navarro


More information about the Haskell-Cafe mailing list