I assume your implementation requires division and therefore Real. 
Frege is not easily fooled :-)

Cheers
Dierk

sent from:mobile 

> Am 07.10.2016 um 17:04 schrieb Russel Winder <rus...@winder.org.uk>:
> 
> As I understand it, Haskell and Frege idiom is to provide a type
> signature for a function, at least ones exported from a module. However
> is this always going to be possible. However…
> 
> In trying to write a model answer median function (as opposed to just
> "stealing" the one on Rosetta Code) I have a function:
> 
> median xs = …
> 
> This works fine without a type signature. The body of the code only
> relies on the list being sortable, thus it would seem that:
> 
> median :: Ord a => [a] -> a
> median xs = …
> 
> is the right signature. Except that this now gives me a compilation
> error because the inferred type is "Real a => [a] -> a". For me Real is
> consistent with Ord and so should match but the compiler states
> otherwise.
> 
> I am clearly missing something. The obvious workaround is not to have a
> type signature…
>  
> 
> 
> I note that most of the Haskell codes on Rosetta Code are missing type
> signatures.
> 
> -- 
> Russel.
> =============================================================================
> Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
> 41 Buckmaster Road    m: +44 7770 465 077   xmpp: rus...@winder.org.uk
> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to frege-programming-language+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to