Bonjour, voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import Data.Monoid
import System.IO
import System.Random
import Graphics.Gloss
 
main = do
        affiche 
 
affiche = display  
	 (InWindow
	       "Pascal"
		(300, 300)
		(10, 10))
         black
         (picture)
 
picture = pictures (listOfpoints n a i j ecart b coul)  -- ligne 17
    where
	a = [1,1,1,2] :: [Float]
	n = 91200
        j = 3
	i = 1
	ecart = 0
	b = 0 :: Float
	coul = 0 :: Float
 
listOfpoints 0 _ _ _ _ _ _ = []
listOfpoints n a i j ecart b coul = point : listOfpoints (n-1) a' i' j' ecart' b' coul'
    where
	i' = calci i j
	j' = calcj i j
	ecart' = calce j' ecart
	b' = calcb a j' ecart'
	a' = a ++ [b']
	coul' = teinte b'
        point = translate (fromIntegral i') (fromIntegral j') (color (myColor(coul')) 
 
(circle 1.0))
 
calci i j
	|j == i = i + 1
	|otherwise = i
 
calcj i j 
	|j == i = 0
	|otherwise = j + 1
 
calce j' ecart
	|j' == 0 = ecart + 1
	|otherwise = ecart
 
calcb a j' ecart'
	|fromIntegral j' == 0 = 1	
	|otherwise = (a !! (fromIntegral j' - 1)) + (a !! (fromIntegral j' - fromIntegral 
 
ecart'))`mod`2
 
teinte b'
	|b' < 128 = ((256`mod`(256 - 2*b'))`mod`13)
	|otherwise = 0
 
myColor coul' = ( [ca,cb,cc,cd,ce,cf,cg,ch,ci,cj,ck,cl,cm,cn,co,cp] !! abs(round(coul')) )
 
ca = white
cb = light(light yellow)
cc = light yellow
cd = yellow   
ce = light(light orange)
cf = light orange
cg = orange
ch = light (dark orange)
ci = light red
cj = red
ck = dark red 
cl = light violet
cm = violet
cn = light(light (dark violet))
co = light ( dark violet)
cp = blue
Et voici le message:
TestPascal.hs:17:21:
No instance for (Integral Float)
arising from a use of `listOfpoints'
Possible fix: add an instance declaration for (Integral Float)
In the first argument of `pictures', namely
`(listOfpoints n a i j ecart b coul)'
In the expression: pictures (listOfpoints n a i j ecart b coul)
In an equation for `picture':
picture
= pictures (listOfpoints n a i j ecart b coul)
where
a = [1, ....] :: [Float]
n = 91200
j = 3
i = 1
....

Il m'est plus difficile de répondre aux exigences de langage que de trouver les bons algorithmes !
Quel est le problème ici ?
Merci d'avance.