vendredi 4 mars 2016

Error: Non-exhaustive patterns in function Haskell

I did a thread for an error like this one, in it I explain my program. here's the link

I'm going forward in my project and I have an another problem like that one. I did an other thread but if I just need to edit the first one just tell me.

I want to reverse my matrix. For example [[B,B,N],[N,B,B]] will become [[B,N],[B,B],[N,B]]. Here's my code:

transpose :: Grille -> Grille
transpose [] = []
transpose g = [premierElem(g)] ++ transpose(supp g)

supp :: Grille -> Grille
supp [] = []
supp g = [tail(head(g))] ++ supp(tail(g))

premierElem :: Grille -> [Case]
premierElem [] = []
premierElem g = [head(head(g))] ++ premierElem(tail(g))

I got the exact same error and I tried like for the first one but that's not it.

Aucun commentaire:

Enregistrer un commentaire