Tried for a while to come up with other ideas that do not use an extended
record but not able to find anything useful. I ended up having to release
the library (https://github.com/OvermindDL1/elm-jsphoenix if anyone has
some ideas for ways to fix the presence record wart) with instructions to
copy the required record parts into their own record instead of being able
to specify just the parts they can specify. This is horrible to look at
though... Any work-around ideas?
On Tuesday, July 19, 2016 at 1:57:02 PM UTC-6, OvermindDL1 wrote:
>
> Two questions about ports.
>
> 1) Why is Dict not supported? I have a dictionary of mixed
> string/integers keys and a concrete record-stable from JSON passed in via a
> port, everything else decomposes fine into a type except for it.
>
>
> 2) And this is my big question that I am having trouble working around
> without great verbosity. I have these types:
> ```elm
> type alias PresenceMeta metaUserType =
> { metaUserType
> | phx_ref : String
> }
>
> type alias RoomSyncMetas =
> { loc : String
> , online_at : String
> }
>
> type alias Testeringa =
> PresenceMeta RoomSyncMetas
>
> ```
>
> And a port like:
> ```elm
> port testering : (Testeringa -> msg) -> Sub msg
> ```
> And it generates this error:
> ```elm
> Port `testering` is trying to communicate an unsupported type.
>
> 173| port testering : (Testeringa -> msg) -> Sub msg
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> The specific unsupported type is the following extended record:
>
> { phx_ref : String, loc : String, online_at : String }
>
> The types of values that can flow through in and out of Elm include:
>
> Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples,
> Json.Values,
> and concrete records.
> ```
>
> So it says that `{ phx_ref : String, loc : String, online_at : String }`
> is not a supported type, which seems... odd. So I change the Testeringa
> type to:
> ```elm
> type alias Testeringa =
> { phx_ref : String
> , loc : String
> , online_at : String
> }
> ```
> And no other changes, and then it compiles fine.
>
> My initial reaction to this is wtf...? What did I break?!
>
--
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.