On Sat, Sep 24, 2016 at 9:11 PM, Nick H wrote:
>
> Regarding null_square: If you want to make sure that null_square is passed
> by reference, you can define it as a top-level value. (That said, the
> record is so small, I doubt it would make a noticeable performance
>
Re: your initial post... you could rewrite the code as
case Maybe.map .cell c of
Just (Letter s) ->
s
_ ->
""
Don't know if that's any easier to read, though.
Regarding null_square: If you want to make sure that null_square is passed
by reference, you can define it as a top-level
Don't think that will work because c is of type Maybe Square, not Maybe
Cell.
One further question - if I define
let null_square = { cell = Empty, num = 0 }
let get_square maybe_square =
case maybe_cell of
Nothing: null_square
Just s : s
let get_letter maybe_square =
case