packages feed

intermediate-structures (empty) → 0.1.0.0

raw patch · 5 files changed

+128/−0 lines, 5 filesdep +base

Dependencies added: base

Files

+ CHANGELOG.md view
@@ -0,0 +1,6 @@+# Revision history for intermediate-structures++## 0.1.0.0 -- 2024-01-05++* First version. Released on an unsuspecting world. The function mapI is taken from the mmsyn5 package. This inspired some more general functionality.+
+ Data/IntermediateStructures1.hs view
@@ -0,0 +1,49 @@+-- |+-- Module      :  Data.IntermediateStructures1+-- Copyright   :  (c) Oleksandr Zhabenko 2019-2024+-- License     :  MIT+-- Maintainer  :  oleksandr.zhabenko@yahoo.com+--+-- Some simple functions to deal with transformations from structures to other ones, basically lists.+--+-- The function 'mapI' is taken from the [mmsyn5](https://hackage.haskell.org/package/mmsyn5) package. This inspired some more general functionality.++{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_HADDOCK -show-extensions #-}+++module Data.IntermediateStructures1+ (+    -- * Operations to apply a function or two different functions to an element of the outer list (some of them create inner list)  +       mapI+       , map2I+    -- * Generalized construction functions for some other ones (generative functions)+       , inter+       , swapinter+  )+where++import GHC.Base+import GHC.List (concatMap)++-- | 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 #-}++-- | 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 #-}++-- | 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+inter fb fc f3d x = f3d x (fb x) (fc x) +{-# INLINE inter #-}++-- | A variant of the 'inter' with swapped two first arguments. The following takes place:+-- > swapinter f g == inter g f+swapinter :: (a -> c) -> (a -> b) -> (a -> b -> c -> d) -> a -> d+swapinter fc fb f3d x = f3d x (fb x) (fc x)+{-# INLINE swapinter #-}+
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2019-2024 Oleksandr Zhabenko++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ README.md view
@@ -0,0 +1,22 @@+ 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).++Besides, 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
@@ -0,0 +1,31 @@+cabal-version:      3.0+name:               intermediate-structures+version:            0.1.0.0+synopsis:+    Some simple functions to deal with transformations from structures to other ones, basically lists.++description:        +    The function mapI is taken from the [mmsyn5](https://hackage.haskell.org/package/mmsyn5) package. This inspired some more general functionality.++homepage:           https://hackage.haskell.org/package/intermediate-structures+license:            MIT+license-file:       LICENSE+author:             Oleksandr Zhabenko+maintainer:         oleksandr.zhabenko@yahoo.com+copyright:          Oleksandr Zhabenko+bug-reports:        https://github.com/Oleksandr-Zhabenko/intermediate-structures/issues+category:           Data+build-type:         Simple+extra-doc-files:    CHANGELOG.md, README.md++common warnings+    ghc-options: -Wall++library+    import:           warnings+    exposed-modules:  Data.IntermediateStructures1+    -- other-modules:+    other-extensions: NoImplicitPrelude+    build-depends:    base >=4.13 && <5+    hs-source-dirs:   .+    default-language: Haskell2010