[Haskell-cafe] deriving instances of Enum for tuples of bounded, enumerable types (useful for generating QuickCheck.Arbitrary instances for collection of collection types)

Luke Palmer lrpalmer at gmail.com
Sat Mar 8 23:32:58 EST 2008


On Sun, Mar 9, 2008 at 3:23 AM, Brandon S. Allbery KF8NH
<allbery at ece.cmu.edu> wrote:
>    myFunc :: (forall a. (Bounded a, Enum a) => a) ->
>              (forall a. (Bounded a, Enum a) => a) ->
>              (forall a. (Bounded a, Enum a) => a)
>
>  which is a rather useless declaration (I think the only inhabitant of
>  that type is _|_).

Just to nitpick: this function type is quite specific, and there are
many non _|_ implementations.

myFunc a b = a
myFunc a b = b
myFunc a b = toEnum (f a b)
  where f :: Int -> Int -> Int
...

Luke


More information about the Haskell-Cafe mailing list