Avoid passing unnecessary dictionaries in Data.Complex

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Avoid passing unnecessary dictionaries in Data.Complex

Edward Kmett-2
We removed the data type context from Data.Complex some time ago.

However, when we did so, we left the rest of the API in that module intact.

Many of the accessors in that module (should) work with much more general types now!

e.g. 

realPart :: Complex a -> a

instead of

realPart :: RealFloat a => Complex a -> a

I propose we stop passing around dictionaries we don't need to methods that don't use them.

Concretely, I'm proposing we simplify the signatures of the following functions, which in the current API all unnecessarily take a RealFloat constraint that they don't use.

realPart :: Complex a -> a
imagPart :: Complex a -> a
conjugate :: Num a => Complex a -> Complex a
mkPolar   :: Floating a => a -> a -> Complex a
cis       :: Floating a => a -> Complex a

Discussion Period: 2 weeks

-Edward Kmett

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Avoid passing unnecessary dictionaries in Data.Complex

Carter Schonwald
+7

theres other issues with Data.Complex, but i'll not raise those for this battle today :) 


On Sat, Mar 15, 2014 at 12:16 AM, Edward Kmett <[hidden email]> wrote:
We removed the data type context from Data.Complex some time ago.

However, when we did so, we left the rest of the API in that module intact.

Many of the accessors in that module (should) work with much more general types now!

e.g. 

realPart :: Complex a -> a

instead of

realPart :: RealFloat a => Complex a -> a

I propose we stop passing around dictionaries we don't need to methods that don't use them.

Concretely, I'm proposing we simplify the signatures of the following functions, which in the current API all unnecessarily take a RealFloat constraint that they don't use.

realPart :: Complex a -> a
imagPart :: Complex a -> a
conjugate :: Num a => Complex a -> Complex a
mkPolar   :: Floating a => a -> a -> Complex a
cis       :: Floating a => a -> Complex a

Discussion Period: 2 weeks

-Edward Kmett

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Avoid passing unnecessary dictionaries in Data.Complex

Andreas Abel
In reply to this post by Edward Kmett-2
+1 of course.

On 15.03.2014 05:16, Edward Kmett wrote:

> We removed the data type context from Data.Complex some time ago.
>
> However, when we did so, we left the rest of the API in that module intact.
>
> Many of the accessors in that module (should) work with much more
> general types now!
>
> e.g.
>
> realPart :: Complex a -> a
>
> instead of
>
> realPart :: RealFloat a => Complex a -> a
>
> I propose we stop passing around dictionaries we don't need to methods
> that don't use them.
>
> Concretely, I'm proposing we simplify the signatures of the following
> functions, which in the current API all unnecessarily take a RealFloat
> constraint that they don't use.
>
> realPart :: Complex a -> a
> imagPart :: Complex a -> a
> conjugate :: Num a => Complex a -> Complex a
> mkPolar   :: Floating a => a -> a -> Complex a
> cis       :: Floating a => a -> Complex a
>
> Discussion Period: 2 weeks
>
> -Edward Kmett
>
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/libraries
>


--
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

[hidden email]
http://www2.tcs.ifi.lmu.de/~abel/
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Avoid passing unnecessary dictionaries in Data.Complex

Daniel Fischer
In reply to this post by Edward Kmett-2
On Saturday 15 March 2014, 00:16:18, Edward Kmett wrote:
> Concretely, I'm proposing we simplify the signatures of the following
> functions, which in the current API all unnecessarily take a
> RealFloatconstraint that they don't use.

+1, naturally
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Avoid passing unnecessary dictionaries in Data.Complex

Joachim Breitner-2
In reply to this post by Edward Kmett-2
Hi,

+1

(stating the obvious)

Greetings,
Joachim

Am Samstag, den 15.03.2014, 00:16 -0400 schrieb Edward Kmett:

> We removed the data type context from Data.Complex some time ago.
>
>
> However, when we did so, we left the rest of the API in that module
> intact.
>
>
> Many of the accessors in that module (should) work with much more
> general types now!
>
>
> e.g.
>
>
> realPart :: Complex a -> a
>
>
> instead of
>
>
> realPart :: RealFloat a => Complex a -> a
>
>
> I propose we stop passing around dictionaries we don't need to methods
> that don't use them.
>
>
> Concretely, I'm proposing we simplify the signatures of the following
> functions, which in the current API all unnecessarily take a RealFloat
> constraint that they don't use.
>
>
> realPart :: Complex a -> a
> imagPart :: Complex a -> a
> conjugate :: Num a => Complex a -> Complex a
> mkPolar   :: Floating a => a -> a -> Complex a
> cis       :: Floating a => a -> Complex a
>
>
> Discussion Period: 2 weeks
>
>
> -Edward Kmett
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/libraries
--
Joachim “nomeata” Breitner
  [hidden email]http://www.joachim-breitner.de/
  Jabber: [hidden email]  • GPG-Key: 0x4743206C
  Debian Developer: [hidden email]

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries

signature.asc (188 bytes) Download Attachment