packages feed

rerefined 0.1.0 → 0.2.0

raw patch · 9 files changed

+65/−11 lines, 9 files

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.2.0 (2024-05-01)+* add missing `Show` instance to `RefineFailure`+* add missing `Functor` instance to `Refined1`+* general cleanup+ ## 0.1.0 (2024-04-30) Initial release. 
rerefined.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           rerefined-version:        0.1.0+version:        0.2.0 synopsis:       Refinement types, again description:    Please see README.md. category:       Types, Data@@ -26,6 +26,7 @@  library   exposed-modules:+      Rerefined       Rerefined.Predicate       Rerefined.Predicate.Common       Rerefined.Predicate.Fail
+ src/Rerefined.hs view
@@ -0,0 +1,7 @@+module Rerefined+  ( module Rerefined.Refine+  , Predicate, Refine, Refine1+  ) where++import Rerefined.Refine+import Rerefined.Predicate
src/Rerefined/Predicate.hs view
@@ -60,4 +60,4 @@   -- ^ Any wrapped errors, for combinator predicates.   --   -- What these are, and their order, should be noted in 'refineFailureDetail'.-  }+  } deriving stock Show
src/Rerefined/Refine.hs view
@@ -1,6 +1,21 @@-{-# LANGUAGE OverloadedStrings, AllowAmbiguousTypes #-}+{-# LANGUAGE OverloadedStrings #-} -module Rerefined.Refine where+module Rerefined.Refine+  (+  -- * @Refined@+    type Refined+  , refine+  , unrefine++  -- * @Refined1@+  , type Refined1+  , refine1+  , unrefine1++  -- * Errors+  , type RefineFailure+  , prettyRefineFailure+  ) where  import Rerefined.Refined import Rerefined.Refined1
src/Rerefined/Refine/TH.hs view
@@ -5,8 +5,6 @@  import Rerefined.Refine import Rerefined.Predicate-import Rerefined.Refined-import Rerefined.Refined1 import Language.Haskell.TH.Syntax qualified as TH  -- | Refine @a@ with predicate @p@ at compile time via Template Haskell.
src/Rerefined/Refine/Unsafe.hs view
@@ -9,8 +9,19 @@ why the usage is safe. -} -module Rerefined.Refine.Unsafe where+module Rerefined.Refine.Unsafe+  (+  -- * @Refined@+    type Refined+  , unsafeRefine+  , unsafeRerefine +  -- * @Refined1@+  , type Refined1+  , unsafeRefine1+  , unsafeRerefine1+  ) where+ import Rerefined.Refined import Rerefined.Refined1 @@ -20,14 +31,21 @@ unsafeRefine :: a -> Refined p a unsafeRefine = Refined +-- | Replace a 'Refined''s predicate without validating the new prdicate @pNew@.+--+-- Unsafe. Use only when you can manually prove that the new predicate holds.+unsafeRerefine :: forall pNew pOld a. Refined pOld a -> Refined pNew a+unsafeRerefine = Refined . unrefine+ -- | Construct a 'Refined1' without validating the predicate @p@. -- -- Unsafe. Use only when you can manually prove that the predicate holds. unsafeRefine1 :: f a -> Refined1 p f a unsafeRefine1 = Refined1 --- | Replace a 'Refined''s predicate without validating the new prdicate @pNew@.+-- | Replace a 'Refined1''s predicate without validating the new prdicate+--   @pNew@. -- -- Unsafe. Use only when you can manually prove that the new predicate holds.-unsafeRerefine :: forall pNew pOld a. Refined pOld a -> Refined pNew a-unsafeRerefine = Refined . unrefine+unsafeRerefine1 :: forall pNew pOld f a. Refined1 pOld f a -> Refined1 pNew f a+unsafeRerefine1 = Refined1 . unrefine1
src/Rerefined/Refined.hs view
@@ -1,3 +1,8 @@+-- | 'Refined' definition.+--+-- Not intended for external use. For unsafe refines, use+-- 'Rerefined.Refine.Unsafe'.+ module Rerefined.Refined where  import Language.Haskell.TH.Syntax ( Lift )
src/Rerefined/Refined1.hs view
@@ -1,10 +1,15 @@+-- | 'Refined1' definition.+--+-- Not intended for external use. For unsafe refines, use+-- 'Rerefined.Refine.Unsafe'.+ module Rerefined.Refined1 where  import Language.Haskell.TH.Syntax ( Lift )  -- | @f a@ refined with predicate @p@. newtype Refined1 p f a = Refined1 (f a)-    deriving stock (Lift, Show) -- TODO Show? useful but meh?+    deriving stock (Functor, Lift, Show) -- TODO Show? useful but meh?  -- | Strip the refinement from a 'Refined1'. --