Jump to content

Need Haskel Help

- - - - -

  • Please log in to reply
No replies to this topic

#1
djzingo

djzingo

    Newbie

  • Members
  • Pip
  • 3 posts
Hi I have the following function


blak :: Sudoku →  [Pos]

blak (Sudoku su) = [ fst x | x ←  posSud , isBlank (snd x) ]

  where

        isBlank Nothing = True

        isBlank _               = False

        posSud                  = zip ixPos (concat su)

        ixPos                   = zip ixRows ixCols

        ixCols                  = concat (replicate 9 [0..8])

        ixRows                  = [floor (x / 9) | x ←  [0..81]]



{-

Property that states that all cells in the blanks list are actually blank

-}

prop_blak_pos :: Sudoku →  Bool

prop_blak_pos sud = (rows sud) !! (fst pair) !! (snd pair) ≡ Nothing

   where pair = blak sud



But I get the following error message

could't match expected type '(a, b)' against inferred type '[Pos]'
in the first argument 'fst'' namley pair and second of '(!!)' namley fst pair
in the first argument of '(rows) bankey ('rows sud)'

How can I fix this problem, im new at haskell.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users