packages feed

lawful-conversions

Lawful typeclasses for bidirectional conversion between types

view on Hackage

= Summary Lawful typeclasses capturing three patterns of bidirectional mapping and forming a layered hierarchy with an ascending strictness of laws. 1. Smart constructor 2. Canonicalization or lossy conversion 3. Isomorphism or lossless conversion = The conversion problem Have you ever looked for a @toString@ function? How often do you import @Data.Text.Lazy@ only to call its @fromStrict@? How about importing @Data.ByteString.Builder@ only to call its @toLazyByteString@ and then importing @Data.ByteString.Lazy@ only to call its @toStrict@? Those all are instances of one pattern. They are conversions between different representations of the same information. Codebases that don't attempt to abstract over this pattern tend to be sprawling with this type of boilerplate. It's noise to the codereader, it's a burden to the implementor and the maintainer. = Why another conversion library? Many libraries exist that approach the conversion problem. However most of them provide lawless typeclasses leaving it up to the author of the instance to define what makes a proper conversion. This results in inconsistencies across instances, their behaviour not being evident to the user and no way to check whether an instance is correct. This library tackles this problem with a lawful typeclass hierarchy, making it evident what any of its instances do and it provides property-tests for you to validate your instances. The laws and the concepts are based on set and category theories. = Prior work and acknowledgements This library is an offspring of the "[isomorphism-class](https://hackage.haskell.org/package/isomorphism-class)" library, expanding upon the patterns discovered there. Both libraries are maintained letting their designs compete. Some ideas and concepts are also shared with the following libraries: - [control-iso](https://hackage.haskell.org/package/control-iso) - [type-iso](https://hackage.haskell.org/package/type-iso) - [injections](https://hackage.haskell.org/package/injections)
versionuploadeduploaderchanges
0.4.02026-03-11 12:27 UTCNikitaVolkov+26/−441 lines, 28 filesdep −timedep −uuid-typesPVP ok
0.3.12026-01-18 05:16 UTCNikitaVolkov+4/−3 lines, 2 filesPVP ok
0.3.0.42026-01-17 12:06 UTCNikitaVolkov+38/−21 lines, 5 filesPVP ok
0.3.0.32026-01-13 09:28 UTCNikitaVolkov+2/−2 lines, 1 filesdep ~quickcheck-instancesPVP ok
0.3.0.22026-01-07 15:30 UTCNikitaVolkov+2/−2 lines, 1 filesdep ~containersPVP ok
0.3.0.12025-08-25 14:49 UTCNikitaVolkov+3/−5 lines, 3 filesPVP ok
0.32025-08-25 14:10 UTCNikitaVolkov+139/−56 lines, 18 filesPVP ok
0.2.0.12025-08-20 18:02 UTCNikitaVolkov+5/−4 lines, 2 filesPVP ok
0.22025-08-17 13:33 UTCNikitaVolkov+256/−238 lines, 70 filesPVP ok
0.1.72025-05-14 15:02 UTCNikitaVolkov+17/−1 lines, 3 filesPVP ok
0.1.6.12025-04-06 09:37 UTCNikitaVolkov+153/−170 lines, 5 filesPVP ok
0.1.62024-12-23 12:08 UTCNikitaVolkov+45/−4 lines, 4 filesPVP ok
0.1.52024-12-21 19:42 UTCNikitaVolkov+64/−15 lines, 7 filesPVP ok
0.1.4.12024-12-07 08:12 UTCNikitaVolkov+2/−2 lines, 1 filesdep ~tasty-quickcheckPVP ok
0.1.42024-12-05 08:33 UTCNikitaVolkov+237/−102 lines, 13 filesPVP ok
0.1.32024-12-04 21:45 UTCNikitaVolkov+193/−12 lines, 12 filesdep +timePVP: major bump suggested
0.1.2.22024-12-04 20:08 UTCNikitaVolkov+9/−6 lines, 3 filesPVP ok
0.1.2.12024-12-04 18:37 UTCNikitaVolkov+161/−98 lines, 8 filesPVP: major bump suggested
0.1.22024-12-03 18:22 UTCNikitaVolkov+77/−1 lines, 8 filesdep +uuid-typesPVP ok
0.1.12024-12-03 02:48 UTCNikitaVolkov5 revisions+17/−1 lines, 6 files
0.12024-12-03 01:43 UTCNikitaVolkov+1866/−0 lines, 60 filesdep +QuickCheckdep +basedep +bytestring

