refined 0.6.3 → 0.7
raw patch · 5 files changed
+15/−8 lines, 5 files
Files
- changelog.md +4/−0
- refined.cabal +1/−1
- src/Refined.hs +7/−6
- src/Refined/Unsafe.hs +1/−0
- src/Refined/Unsafe/Type.hs +2/−1
changelog.md view
@@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## Unreleased+### [0.7] - 2022-07-01+- make `Refined` predicate type `p` kind polymorphic (`p :: Type` -> `p :: k`)+ ## [0.6.3] - 2022-01-14 ### Added - `Hashable` instance for `Refined`
refined.cabal view
@@ -3,7 +3,7 @@ name: refined version:- 0.6.3+ 0.7 synopsis: Refinement types with static and runtime checking description:
src/Refined.hs view
@@ -45,6 +45,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PackageImports #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-}@@ -567,7 +568,7 @@ ) -- | @since 0.1.0.0-instance (Predicate p x, Typeable p) => Predicate (Not p) x where+instance (Predicate (p :: k) x, Typeable p, Typeable k) => Predicate (Not p) x where validate p x = do maybe (Just (RefineNotException (typeRep p))) (const Nothing)@@ -598,7 +599,7 @@ type (&&) = And -- | @since 0.1.0.0-instance ( Predicate l x, Predicate r x, Typeable l, Typeable r+instance ( Predicate (l :: k) x, Predicate (r :: k) x, Typeable l, Typeable r, Typeable k ) => Predicate (And l r) x where validate p x = do let a = validate @l undefined x@@ -638,7 +639,7 @@ type (||) = Or -- | @since 0.2.0.0-instance ( Predicate l x, Predicate r x, Typeable l, Typeable r+instance ( Predicate (l :: k) x, Predicate (r :: k) x, Typeable l, Typeable r, Typeable k ) => Predicate (Or l r) x where validate p x = do let left = validate @l undefined x@@ -675,7 +676,7 @@ -- type (^) = Xor -- | @since 0.5-instance ( Predicate l x, Predicate r x, Typeable l, Typeable r+instance ( Predicate (l :: k) x, Predicate (r :: k) x, Typeable l, Typeable r, Typeable k ) => Predicate (Xor l r) x where validate p x = do let left = validate @l undefined x@@ -1277,7 +1278,7 @@ -- @since 0.2.0.0 type NonZero = NotEqualTo 0 --- | A 'Predicate' ensuring that the type is non-empty.+-- | A 'Predicate' ensuring that the type is empty. -- -- @since 0.5 type Empty = SizeEqualTo 0@@ -1292,7 +1293,7 @@ -- | A typeclass containing "safe" conversions between refined -- predicates where the target is /weaker/ than the source: -- that is, all values that satisfy the first predicate will--- be guaranteed to satisy the second.+-- be guaranteed to satisfy the second. -- -- Take care: writing an instance declaration for your custom -- predicates is the same as an assertion that 'weaken' is
src/Refined/Unsafe.hs view
@@ -29,6 +29,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE PolyKinds #-} #if __GLASGOW_HASKELL__ >= 805 {-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE RankNTypes #-}
src/Refined/Unsafe/Type.hs view
@@ -31,6 +31,7 @@ {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TemplateHaskell #-} @@ -54,7 +55,7 @@ -- | A refinement type, which wraps a value of type @x@. -- -- @since 0.1.0.0-newtype Refined p x+newtype Refined (p :: k) x = Refined x -- ^ @since 0.1.0.0 deriving newtype ( Eq -- ^ @since 0.1.0.0