Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry-packages
base
Commits
c7df02b3
Commit
c7df02b3
authored
Jan 09, 2018
by
Michael Hanus
Browse files
fromInteger->fromInt, fromRational->fromFloat
parent
d3c7c669
Changes
1
Show whitespace changes
Inline
Side-by-side
src/Prelude.curry
View file @
c7df02b3
...
...
@@ -1645,7 +1645,7 @@ class Num a where
abs :: a -> a
signum :: a -> a
fromInt
eger
:: Int -> a
fromInt :: Int -> a
x - y = x + negate y
negate x = 0 - x
...
...
@@ -1664,7 +1664,7 @@ instance Num Int where
| x == 0 = 0
| otherwise = -1
fromInt
eger
x = x
fromInt x = x
instance Num Float where
x + y = x +. y
...
...
@@ -1681,9 +1681,9 @@ instance Num Float where
| x == 0 = 0
| otherwise = -1
fromInt
eger
x = i2f x
fromInt x = i2f x
-- minimal definition: from
Rational
and (recip or (/))
-- minimal definition: from
Float
and (recip or (/))
class Num a => Fractional a where
(/) :: a -> a -> a
...
...
@@ -1692,16 +1692,16 @@ class Num a => Fractional a where
recip x = 1/x
x / y = x * recip y
from
Rational
:: Float -> a -- since we have no type Rational
from
Float
:: Float -> a -- since we have no type Rational
instance Fractional Float where
x / y = x /. y
recip x = 1.0/x
from
Rational
x = x
from
Float
x = x
class (Num a, Ord a) => Real a where
-- to
Rational
:: a ->
Rational
-- to
Float
:: a ->
Float
class Real a => Integral a where
div :: a -> a -> a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment