Mon compilateur se plaint de deux valeurs:une faute étrange (dans mon modèle de dossier?)
model.firstChord.fifth
et model.secondChord.fifth
dans cet extrait:
-- render frets
renderFret : Model -> Fret -> Html Msg
renderFret model fret =
let
(pitchName, pitchLevel) = fret.pitch
(firstChordRootPitchName, firstChordRootPitchLevel) = model.firstChord.root
(firstChordThirdPitchName, firstChordThirdPitchLevel) = model.firstChord.third
(firstChordFifthPitchName, firstChordFifthPitchLevel) = model.firstChord.fifth
(secondChordRootPitchName, secondChordRootPitchLevel) = model.secondChord.root
(secondChordThirdPitchName, secondChordThirdPitchLevel) = model.secondChord.third
(secondChordFifthPitchName, secondChordFifthPitchLevel) = model.secondChord.fifth
in
...
il me dit:
model.firstChord
n'a pas de champ nomméfifth
. - Le type demodel.firstChord
est:Peut-être Chord
qui ne contient pas un champ nommé
fifth
.
mais mon modèle a un champ fifth
:
-- initial model
init : (Model, Cmd Msg)
init =
(
{ firstChord =
Just
{ root = ("C", 3)
, third = ("E", 3)
, fifth = ("G", 3)
}
, secondChord =
Just
{ root = ("F", 3)
, third = ("A", 3)
, fifth = ("C", 4)
}
}
,
Cmd.none
)
Le type de l'accord est:
-- chords
type alias Chord =
{ root : Pitch
, third : Pitch
, fifth : Pitch
}
Chaque pas a ce type:
-- pitch
type alias Pitch = (PitchName, PitchLevel)
-- pitch name
type alias PitchName = String
-- pitch level
type alias PitchLevel = Int
Où pourrait être le problème?
Merci.
êtes-vous sûr que c'est 'let' suivant' case' ?? – Timo
'On dirait que le mot-clé case est utilisé comme variable. - Renommez-le en quelque chose d'autre ... c'est le message. – Timo
oui, c'est une erreur. Je l'ai corrigé. –