applicative-extras 0.1.2 → 0.1.3
raw patch · 2 files changed
+14/−5 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Control.Applicative.Error: maybeRead' :: (Read a) => String -> String -> Failing a
+ Control.Applicative.Error: tryToEnum :: (Enum a) => Int -> Failing a
- Control.Applicative.Error: maybeRead :: (Read a) => String -> String -> Failing a
+ Control.Applicative.Error: maybeRead :: (Read a) => String -> Maybe a
Files
- Control/Applicative/Error.hs +13/−4
- applicative-extras.cabal +1/−1
Control/Applicative/Error.hs view
@@ -20,11 +20,20 @@ Failure msgs' <*> Success _ = Failure msgs' Success f <*> Success x = Success (f x) +maybeRead :: Read a => String -> Maybe a+maybeRead s | [(i, _)] <- readsPrec 0 s = Just i+ | otherwise = Nothing+ -- | Tries to read a value. Shows an error message when reading fails.-maybeRead :: Read a => String -> String -> Failing a-maybeRead s msg | [(i, _)] <- readsPrec 0 s = Success i- | otherwise = Failure [msg]+maybeRead' :: Read a => String -> String -> Failing a+maybeRead' s msg | Just x <- maybeRead s = Success x+ | otherwise = Failure [msg] -- | Tries to read an Integer asInteger :: String -> Failing Integer-asInteger s = maybeRead s (s ++ " is not a valid integer")+asInteger s = maybeRead' s (s ++ " is not a valid integer")++-- | Tries conversion to an enum+tryToEnum :: Enum a => Int -> Failing a+tryToEnum x | value <- toEnum x = Success value+ | otherwise = Failure ["Conversion error"]
applicative-extras.cabal view
@@ -1,5 +1,5 @@ Name: applicative-extras-Version: 0.1.2+Version: 0.1.3 Synopsis: Instances for Applicative Description: Some instances for Applicative and type-level composition. Category: Control