@@ -14,24 +14,24 @@ Parser : Nat -> Type
14Parser n = Either ParseErr (b : Board n ** LegalBoard b)
14Parser n = Either ParseErr (b : Board n ** LegalBoard b)
16mapM : Monad m => (a -> m b) -> Vect n a -> m (Vect n b)
16mapM : Monad m => (a -> m b) -> Vect n a -> m (Vect n b)
17−mapM _ Nil = return Vect.Nil
17+mapM _ Nil = pure Vect.Nil
18mapM f (x::xs) = do
18mapM f (x::xs) = do
20 xs' <- mapM f xs
20 xs' <- mapM f xs
21− return (Vect.(::) x' xs')
21+ pure (Vect.(::) x' xs')
23parseToken : String -> Either String (Cell n)
23parseToken : String -> Either String (Cell n)
24−parseToken "." = return Nothing
24+parseToken "." = pure Nothing
25parseToken "0" = Left "Got cell 0, expected 1-based numbering"
25parseToken "0" = Left "Got cell 0, expected 1-based numbering"
26parseToken x = map Just (tryParseFin ((cast x) - 1))
26parseToken x = map Just (tryParseFin ((cast x) - 1))
28 tryParseFin : Int -> Either String (Fin n)
28 tryParseFin : Int -> Either String (Fin n)
29 tryParseFin {n=Z} _ = Left ("Given cell " ++ x ++ " out of range")
29 tryParseFin {n=Z} _ = Left ("Given cell " ++ x ++ " out of range")
30− tryParseFin {n=S k} 0 = return FZ
30+ tryParseFin {n=S k} 0 = pure FZ
31 tryParseFin {n=S k} x =
31 tryParseFin {n=S k} x =
32 case tryParseFin {n=k} (x-1) of
32 case tryParseFin {n=k} (x-1) of
33 Left err => Left err
33 Left err => Left err
34− Right fin => return (FS fin)
34+ Right fin => pure (FS fin)
36length : Vect n a -> Nat
36length : Vect n a -> Nat
37length {n=n} _ = n
37length {n=n} _ = n
@@ -45,7 +45,7 @@ parseCols {n=S k} row l cs = helper last l
45 let here = (x, row) -- TODO: Determine why naming this makes idris smarter
45 let here = (x, row) -- TODO: Determine why naming this makes idris smarter
46 tok <- parseToken {n=S k} (index x cs)
46 tok <- parseToken {n=S k} (index x cs)
47 case tok of
47 case tok of
48− Nothing => return (_ ** l)
48+ Nothing => pure (_ ** l)
50 case legalVal b here t of
50 case legalVal b here t of
51 Yes prf => Right (_ ** Step prf l)
51 Yes prf => Right (_ ** Step prf l)
@@ -79,4 +79,4 @@ parse str =
79 let rows = fromList (lines str) in
79 let rows = fromList (lines str) in
80 case parseRows {n=length rows} emptyBoard Base rows of
80 case parseRows {n=length rows} emptyBoard Base rows of
81 Left msg => Left msg
81 Left msg => Left msg
82− Right board => return (_ ** board)
82+ Right board => pure (_ ** board)