ekmett / ekmett/intervals

Do the Real and RealFrac instances belong?

Open
#25 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
27
Forks
14
PR merge metrics
No merged PRs in 30d

Description

The `Real`, `RealFrac`, and `RealFloat` instances for `Interval` seem fairly contrived, as the existing documentation notes. They take midpoints for a lot of things on a fairly arbitrary basis, and some of the `RealFloat` things seem even more difficult to guess the implementation semantics from the names and types.

It feels to me like this type might have been one that people were thinking of when they split `Real` from `Num` (and so forth). Possibly `scaleFloat` I could see. I'm not sure why `atan2` landed in `RealFloat` and not `Floating`, but certainly there is a reasonable `atan2` function on intervals that conservatively approximates the ordinary one.

The one big advantage I can see is that it feels natural to write `ceiling` for what would become `ceiling . sup` if the instance went away (and similarly for `floor`).

Are you aware of use cases?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.