Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell: Maximum/minimum function

Tags:

haskell

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
like image 741
Clinton Avatar asked Nov 29 '25 02:11

Clinton


1 Answers

Yes, it's called maxBound.

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

like image 113
Tikhon Jelvis Avatar answered Nov 30 '25 17:11

Tikhon Jelvis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!