I have a little programme that doesn't compile:

        module Example where

        class (Show c, Ord c, Bounded c) => MyClass c

        showThings :: MyClass c => c -> (String, String)

        showThings x =
            let foo = maxBound :: c
             in (show x, show foo)

If I change that second-to-last line to,

            let foo = max x maxBound

then it compiles. However, it's clearly silly to use "max" just to make
the type of the maxBound be the same type as the x. (I'm assuming that the
Ord and the Bounded instances of the type are sensibly consistent.)

What should I be writing if I want foo to be the maxBound applied to the
type that x is?

-- Mark
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to