This should work
 
 case c of
    Just (Letter s) ->
      s
    _ -> ""



On Friday, 23 September 2016 03:50:19 UTC+2, Martin DeMello wrote:
>
> If I have the following code:
>
> type Cell = Empty | Letter String
>
> type alias Square =
>   { cell : Cell
>   , num : Int
>   } 
>
> and c : Maybe Square,
>
> can I do the following in a single match?
>  
>   case c of
>     Just { cell } ->
>       case cell of
>         Letter s -> s
>         _ -> ""
>     _ -> ""
>
> that is, i conceptually want
>
>   case c of
>     Just { cell = Letter s } -> s
>     _ -> ""
>
> martin
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to