Haskell: bound-values in generic functions
问题 i want to do something like: succ' :: (Bounded a, Eq a, Enum a) => a -> a succ' n | n == (maxBound :: a) = minBound :: a | otherwise = succ n but this does not work. how to solve this? 回答1: You don't need the type annotations, and they're the source of the errors you're getting: succ' :: (Bounded a, Eq a, Enum a) => a -> a succ' n | n == maxBound = minBound | otherwise = succ n (This works in Haskell 98 and Haskell 2010, so pretty much any compiler you've got lying around .) Also, I indented