On Tuesday, February 14, 2017 at 2:28:50 PM UTC, Rupert Smith wrote:
>
> Is there some way to avoid this, perhaps using extensible records?
>

I was kind of hoping something like this might work, but it doesn't:
 
type alias Positioned a =
    { a | rect : Rectangle }

type alias WithContent a =
    { a | content : Maybe String }

type State
    = Hidden {}
    | Aware (Positioned {})
    | Active (Positioned (WithContent {}))
    | Inactive (Positioned (WithContent {}))

toActive state = 
  case state of
    Aware position -> Active { position | content = Just "test" }
    _ -> state

I can't just add more fields to a record type with this: { position | 
content = Just "test" }, so I guess I have to manually copy over the fields.
 

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to