# Rerefined: Refinement types, again (refined rewrite)

**URL:** <https://discourse.haskell.org/t/rerefined-refinement-types-again-refined-rewrite/9447>\
**Category:** Show and Tell\
**Created:** [April 30, 2024, 4:20pm UTC](https://discourse.haskell.org/t/rerefined-refinement-types-again-refined-rewrite/9447 "2024-04-30T16:20:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raehik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/raehik/32/5337_2.png) [@raehik](https://discourse.haskell.org/u/raehik)\
**Post date:** [April 30, 2024, 4:20pm UTC](https://discourse.haskell.org/t/rerefined-refinement-types-again-refined-rewrite/9447/1 "2024-04-30T16:20:40Z")

</div>

> **[rerefined](https://hackage.haskell.org/package/rerefined)**
>
> Refinement types, again

refined is broken for GHC 9.8 (+ 9.10) due to [pending dependency bound bumps](https://github.com/nikita-volkov/refined/pull/103), and I have some gripes with it (aeson dependency, [Typeable constraints](https://github.com/nikita-volkov/refined/issues/101), no support for [functor predicates](https://github.com/nikita-volkov/refined/issues/94), arbitrary overlapping terminology with my [strongweak](https://hackage.haskell.org/package/strongweak) library). rerefined resolves these in less code with fewer dependencies.

Thanks to some design improvements we can get away with some neat tricks, like replacing the `Weaken` type class with a single type family for widening relational operations (see [WidenRelOp](https://hackage.haskell.org/package/rerefined-0.1.0/docs/Rerefined-Predicate-Relational-Internal.html#t:WidenRelOp) and the other `Predicate.Relational` modules).

I had wanted to write this for a while, and once I saw the Typeable and GHC 9.8 issues I figured it was worthwhile. For anyone using `refined`, you should be able to switch if you like, but it’s lots of definition name changes and I haven’t finished checking coercion safety (you may be able to shoot yourself in the foot in new, fresh ways). I’d be keen to write a compatibility shim and/or a switching guide if there’s any interest at all.

/r/haskell post: [https://www.reddit.com/r/haskell/comments/1cgwikh](https://www.reddit.com/r/haskell/comments/1cgwikh)

---

<div class="post-metadata">

**Author:** ![tomjaguarpaw](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tomjaguarpaw/32/1230_2.png) [@tomjaguarpaw](https://discourse.haskell.org/u/tomjaguarpaw)\
**Post date:** [April 30, 2024, 5:10pm UTC](https://discourse.haskell.org/t/rerefined-refinement-types-again-refined-rewrite/9447/2 "2024-04-30T17:10:08Z")

</div>

If it’s just bounds bumping that’s the problem then users of `refined` should [file an issue with the Hackage Trustees](https://github.com/haskell-infra/hackage-trustees/issues).

EDIT: Well, it’s clearly not _just_ bounds bumping, because `rerefined` has many other benefits, but I mean for those who do want to still use `refined` for whatever reason, that’s what they can do.

---

<div class="post-metadata">

**Author:** ![raehik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/raehik/32/5337_2.png) [@raehik](https://discourse.haskell.org/u/raehik)\
**Post date:** [April 30, 2024, 5:26pm UTC](https://discourse.haskell.org/t/rerefined-refinement-types-again-refined-rewrite/9447/3 "2024-04-30T17:26:04Z")

</div>

Thanks, I didn’t know about that Hackage trustees repo. To clarify, I don’t suggest refined users swap. I noted the likely experience you’d have if you wanted to swap, for whatever reason (e.g. if you are writing libraries using refined and want the same improvements I do).
