purescript / purescript-st

The ST effect, for safe local mutation
BSD 3-Clause "New" or "Revised" License
25 stars 25 forks source link

Adds uncurried ST functions #52

Closed mikesol closed 2 years ago

mikesol commented 2 years ago

Description of the change

This PR is a copy-paste of Effect's uncurried functions with an additional nominal type parameter.


Checklist:

mikesol commented 2 years ago

Apologies for the many failed builds, I was too lazy to do the pulp setup on my machine so I just let the CI fail my way to success.

JordanMartinez commented 2 years ago

Can you add a changelog update?

mikesol commented 2 years ago

Do folks think the nominal parameter should appear first in the ST functions? Currently, it's:

STFn10 t a b c d e f g h i j r

but it could be instead

STFn10 a b c d e f g h i j t r

I almost always lead with nominal parameters, but if we did it this way, the order of parameters would follow the type better.

JordanMartinez commented 2 years ago

Hm.... If it was at the end but before r, then one could define type aliases like:

--   StFnInt3 t r = StFn Int Int Int t r
type StFnInt3     = StFn Int Int Int

vs

StFnInt3 t = StFn Int Int Int t

I guess that's better?

mikesol commented 2 years ago

Hm.... If it was at the end but before r, then one could define type aliases like:

--   StFnInt3 t r = StFn Int Int Int t r
type StFnInt3     = StFn Int Int Int

vs

StFnInt3 t = StFn Int Int Int t

I guess that's better?

Changed.

As per the discussion here: https://github.com/purescript/purescript/pull/4386#issuecomment-1237618380, I think this should be merged before we review the compiler change. Let me know if anyone objects.

JordanMartinez commented 2 years ago

@garyb Can this get an approval?