purescript-foreign
purescript-foreign copied to clipboard
Remove the `F` and `FT` alias (pending auto-migration tool)
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
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.
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.
I'm in favor of dropping the alias. I'm not sure when we'll get a automatic upgrading tool.
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 = ...
Sounds like a good compromise to me :+1:
Done!