Dependencies of lawful-conversions-0.4.0

QuickCheck >=2.13 && <3 2.18.0.0 → 2.19.0.0
2026-09-16 11:18 UTC2.19.0.0+67/−41 lines, 10 filesdep +OneTuplePVP ok
2026-02-26 12:42 UTC2.18.0.0+826/−542 lines, 23 filesPVP ok
2025-10-13 12:40 UTC2.17.1.0+18/−8 lines, 4 filesdep ~randomPVP: major bump suggested
2025-10-07 12:26 UTC2.17.0.0+667/−129 lines, 14 filesdep +data-array-bytedep +hintdep +splitdep −ghc-primdep −old-localedep −old-timedep ~basedep ~randomdep ~template-haskellPVP ok
2025-06-17 07:53 UTC2.16.0.0+477/−86 lines, 15 filesdep ~basenew-uploaderPVP ok

showing 5 of 66 versions

base >=4.12 && <5 4.22.0.0 → 4.22.1.0
2026-12-01 12:38 UTC4.22.1.0+388/−6 lines, 9 filesdep ~ghc-internalPVP: major bump suggested
2025-12-19 11:52 UTC4.22.0.0+886/−215 lines, 28 filesdep ~ghc-internalPVP ok
2026-03-27 12:26 UTC4.21.2.0+10/−3 lines, 4 filesdep ~ghc-internalPVP ok
2025-12-27 10:31 UTC4.21.1.0+17/−5 lines, 4 filesdep ~ghc-internalPVP ok
2024-12-16 09:24 UTC4.21.0.0+1170/−396 lines, 39 filesdep ~ghc-internalPVP ok

showing 5 of 61 versions

bytestring >=0.11.1.0 && <0.13 0.12.1.0 → 0.12.2.0
2024-12-06 21:41 UTC0.12.2.0+538/−437 lines, 44 filesdep ~QuickCheckdep ~basePVP ok
2024-02-16 03:27 UTC0.12.1.0+3398/−1642 lines, 37 filesdep +sybdep ~basePVP: major bump suggested
2023-08-16 01:53 UTC0.12.0.2+16/−2 lines, 3 files
2023-08-05 00:03 UTC0.12.0.1+47/−9 lines, 3 files
2023-07-07 01:45 UTC0.12.0.0+1459/−520 lines, 21 filesdep +data-array-bytePVP ok

showing 5 of 49 versions

containers >=0.6 && <0.9 0.8 → 0.8.1
2026-10-04 06:08 UTC0.8.1+8085/−5169 lines, 39 filesdep +template-haskell-liftdep ~arraydep ~deepseqPVP: major bump suggested
2025-03-01 13:03 UTC0.8+8447/−7031 lines, 37 filesnew-uploaderPVP ok
2023-09-27 12:15 UTC0.7+76/−33 lines, 3 filesPVP ok
2023-09-28 04:21 UTC0.6.8+644/−184 lines, 17 filesdep ~basedep ~deepseqPVP: major bump suggested
2023-02-01 03:11 UTC0.6.7+783/−229 lines, 20 filesPVP: major bump suggested

showing 5 of 43 versions

hashable >=1 && <2 1.5.0.0 → 1.5.1.0
2026-01-02 17:45 UTC1.5.1.0+7260/−6790 lines, 5 filesdep −HUnitdep −ghc-bignumdep −randomdep ~basedep ~containersPVP: major bump suggested
2024-07-04 19:38 UTC1.5.0.0+50/−156 lines, 4 filesdep −base-orphansdep −ghc-bignum-orphansdep −integer-gmpdep ~QuickCheckdep ~basedep ~bytestringPVP ok
2024-06-24 10:44 UTC1.4.7.0+8/−3 lines, 2 filesPVP ok
2024-06-09 19:43 UTC1.4.6.0+60/−83 lines, 7 filesdep −test-frameworkdep −test-framework-hunitdep −test-framework-quickcheck2PVP ok
2024-06-08 14:07 UTC1.4.5.0+7338/−256 lines, 15 filesdep +primitivedep +tastydep +tasty-hunitdep ~basedep ~bytestringdep ~containersPVP ok

