I'm curious if it's possible to use extensible records for HTML attributes 
instead of lists of function application such as [id "foo", class "bar"]?
I've poked around a bit, but didn't find too much on specifically this. For 
example, something along the lines of this:


  let x = anchor { href = "#", id = Just "root" }


Something along the lines of defining common attributes all being maybe 
types, and then combining it with a record passed to a function.


  type alias CommonAttrs a =
   { a | id : Maybe String, class : Maybe String }

  commonAttrs : a -> CommonAttrs a
  commonAttrs x =
    { x | id = Nothing, class = Nothing }

  anchor : { a | href : String } -> CommonAttrs { href : String }
  anchor attrs =
    commonAttrs attrs


I know that's not going to work, but something along those lines. I'm new 
to Elm and only somewhat familiar with Haskell.

Thoughts?

-- 
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