diff --git a/docs/developers/CHANGELOG.md b/docs/developers/CHANGELOG.md index a2f9a7e..7b19b5a 100644 --- a/docs/developers/CHANGELOG.md +++ b/docs/developers/CHANGELOG.md @@ -1,5 +1,10 @@ # 📅 Revision history for HelVM Common +## 0.1.1.2 -- 2022-09-17 + +* Add `unfoldrM` +* Add `repeatedlyM` + ## 0.1.1.1 -- 2022-09-12 * Add `fromJustWithText` diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Extra.hs.html b/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Extra.hs.html deleted file mode 100644 index a661cd5..0000000 --- a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Extra.hs.html +++ /dev/null @@ -1,87 +0,0 @@ - -
- - - - -
-never executed always true always false
-
-- 1 module HelVM.HelIO.Extra ( - 2 toUppers, - 3 splitOneOf, - 4 showP, - 5 showToText, - 6 genericChr, - 7 (???), - 8 fromMaybeOrDef, - 9 headMaybe, - 10 fromJustWith, - 11 fromJustWithText, - 12 tee, - 13 ) where - 14 - 15 import Data.Char hiding (chr) - 16 import Data.Default - 17 import Data.Typeable - 18 import Text.Pretty.Simple - 19 - 20 import qualified Data.Text as Text - 21 - 22 -- | TextExtra - 23 - 24 toUppers :: Text -> Text - 25 toUppers = Text.map toUpper - 26 - 27 splitOneOf :: String -> Text -> [Text] - 28 splitOneOf s = Text.split contains where contains c = c `elem` s - 29 - 30 ---- - 31 - 32 showP :: Show a => a -> Text - 33 showP = toText . pShowNoColor - 34 - 35 showToText :: (Typeable a , Show a) => a -> Text - 36 showToText a = show a `fromMaybe` (cast a :: Maybe Text) - 37 - 38 -- | CharExtra - 39 - 40 genericChr :: Integral a => a -> Char - 41 genericChr = chr . fromIntegral - 42 - 43 -- | MaybeExtra - 44 - 45 infixr 0 ??? - 46 (???) :: Maybe a -> a -> a - 47 (???) = flip fromMaybe - 48 - 49 fromMaybeOrDef :: Default a => Maybe a -> a - 50 fromMaybeOrDef = fromMaybe def - 51 - 52 headMaybe :: [a] -> Maybe a - 53 headMaybe = viaNonEmpty head - 54 - 55 fromJustWith :: Show e => e -> Maybe a -> a - 56 fromJustWith e = fromJustWithText (show e) - 57 - 58 fromJustWithText :: Text -> Maybe a -> a - 59 fromJustWithText t Nothing = error t - 60 fromJustWithText _ (Just a) = a - 61 - 62 -- | Extra - 63 tee :: (a -> b -> c) -> (a -> b) -> a -> c - 64 tee f1 f2 a = f1 a $ f2 a - -- - diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Collections.MapList.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Collections.MapList.hs.html similarity index 99% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Collections.MapList.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Collections.MapList.hs.html index bdcc7f6..cf46672 100644 --- a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Collections.MapList.hs.html +++ b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Collections.MapList.hs.html @@ -55,7 +55,7 @@ 36 37 -- | Internal function 38 listFromDescList :: Default a => IndexedList a -> [a] - 39 listFromDescList = loop act . ( [] , ) where + 39 listFromDescList = loop act . ([] , ) where 40 act :: Default a => AccWithIndexedList a -> Either (AccWithIndexedList a) [a] 41 act (acc , [] ) = Right acc 42 act (acc , [(i , v)] ) = Right $ consDef i $ v : acc diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Collections.SList.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Collections.SList.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Collections.SList.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Collections.SList.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Containers.LLIndexSafe.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Containers.LLIndexSafe.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Containers.LLIndexSafe.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Containers.LLIndexSafe.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Containers.LLInsertDef.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Containers.LLInsertDef.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Containers.LLInsertDef.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Containers.LLInsertDef.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Containers.MTInsertDef.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Containers.MTInsertDef.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Containers.MTInsertDef.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Containers.MTInsertDef.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Control.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Control.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Control.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Control.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Logger.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Logger.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Logger.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Logger.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Message.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Message.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Message.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Message.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Safe.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Safe.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Control.Safe.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Control.Safe.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Digit.Digits.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Digit.Digits.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.Digit.Digits.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Digit.Digits.hs.html diff --git a/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Extra.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Extra.hs.html new file mode 100644 index 0000000..cd3c835 --- /dev/null +++ b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.Extra.hs.html @@ -0,0 +1,113 @@ + + + + + + +
+never executed always true always false
+
++ 1 module HelVM.HelIO.Extra ( + 2 toUppers, + 3 splitOneOf, + 4 showP, + 5 showToText, + 6 genericChr, + 7 (???), + 8 fromMaybeOrDef, + 9 headMaybe, + 10 fromJustWith, + 11 fromJustWithText, + 12 unfoldrM, + 13 -- unfoldr, + 14 repeatedlyM, + 15 repeatedly, + 16 tee, + 17 ) where + 18 + 19 import Data.Char hiding (chr) + 20 import Data.Default + 21 import Data.Typeable + 22 import Text.Pretty.Simple + 23 + 24 import qualified Data.Text as Text + 25 + 26 -- | TextExtra + 27 + 28 toUppers :: Text -> Text + 29 toUppers = Text.map toUpper + 30 + 31 splitOneOf :: String -> Text -> [Text] + 32 splitOneOf s = Text.split contains where contains c = c `elem` s + 33 + 34 -- | ShowExtra + 35 + 36 showP :: Show a => a -> Text + 37 showP = toText . pShowNoColor + 38 + 39 showToText :: (Typeable a , Show a) => a -> Text + 40 showToText a = show a `fromMaybe` (cast a :: Maybe Text) + 41 + 42 -- | CharExtra + 43 + 44 genericChr :: Integral a => a -> Char + 45 genericChr = chr . fromIntegral + 46 + 47 -- | MaybeExtra + 48 + 49 infixr 0 ??? + 50 (???) :: Maybe a -> a -> a + 51 (???) = flip fromMaybe + 52 + 53 fromMaybeOrDef :: Default a => Maybe a -> a + 54 fromMaybeOrDef = fromMaybe def + 55 + 56 headMaybe :: [a] -> Maybe a + 57 headMaybe = viaNonEmpty head + 58 + 59 fromJustWith :: Show e => e -> Maybe a -> a + 60 fromJustWith e = fromJustWithText (show e) + 61 + 62 fromJustWithText :: Text -> Maybe a -> a + 63 fromJustWithText t Nothing = error t + 64 fromJustWithText _ (Just a) = a + 65 + 66 -- | ListExtra + 67 + 68 unfoldrM :: Monad m => (a -> m (Maybe (b, a))) -> a -> m [b] + 69 unfoldrM f a = go =<< f a where + 70 go Nothing = pure [] + 71 go (Just (b, a')) = (b : ) <$> (go =<< f a') + 72 + 73 --unfoldr :: (a -> Maybe (b, a)) -> a -> [b] + 74 --unfoldr f = runIdentity . unfoldrM (Identity . f) + 75 + 76 repeatedlyM :: Monad m => ([a] -> m (b, [a])) -> [a] -> m [b] + 77 repeatedlyM f = go where + 78 go [] = pure [] + 79 go a = build =<< f a where build (b, a') = (b : ) <$> go a' + 80 + 81 repeatedly :: ([a] -> (b, [a])) -> [a] -> [b] + 82 repeatedly f = runIdentity . repeatedlyM (Identity . f) + 83 + 84 -- | Extra + 85 + 86 tee :: (a -> b -> c) -> (a -> b) -> a -> c + 87 tee f1 f2 a = f1 a $ f2 a + 88 + 89 --type Act s a = s -> Either s a + 90 --type ActM m s a = s -> m (Either s a) + ++ + diff --git a/docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.ListLikeExtra.hs.html b/docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.ListLikeExtra.hs.html similarity index 100% rename from docs/reports/helio-test/helio-0.1.1.1-inplace/HelVM.HelIO.ListLikeExtra.hs.html rename to docs/reports/helio-test/helio-0.1.1.2-inplace/HelVM.HelIO.ListLikeExtra.hs.html diff --git a/docs/reports/helio-test/hpc_index.html b/docs/reports/helio-test/hpc_index.html index 5794988..fe4f49b 100644 --- a/docs/reports/helio-test/hpc_index.html +++ b/docs/reports/helio-test/hpc_index.html @@ -7,42 +7,42 @@