Skip to content

Don't import Safe ST modules for modern versions of base#23

Merged
mvv merged 2 commits intomvv:masterfrom
konsumlamm:master
Mar 9, 2026
Merged

Don't import Safe ST modules for modern versions of base#23
mvv merged 2 commits intomvv:masterfrom
konsumlamm:master

Conversation

@konsumlamm
Copy link
Copy Markdown
Contributor

Control.Monad.ST.Safe and Control.Monad.ST.Lazy.Safe are deprecated since base-4.8, so only import them for olderbase versions. I think it would be reasonable to drop support for base < 4.8, as that would allow to get rid of a bunch of CPP, but I have not done that in this PR.

With this change, transformers-base compiles with MicroHs, so update the .gitignore to also match dist-mcabal.

@mvv
Copy link
Copy Markdown
Owner

mvv commented Mar 7, 2026

Hello. Deprecated != unusable. People who opt for deprecated stuff in base should be able to use it with transformers-base. Why not simply guard code that breaks MicroHs with an #if that checks against that compiler?

@konsumlamm
Copy link
Copy Markdown
Contributor Author

Deprecated != unusable.

Sure, but it means that it might be removed in the future.

People who opt for deprecated stuff in base should be able to use it with transformers-base.

I'm not sure I understand. Control.Monad.ST and Control.Monad.ST.Safe literally export the same types and functions (as do Control.Monad.ST.Lazy and Control.Monad.ST.Lazy.Safe), so nothing changes for users of this library.

Why not simply guard code that breaks MicroHs with an #if that checks against that compiler?

I could do that, if you insist, but I don't see why that would be better.

@mvv
Copy link
Copy Markdown
Owner

mvv commented Mar 8, 2026

Ah, missed the same types bit. Could you keep the imports inside #if MIN_VERSION_base(4,4,0) && HS_TRANSFORMERS_BASE__ORPHANS intact and transform the second modified #if block to

#if MIN_VERSION_base(4,4,0)
# if MIN_VERSION_base(4,8,0)
import qualified Control.Monad.ST.Lazy as L
import qualified Control.Monad.ST.Strict as S
# else
import qualified Control.Monad.ST.Lazy.Safe as L
import qualified Control.Monad.ST.Safe as S
# endif
#endif

?

@konsumlamm
Copy link
Copy Markdown
Contributor Author

Like this?

@mvv mvv merged commit 149de0e into mvv:master Mar 9, 2026
0 of 10 checks passed
@mvv
Copy link
Copy Markdown
Owner

mvv commented Mar 9, 2026

Uploaded new version to Hackage. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants