Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nofib
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
nofib
Commits
c5660c58
Commit
c5660c58
authored
Dec 01, 2011
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track changes to Num superclasses
parent
2df6e347
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
gc/fulsom/Interval.hs
gc/fulsom/Interval.hs
+2
-2
gc/power/Main.hs
gc/power/Main.hs
+6
-6
No files found.
gc/fulsom/Interval.hs
View file @
c5660c58
...
...
@@ -54,12 +54,12 @@ instance (Num a,Ord a,Eq a,Show{-was:Text-} a) => Num (Interval a) where
fromInteger
=
ivFromInteger
instance
(
Num
a
,
Ord
a
,
Fractional
a
)
=>
Fractional
(
Interval
a
)
where
instance
(
Show
a
,
Num
a
,
Ord
a
,
Fractional
a
)
=>
Fractional
(
Interval
a
)
where
(
/
)
=
ivDiv
fromRational
=
ivFromRational
-- instance (Fractional a,Ord a,Floating a) => - not this ?
instance
(
RealFloat
a
)
=>
instance
(
Show
a
,
RealFloat
a
)
=>
Floating
(
Interval
a
)
where
pi
=
Pt
pi
exp
=
ivExp
...
...
gc/power/Main.hs
View file @
c5660c58
...
...
@@ -41,8 +41,8 @@ extract n (x :+: ps) = x : extract (n-1) ps
deriv
::
Num
a
=>
Ps
a
->
Ps
a
integral
::
Fractional
a
=>
Ps
a
->
Ps
a
compose
::
Num
a
=>
Ps
a
->
Ps
a
->
Ps
a
revert
::
Fractional
a
=>
Ps
a
->
Ps
a
compose
::
(
Eq
a
,
Num
a
)
=>
Ps
a
->
Ps
a
->
Ps
a
revert
::
(
Eq
a
,
Fractional
a
)
=>
Ps
a
->
Ps
a
toList
::
Num
a
=>
Ps
a
->
[
a
]
takePs
::
Num
a
=>
Int
->
Ps
a
->
[
a
]
(
.*
)
::
Num
a
=>
a
->
Ps
a
->
Ps
a
...
...
@@ -59,13 +59,13 @@ toList (f :+: fs) = f : (toList fs)
takePs
n
fs
=
take
n
(
toList
fs
)
instance
Num
a
=>
Eq
(
Ps
a
)
where
--(1)
instance
(
Eq
a
,
Num
a
)
=>
Eq
(
Ps
a
)
where
--(1)
Pz
==
Pz
=
True
Pz
==
(
f
:+:
fs
)
=
f
==
0
&&
Pz
==
fs
fs
==
Pz
=
Pz
==
fs
(
f
:+:
fs
)
==
(
g
:+:
gs
)
=
f
==
g
&&
fs
==
gs
instance
Num
a
=>
Show
(
Ps
a
)
where
--(2)
instance
(
Show
a
,
Num
a
)
=>
Show
(
Ps
a
)
where
--(2)
showsPrec
p
Pz
=
showsPrec
p
[
0
]
showsPrec
p
fs
=
showsPrec
p
(
toList
fs
)
...
...
@@ -85,7 +85,7 @@ instance Num a => Num (Ps a) where
fromInteger
0
=
Pz
fromInteger
c
=
fromInteger
c
:+:
Pz
instance
Fractional
a
=>
Fractional
(
Ps
a
)
where
instance
(
Eq
a
,
Fractional
a
)
=>
Fractional
(
Ps
a
)
where
recip
fs
=
1
/
fs
Pz
/
Pz
=
error
"power series 0/0"
...
...
@@ -113,7 +113,7 @@ integral fs = 0 :+: (int1 fs 1) where --(6)
int1
Pz
_
=
Pz
int1
(
f
:+:
fs
)
n
=
f
/
n
:+:
(
int1
fs
(
n
+
1
))
instance
Fractional
a
=>
Floating
(
Ps
a
)
where
instance
(
Eq
a
,
Fractional
a
)
=>
Floating
(
Ps
a
)
where
sqrt
Pz
=
Pz
sqrt
(
0
:+:
0
:+:
fs
)
=
0
:+:
(
sqrt
fs
)
sqrt
(
1
:+:
fs
)
=
qs
where
...
...
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