You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to make Posix a type that could flow freely over ports?
Background
I'm in the progress of upgrading a project from 0.18 to 0.19 (new release looks great, thanks!) and ran into a slight hiccup with the new Posix type. Unlike the old Time type which was just an alias for Float, the new Posix type is opaque so I can't use it interchangeably with it's basic type (now Int in 0.19). I actually like that this forces me to use Posix consistently everywhere.
The issue is that I used to send a lot of records containing timestamps over ports. In 0.18 this worked seamlessly with time values being treated as Floats, but now I get errors like the following one:
The `user` port is trying to transmit a `Posix` value:
87| port user : User -> Cmd msg
^^^^^^^^^^^^
I cannot handle that. The types that CAN flow in and out of Elm include:
Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, tuples, records, and
JSON values.
Given that Posix is really just an Int (and is unlikely to ever change given the nature of that data) it seems a shame to have to create a new record type and manually covert Posix to Int before sending the data over the port. Would it be possible to make Posix a type that could flow freely over ports? I don't know how much work that involves and I'm not sure if there might be unintended consequences to this proposal, but I wanted to throw it out there.
The text was updated successfully, but these errors were encountered:
TL;DR
Would it be possible to make
Posix
a type that could flow freely over ports?Background
I'm in the progress of upgrading a project from 0.18 to 0.19 (new release looks great, thanks!) and ran into a slight hiccup with the new
Posix
type. Unlike the oldTime
type which was just an alias forFloat
, the newPosix
type is opaque so I can't use it interchangeably with it's basic type (nowInt
in 0.19). I actually like that this forces me to usePosix
consistently everywhere.The issue is that I used to send a lot of records containing timestamps over ports. In 0.18 this worked seamlessly with time values being treated as
Float
s, but now I get errors like the following one:Given that
Posix
is really just anInt
(and is unlikely to ever change given the nature of that data) it seems a shame to have to create a new record type and manually covertPosix
toInt
before sending the data over the port. Would it be possible to makePosix
a type that could flow freely over ports? I don't know how much work that involves and I'm not sure if there might be unintended consequences to this proposal, but I wanted to throw it out there.The text was updated successfully, but these errors were encountered: