[Haskell-fr] Re: Fractional etc...

Dupont Corentin corentin.dupont at gmail.com
Mon Oct 29 07:02:50 EDT 2007


J'ai ghci 6.6.1.
Ce code ne passe pas:

*Prelude> let m = 5
Prelude> map (/m) [0..10]

<interactive>:1:4:
    No instance for (Fractional Integer)
      arising from use of `/' at <interactive>:1:4-7

*par contre ça ça passe dans ghci:

*Prelude> let foo m = map (/m) [0..10]
Prelude> foo 5
[0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0]*

Mais... Bien sur:

*Prelude> let n = 5*
*Prelude> let foo m = map (/m) [0..10]
Prelude> foo n*

Ne passe pas plus!

*
*



On 10/29/07, Stephane Bortzmeyer <bortzmeyer at nic.fr> wrote:
> On Mon, Oct 29, 2007 at 11:09:43AM +0100,
>  Dupont Corentin <corentin.dupont at gmail.com> wrote
>  a message of 43 lines which said:
>
> > let m = 5
> > map (/m) [0..10]
> >
> > il me sort:
> >     No instance for (Fractional Integer)
>
> Quelle version ? Avec ghci 6.6, c'est accepté sans problème. (J'ai
> essayé avec let et aussi avec :
>
> foobar m =
>  map (/m) [0..10]
>
> main = do
>  print (foobar 5)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-fr/attachments/20071029/289298d0/attachment.htm


More information about the Haskell-fr mailing list