prelude-safeenum-0.1.0: A redefinition of the Prelude's Enum class in order to render it safe.

PortabilityHaskell98 + CPP + GeneralizedNewtypeDeriving
Stabilityprovisional
Maintainerwren@community.haskell.org
Safe HaskellTrustworthy

Data.Number.CalkinWilf

Description

Enumerate the rationals in Calkin--Wilf order.

Synopsis

Documentation

newtype CalkinWilf a Source

Enumerate the rationals in Calkin--Wilf order. The enumeration is symmetric about zero, ensuring that all the negative rationals come before zero and all the positive rationals come after zero.

BUG: while the succeeds, precedes, toEnum, and fromEnum methods are correct, they are horribly inefficient. This can be rectified (or at least mitigated), but this remains to be done.

Constructors

CalkinWilf (Ratio a) 

unCalkinWilf :: CalkinWilf a -> Ratio aSource

Return the underlying Ratio. Not using record syntax to define this in order to pretty up the derived Show instance.