Why don't you try :
map (/5.0) [0.0 .. 10.0]
let m = 5.0 map (/m) [0.0 .. 10.0]
I have a similar problem trying a divison by a length
of a list. Finaly I have to build a version of length
called len:
len [] = 0.0
len (h:t) = 1.0 + len t
Dan
--- Dupont Corentin
Salut, J'ai vraiment du mal à mettre au point un petit programme... Il me sort souvent des problèmes du style :
No instance for (Fractional Integer) arising from use of `/' at <interactive>:1:4-7 Possible fix: add an instance declaration for (Fractional Integer)
Par exemple sous ghci si je fait:
map (/5) [0..10]
tout se passe bien. Mais si je me dit "tiens je voudrais bien paramétrer le 5":
let m = 5 map (/m) [0..10]
il me sort: No instance for (Fractional Integer) arising from use of `/' at <interactive>:1:4-7 Possible fix: add an instance declaration for (Fractional Integer) In the first argument of `map', namely `(/ m)' In the expression: map ((/ m)) ([0 .. 10]) In the definition of `it': it = map ((/ m)) ([0 .. 10])
Pourtant les 2 codes me sembles assez équivalents!!! Je peux utiliser des "fromInteger", ce qui résout temporairement le problème.
Je me retrouve par la suite avec des (de mémoire) Infered type : Int Expected type : Integer
Ce qui me laisse dans le flou...
a+ Corentin _______________________________________________ Haskell-fr mailing list Haskell-fr@haskell.org http://www.haskell.org/mailman/listinfo/haskell-fr
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com