packages feed

refined 0.1.0.0 → 0.1.1.0

raw patch · 2 files changed

+12/−3 lines, 2 files

Files

library/Refined.hs view
@@ -32,8 +32,17 @@ -- ensuring that it satisfies a type-level predicate @p@. newtype Refined p x =   Refined x-  deriving (Show, Read, Eq, Ord, Typeable, Data, Generic)+  deriving (Show, Eq, Ord, Typeable, Data, Generic) +instance (Read x, Predicate p x) => Read (Refined p x) where+  readsPrec d =+    readParen (d > 10) $ \r1 -> do+      ("Refined", r2) <- lex r1+      (raw,       r3) <- readsPrec 11 r2+      case refine raw of+        Right val -> [(val, r3)]+        Left  _   -> []+ instance TH.Lift x => TH.Lift (Refined p x) where   lift (Refined a) =     [|Refined a|]@@ -54,7 +63,7 @@ -- >>> $$(refineTH 23) :: Refined Positive Int -- Refined 23 -- --- Here's an example of an ivalid value:+-- Here's an example of an invalid value: --  -- >>> $$(refineTH 0) :: Refined Positive Int -- <interactive>:6:4:
refined.cabal view
@@ -1,7 +1,7 @@ name:   refined version:-  0.1.0.0+  0.1.1.0 synopsis:   Refinement types with static and runtime checking description: