intermediate-structures 0.1.1.0 → 0.1.2.0
raw patch · 4 files changed
+19/−28 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- Data/IntermediateStructures1.hs +13/−5
- README.md +1/−21
- intermediate-structures.cabal +1/−2
CHANGELOG.md view
@@ -8,3 +8,7 @@ * First version revised A. Added two new functions. +## 0.1.2.0 -- 2024-09-28++* First version revised B. Some code changes that reduce a generated stg code.+
Data/IntermediateStructures1.hs view
@@ -10,7 +10,7 @@ {-# LANGUAGE NoImplicitPrelude, BangPatterns #-} {-# OPTIONS_HADDOCK -show-extensions #-}-+{-# OPTIONS_GHC -O #-} module Data.IntermediateStructures1 (@@ -30,13 +30,21 @@ -- | Function that applies additional function @f :: a -> [a]@ to @a@ if @p :: a -> Bool@ and @p a = True@ mapI :: (a -> Bool) -> (a -> [a]) -> [a] -> [a]-mapI p f = concatMap (\x -> if p x then f x else [x])-{-# INLINE mapI #-}+mapI p f (x:xs) = + case p x of+ True -> f x `mappend` mapI p f xs+ _ -> x:mapI p f xs+mapI _ _ _ = []+{-# NOINLINE mapI #-} -- | Function that applies additional function @f :: a -> [[a]]@ to @a@ if @p :: a -> Bool@ and @p a = True@ map2I :: (a -> Bool) -> (a -> [[a]]) -> [a] -> [a]-map2I p f = mconcat . concatMap (\x -> if p x then f x else [[x]])-{-# INLINE map2I #-}+map2I p f (x:xs) = + case p x of+ True -> (mconcat . f $ x) `mappend` map2I p f xs+ _ -> x : map2I p f xs+map2I _ _ _ = []+{-# NOINLINE map2I #-} -- | Some general transformation where the arguments that are not present are calculated from the one data argument @a@ being just present. Can be used to contstruct function @a -> d@ from some additional ideas. inter :: (a -> b) -> (a -> c) -> (a -> b -> c -> d) -> a -> d
README.md view
@@ -1,24 +1,4 @@- Devotion- ========--The author would like to devote this project to support the [Foundation Gastrostars](https://gastrostars.nl).--The foundation founder is [Emma Kok](https://www.emmakok.nl).--On the 05/01/2024 Emma starts a world tour with [André Rieu and Johann Strauss Orchestra](https://www.andrerieu.com).--On the 06/01/2024 there are a feast of Epiphany, and Sophie's Kok, a sister of Emma, 19th Birthday (she is 18). Therefore, the version 0.1.1.0 is devoted also to her.--Besides, you can support Ukraine and Ukrainian people. +You can support Ukraine and Ukrainian people. All support is welcome, including donations for the needs of the Ukrainian army, IDPs and refugees.--If you would like to share some financial support with Gastrostars, please, contact the mentioned foundation-using the URL:--[Contact Foundation GASTROSTARS](https://gastrostars.nl/hou-mij-op-de-hoogte)--or --[Donation Page](https://gastrostars.nl/doneren)
intermediate-structures.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: intermediate-structures-version: 0.1.1.0+version: 0.1.2.0 synopsis: Some simple functions to deal with transformations from structures to other ones, basically lists. @@ -19,7 +19,6 @@ extra-doc-files: CHANGELOG.md, README.md common warnings- ghc-options: -Wall library import: warnings