showing 5 of 52 versions

primitive >=0.7 && <0.10 0.9.0.0 → 0.9.1.0
2025-03-31 14:42 UTC0.9.1.0+225/−135 lines, 12 filesdep +containersdep −ghc-primdep ~basePVP: major bump suggested
2023-10-05 15:07 UTC0.9.0.0+995/−657 lines, 17 filesdep ~QuickCheckdep ~basedep ~tastyPVP ok
2023-02-20 16:20 UTC0.8.0.0+328/−248 lines, 9 filesdep +data-array-bytedep ~basedep ~deepseqPVP ok
2022-05-20 18:46 UTC0.7.4.0+244/−146 lines, 10 filesdep +template-haskelldep −faildep −semigroupsdep ~basedep ~transformersPVP ok
2021-10-27 19:26 UTC0.7.3.0+951/−947 lines, 25 filesdep +tasty-benchdep ~basedep ~deepseqdep ~transformerssetup-changedPVP: major bump suggested

showing 5 of 30 versions

profunctors >=5 && <6 5.6.2 → 5.6.3
2025-06-17 11:50 UTC5.6.3+24/−66 lines, 10 filesdep −semigroupsdep ~basePVP: major bump suggested
2021-02-17 14:50 UTC5.6.2+31/−2 lines, 3 filesdep ~base-orphansdep ~semigroupsdep ~transformersPVP ok
2020-12-31 12:05 UTC5.6.1+57/−174 lines, 17 filesdep ~base-orphansdep ~bifunctorsdep ~comonadPVP: major bump suggested
2020-10-01 11:25 UTC5.6+166/−85 lines, 16 filesdep ~basePVP ok
2020-02-13 19:20 UTC5.5.2+35/−1 lines, 5 filesPVP ok

showing 5 of 44 versions

quickcheck-instances >=0.3.32 && <0.5 0.3.33 → 0.4
2026-01-08 11:48 UTC0.4+29/−227 lines, 7 filesdep −OneTupledep ~QuickCheckdep ~arraydep ~basePVP ok
2025-06-03 21:29 UTC0.3.33+25/−6 lines, 3 filesdep ~QuickCheckdep ~vectorPVP: major bump suggested
2024-11-04 11:57 UTC0.3.32+25/−7 lines, 3 filesdep ~basePVP ok
2024-05-16 22:12 UTC0.3.31 outside bounds+54/−235 lines, 26 filesdep −bytestring-builderdep −natsdep −semigroupsdep ~OneTupledep ~QuickCheckdep ~arrayPVP: major bump suggested
2023-10-04 18:05 UTC0.3.30 outside bounds+46/−17 lines, 3 filesdep ~basedep ~bytestringdep ~primitivePVP ok

showing 5 of 42 versions

rebase >=1.15 && <2 1.22 → 1.23
2026-01-28 07:06 UTC1.23+506/−2688 lines, 366 filesdep +uuiddep −uuid-typesPVP ok
2026-01-07 15:10 UTC1.22+4/−11 lines, 2 filesdep ~containersdep ~timePVP ok
2025-01-30 04:05 UTC1.21.2+2/−2 lines, 1 filesdep ~timePVP ok
2024-07-14 08:33 UTC1.21.1+2/−2 lines, 1 filesdep ~hashablePVP ok
2024-06-18 07:20 UTC1.21+6/−117 lines, 18 filesPVP ok

showing 5 of 88 versions

tasty >=1.2.3 && <2 1.5.4 → 1.5.5
2026-10-20 23:13 UTC1.5.5+53/−26 lines, 7 filesdep +terminal-sizePVP ok
2026-03-25 20:04 UTC1.5.4+332/−166 lines, 22 filesdep −semigroupsPVP ok
2025-01-05 19:52 UTC1.5.3+36/−11 lines, 3 filesdep ~containersdep ~optparse-applicativePVP: major bump suggested
2024-11-03 00:34 UTC1.5.2+22/−5 lines, 4 filesdep ~basePVP ok
2024-06-22 10:14 UTC1.5.1+131/−63 lines, 10 filesdep ~basePVP: major bump suggested

