> > real2frac :: (Real a, Fractional b) => a -> b
> > real2frac = fromRational . toRational
>
> The composition of fromRational and toRational seems to be the
> only way to convert a Double or an Int to a Double.
>
> There is a function in the prelude, fromRealFrac, with exactly
> the same defi
[EMAIL PROTECTED]
wrote something on the possible generic function for the mean
value (I had lost the letter)
> real2frac ... fromRational . toRational
But will this do:
-
mean :: (Num a, Num b, Fractional b) => (a -> b) -
Here is my version:
First we need treefold:
---
module Treefold where
-- I'm surprised treefold isn't in the standard prelude since it's so useful
-- treefold (*) z [a,b,c,d,e,f] = (((a*b)*(c*d))*(e*f))
-- translated from the version I wrote in Ponder in October 1992
-- Jon Fairbairn
treefold
> However, if the transforming program took into account the information in the
> type signature (for unionMany, it would notice that the user used the type
> synonym for the inner list only), it could make pretty good guesses about which
> arguments and results to unpack or pack.
> Since the ad
| When I was trying to sleep last night I though I could implement Search
| Trees in Haskell.
| And not only that, I would try to implement them as monads.
| The problem is that search trees require context Ord a.
Since noone has replied to this yet, I will give a short explanation.
A Monad