[Haskell-cafe] "Natural" polymorphism for n*(n+1)/2
Henning Thielemann
lemming at henning-thielemann.de
Wed Dec 16 21:50:17 UTC 2020
On Wed, 16 Dec 2020, M Douglas McIlroy wrote:
> Some nominally rational functions, e.g n*(n+1)/2,
> yield integer values for integer arguments. I seek
> either a way to wrap such a function so it has type
> Num a => a->a or a convincing argument that it can't
> be done.
Num will be difficult, but with Integral class you could use 'div'.
More information about the Haskell-Cafe
mailing list