purescript-foreign icon indicating copy to clipboard operation
purescript-foreign copied to clipboard

Remove the `F` and `FT` alias (pending auto-migration tool)

Open srghma opened this issue 5 years ago • 6 comments

it's useless alias that makes code harder to read (not my words, but I agree)

type F = Except MultipleErrors

but this will be a breaking change

srghma avatar Jul 10 '20 15:07 srghma

I would be in favor of dropping the alias. It allows to document the behaviour of the Alt instance for Except though (<|> accumulates foreign errors instead of keeping only the first one as it does for Either), so perhaps we should rather rename it to something more meaningful?

What we decide here will have consequences for https://github.com/purescript/purescript-foreign/pull/74.

kl0tl avatar Dec 21 '20 12:12 kl0tl

I'm not in favour of this. I generally agree that writing out Except MultipleErrors is better, but imo it's not better enough that we can justify asking people to rewrite existing code to silence deprecation warnings. I think we should wait until we have an automatic upgrading tool before tackling this.

hdgarrood avatar Dec 26 '20 16:12 hdgarrood

I'm in favor of dropping the alias. I'm not sure when we'll get a automatic upgrading tool.

JordanMartinez avatar Dec 04 '21 04:12 JordanMartinez

How about we update all code in this library to stop using the F and FT aliases, but otherwise keep them until we get a auto-migrate tool? For example

-- before
type FT = ExceptT MultipleErrors
unsafeReadTagged :: forall m a. Monad m => String -> Foreign -> FT m a
unsafeReadTagged tag value = ...

-- after
type FT = ExceptT MultipleErrors
unsafeReadTagged :: forall m a. Monad m => String -> Foreign -> ExceptT (NonEmptyList ForeignError) m a
unsafeReadTagged tag value = ...

JordanMartinez avatar Mar 15 '22 21:03 JordanMartinez

Sounds like a good compromise to me :+1:

garyb avatar Mar 15 '22 22:03 garyb

Done!

JordanMartinez avatar Mar 15 '22 22:03 JordanMartinez