Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell Int and Maybe Int

Essentially I have a function that uses Maybe Int's to display a Sudoku problem. The Solution to the Sudoku contains only Ints and the code for displaying the Grid will be almost identical, with the exception of Maybe Int used for Problems and Int used for Solutions.

Is it possible to use Int values for a function that requires Maybe Int, if so how?

Edit: Just would work, is there a way to convert a list of Int's into maybe Int's?

like image 237
gdrules Avatar asked Dec 09 '22 01:12

gdrules


1 Answers

If xs is a [Int] and you want a [Maybe Int] instead, use map Just xs.

like image 185
dave4420 Avatar answered Dec 23 '22 04:12

dave4420