-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,46 @@ | ||
-- | Provides the 'FromInteger' and 'ToInteger' typeclasses. | ||
-- | Provides the 'Internal.FromInteger' and 'Internal.ToInteger' | ||
-- typeclasses. | ||
-- | ||
-- @since 0.1 | ||
module Numeric.Convert.Integer | ||
( Internal.FromInteger (..), | ||
fromℤ, | ||
Internal.ToInteger (..), | ||
|
||
-- * Aliases | ||
ℤ, | ||
Fromℤ, | ||
fromℤ, | ||
Toℤ, | ||
toℤ, | ||
) | ||
where | ||
|
||
import GHC.Stack (HasCallStack) | ||
import Numeric.Convert.Internal qualified as Internal | ||
|
||
-- | Unicode alias for 'Integer', with U+2114. | ||
-- | ||
-- @since 0.1 | ||
type ℤ = Integer | ||
|
||
-- | Unicode alias for 'Internal.FromInteger', with U+2114. | ||
-- | ||
-- @since 0.1 | ||
type Fromℤ = Internal.FromInteger | ||
|
||
-- | Unicode alias for 'Internal.fromZ', with U+2114. | ||
-- | ||
-- @since 0.1 | ||
fromℤ :: (Internal.FromInteger a, HasCallStack) => Integer -> a | ||
fromℤ :: (Fromℤ a, HasCallStack) => ℤ -> a | ||
fromℤ = Internal.fromZ | ||
|
||
-- | Unicode alias for 'Internal.ToInteger', with U+2114. | ||
-- | ||
-- @since 0.1 | ||
type Toℤ = Internal.ToInteger | ||
|
||
-- | Unicode alias for 'Internal.toZ', with U+2114. | ||
-- | ||
-- @since 0.1 | ||
toℤ :: (HasCallStack, Internal.ToInteger a) => a -> Integer | ||
toℤ :: (HasCallStack, Toℤ a) => a -> ℤ | ||
toℤ = Internal.toZ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,46 @@ | ||
-- | Provides the 'FromRational' and 'ToRational typeclasses. | ||
-- | Provides the 'Internal.FromRational' and 'Internal.ToRational | ||
-- typeclasses. | ||
-- | ||
-- @since 0.1 | ||
module Numeric.Convert.Rational | ||
( Internal.FromRational (..), | ||
fromℚ, | ||
Internal.ToRational (..), | ||
|
||
-- * Aliases | ||
ℚ, | ||
Fromℚ, | ||
fromℚ, | ||
Toℚ, | ||
toℚ, | ||
) | ||
where | ||
|
||
import GHC.Stack (HasCallStack) | ||
import Numeric.Convert.Internal qualified as Internal | ||
|
||
-- | Unicode alias for 'Rational', with U+211A. | ||
-- | ||
-- @since 0.1 | ||
type ℚ = Rational | ||
|
||
-- | Unicode alias for 'Internal.FromRational', with U+211A. | ||
-- | ||
-- @since 0.1 | ||
type Fromℚ = Internal.FromRational | ||
|
||
-- | Unicode alias for 'Internal.fromQ', with U+211A. | ||
-- | ||
-- @since 0.1 | ||
fromℚ :: (Internal.FromRational a, HasCallStack) => Rational -> a | ||
fromℚ :: (Fromℚ a, HasCallStack) => ℚ -> a | ||
fromℚ = Internal.fromQ | ||
|
||
-- | Unicode alias for 'Internal.ToRational', with U+211A. | ||
-- | ||
-- @since 0.1 | ||
type Toℚ = Internal.ToRational | ||
|
||
-- | Unicode alias for 'Internal.toQ', with U+211A. | ||
-- | ||
-- @since 0.1 | ||
toℚ :: (HasCallStack, Internal.ToRational a) => a -> Rational | ||
toℚ :: (HasCallStack, Toℚ a) => a -> ℚ | ||
toℚ = Internal.toQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
-- | Provides the 'FromReal' and 'ToReal' typeclasses. | ||
-- | Provides the 'Internal.FromReal' and 'Internal.ToReal' typeclasses. | ||
-- | ||
-- @since 0.1 | ||
module Numeric.Convert.Real | ||
( Internal.FromReal (..), | ||
fromℝ, | ||
Internal.ToReal (..), | ||
|
||
-- * Aliases | ||
ℝ, | ||
Fromℝ, | ||
fromℝ, | ||
Toℝ, | ||
toℝ, | ||
) | ||
where | ||
|
||
import GHC.Stack (HasCallStack) | ||
import Numeric.Convert.Internal qualified as Internal | ||
|
||
-- | Unicode alias for 'Double', with U+211D. | ||
-- | ||
-- @since 0.1 | ||
type ℝ = Double | ||
|
||
-- | Unicode alias for 'Internal.FromReal', with U+211D. | ||
-- | ||
-- @since 0.1 | ||
type Fromℝ = Internal.FromReal | ||
|
||
-- | Unicode alias for 'Internal.fromR', with U+211D. | ||
-- | ||
-- @since 0.1 | ||
fromℝ :: (Internal.FromReal a, HasCallStack) => Double -> a | ||
fromℝ :: (Fromℝ a, HasCallStack) => ℝ -> a | ||
fromℝ = Internal.fromR | ||
|
||
-- | Unicode alias for 'Internal.ToReal', with U+211D. | ||
-- | ||
-- @since 0.1 | ||
type Toℝ = Internal.ToReal | ||
|
||
-- | Unicode alias for 'Internal.toR', with U+211D. | ||
-- | ||
-- @since 0.1 | ||
toℝ :: (HasCallStack, Internal.ToReal a) => a -> Double | ||
toℝ :: (HasCallStack, Toℝ a) => a -> ℝ | ||
toℝ = Internal.toR |