pselm / signals

Purescript implementation of Elm 0.16's signals modules
Other
91 stars 2 forks source link

Reconsider treatment of Tuples #8

Closed rgrempel closed 8 years ago

rgrempel commented 8 years ago

When converting Elm functions that use Tuple parameters, I've been sometimes converting to Purescript's Data.Tuple, and sometimes to a record type ... e.g. something like { x :: Int, y :: Int} instead of Tuple Int Int.

My reasoning was that there is no syntactic sugar for Tuples in Purescript anyway, so any Elm code using those functions is going to have to change, one way or the other. So, I may as well switch to records in cases where records really make more sense.

However, there is (possibly) a flaw in this reasoning. If I consistently used Data.Tuple, then at least the change would be purely mechanical -- you could imagine automating it, for instance. Whereas that would be harder where I've used a record (the automation tool would have to know what the record fields are called).

So, perhaps I should reconsider and just use Tuples where Elm uses Tuples.

rgrempel commented 8 years ago

I have now implemented this in purescript-elm and purescript-elm-compat.

It was painful, but I think the logic of slavishly following the Elm APIs is sound.

texastoland commented 8 years ago

I agree Tuple also supports various type classes despite being unconventional.