refined-with 0.2.0 → 0.2.1
raw patch · 3 files changed
+19/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Refined.WithRefine: unsafeWithRefine :: forall p ps a. a -> WithRefine ps p a
Files
- CHANGELOG.md +3/−0
- refined-with.cabal +1/−1
- src/Refined/WithRefine.hs +15/−3
CHANGELOG.md view
@@ -1,3 +1,6 @@+## 0.2.1 (2022-04-23)+ * add `unsafeWithRefine :: forall p ps a. a -> WithRefine ps p a`+ ## 0.2.0 (2022-04-23) * rename `unWithRefine` to `withoutRefine` * reorder `reallyUnsafeEnforce` typevars for visible type application
refined-with.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: refined-with-version: 0.2.0+version: 0.2.1 synopsis: Refinement types with an "refinement applied" switch. description: Please see README.md. category: Data
src/Refined/WithRefine.hs view
@@ -61,6 +61,9 @@ -- * Unsafe enforcing , reallyUnsafeEnforce + -- * Unsafe creation+ , unsafeWithRefine+ -- * Other definitions , WithRefineRep ) where@@ -106,9 +109,9 @@ instance (FromJSON a, Predicate p a) => FromJSON (WithRefine 'Enforced p a) where parseJSON a = parseJSON a >>= enforceFail --- | I don't really understand this. I naively use the same role annotation as--- 'Refined'. GHC user's guide page:--- https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/roles.html+-- TODO I don't really understand this. I naively use the same role annotation+-- as 'Refined'. GHC user's guide page:+-- https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/roles.html type role WithRefine nominal nominal nominal -- | Wrap a value with any unenforced predicate. This is like tagging your value@@ -169,6 +172,15 @@ -- is usually obvious to the compiler. reallyUnsafeEnforce :: forall p a. a -> WithRefine 'Enforced p a reallyUnsafeEnforce = WithRefine++-- | Wrap a value with any predicate, enforced or unenforced. This is useful for+-- "no-op" refinements, potentially letting you to merge two instances into+-- one, where you explicitly ignore the 'PredicateStatus' (perhaps clearer).+--+-- You should only use this if you can prove that the refinement holds for all+-- values of @a@.+unsafeWithRefine :: forall p ps a. a -> WithRefine ps p a+unsafeWithRefine = WithRefine -- | Not very useful, but clarifies the meaning of enforced and unenforced -- refinements.