3

Is there a function in Haskell like say:

max_of_type :: (Num a) => a

So:

max_of_type :: Int == 2 ^ 31 - 1 // for example, implementation dependent
1
  • Note that this is not a function; it's just a value, albeit defined by typeclass instances. Commented Jun 4, 2012 at 10:52

2 Answers 2

9

Yes, it's called maxBound.

There is also minBound. They are both part of the Bounded type class.

Sign up to request clarification or add additional context in comments.

1 Comment

I'll accept this answer, but I can't yet. Found the answer just after posting.
1

Oops, it's just maxBound and minBound.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.