Re: [elm-discuss] Re: pattern matching on a field within a record

2016-09-25 Thread Martin DeMello
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: [elm-discuss] Re: pattern matching on a field within a record

2016-09-24 Thread Nick H
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

Re: [elm-discuss] Re: pattern matching on a field within a record

2016-09-24 Thread Martin DeMello
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