showing 5 of 76 versions

tasty-quickcheck >=0.11 && <0.12 0.11 → 0.11.1
2025-01-05 19:53 UTC0.11.1+66/−33 lines, 4 filesdep +regex-tdfadep −pcre-lightdep ~QuickCheckdep ~basedep ~optparse-applicativePVP: major bump suggested
2024-06-22 10:14 UTC0.11+132/−49 lines, 4 filesdep ~QuickCheckPVP ok
2023-09-10 00:10 UTC0.10.3 outside bounds+52/−14 lines, 3 filesdep ~QuickCheckdep ~optparse-applicativedep ~randomnew-uploaderPVP ok
2021-11-20 19:17 UTC0.10.2 outside bounds+21/−13 lines, 3 filesdep ~basePVP: major bump suggested
2020-12-18 09:42 UTC0.10.1.2 outside bounds+27/−13 lines, 4 filesdep ~basePVP: major bump suggested

showing 5 of 23 versions

text >=1.2 && <2.2 2.1.4 → 2.1.5
2026-11-27 23:30 UTC2.1.5+33786/−32979 lines, 58 filesPVP: major bump suggested
2026-01-28 08:30 UTC2.1.4+30991/−20199 lines, 35 filesdep +template-haskell-liftdep ~QuickCheckdep ~template-haskellPVP ok
2025-08-01 20:08 UTC2.1.3+2107/−1827 lines, 30 filesdep +splitmixdep +temporarydep ~QuickCheckdep ~ghc-primdep ~template-haskellPVP ok
2024-10-26 13:22 UTC2.1.2+43588/−15378 lines, 41 filesdep ~basedep ~binaryPVP: major bump suggested
2024-02-16 22:16 UTC2.1.1+986/−412 lines, 26 filesdep ~QuickCheckdep ~ghc-primdep ~template-haskellPVP: major bump suggested

showing 5 of 83 versions

unordered-containers >=0.2 && <0.3 0.2.21 → 0.2.21.1
2026-11-30 10:13 UTC0.2.21.1+533/−177 lines, 9 filesPVP: major bump suggested
2025-12-13 23:09 UTC0.2.21+3999/−2731 lines, 20 filesdep −mtldep ~basedep ~bytestringdep ~deepseqPVP: major bump suggested
2025-10-02 07:28 UTC0.2.20.1+106/−52 lines, 12 filesPVP: major bump suggested
2024-01-09 06:48 UTC0.2.20+1023/−941 lines, 12 filesdep ~hashabledep ~template-haskellPVP: major bump suggested
2022-04-24 15:48 UTC0.2.19.1+88/−14 lines, 4 filesdep ~basedep ~template-haskellPVP: major bump suggested

showing 5 of 44 versions

vector >=0.12 && <0.14 0.13.1.0 → 0.13.2.0
2024-10-31 18:01 UTC0.13.2.0+5177/−672 lines, 53 filesdep −HUnitdep ~QuickCheckdep ~basedep ~doctestPVP: major bump suggested
2023-10-07 13:35 UTC0.13.1.0+302/−238 lines, 22 filesdep ~QuickCheckdep ~basedep ~doctestnew-uploaderPVP: major bump suggested
2022-06-19 19:35 UTC0.13.0.0+19079/−19259 lines, 70 filesdep +tasty-benchdep +tasty-inspection-testingdep +vector-streamdep −faildep −ghc-primdep −semigroupsdep ~basedep ~doctestdep ~primitivePVP ok
2021-09-21 16:21 UTC0.12.3.1+265/−191 lines, 13 filesdep ~basedep ~deepseqdep ~doctestPVP ok
2021-04-06 19:54 UTC0.12.3.0+1218/−39 lines, 11 filesdep ~basedep ~ghc-primPVP ok

showing 5 of 43 versions

Reverse dependencies

2 packages depend on lawful-conversions; 1 have bounds that exclude 0.4.0

xml-types-content 0.0.1.1 requires lawful-conversions >=0.1.5 && <0.2 excludes current (upper bound)
text-builder-lawful-conversions 0.1.4.1 requires lawful-conversions >=0.3 && <0.5