intermediate-structures-0.1.1.0: Some simple functions to deal with transformations from structures to other ones, basically lists.
Copyright(c) Oleksandr Zhabenko 2019-2024
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
Safe HaskellNone
LanguageHaskell2010

Data.IntermediateStructures1

Description

Some simple functions to deal with transformations from structures to other ones, basically lists.

The function mapI is taken from the mmsyn5 package. This inspired some more general functionality.

Synopsis
  • mapI :: (a -> Bool) -> (a -> [a]) -> [a] -> [a]
  • map2I :: (a -> Bool) -> (a -> [[a]]) -> [a] -> [a]
  • inter :: (a -> b) -> (a -> c) -> (a -> b -> c -> d) -> a -> d
  • inter' :: (a -> b) -> (a -> c) -> (a -> b -> c -> d) -> a -> d
  • swapinter :: (a -> c) -> (a -> b) -> (a -> b -> c -> d) -> a -> d
  • swapinter' :: (a -> c) -> (a -> b) -> (a -> b -> c -> d) -> a -> d

Operations to apply a function or two different functions to an element of the outer list (some of them create inner list)

mapI :: (a -> Bool) -> (a -> [a]) -> [a] -> [a] Source #

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] Source #

Function that applies additional function f :: a -> [[a]] to a if p :: a -> Bool and p a = True

Generalized construction functions for some other ones (generative functions)

inter :: (a -> b) -> (a -> c) -> (a -> b -> c -> d) -> a -> d Source #

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 Source #

A variant of inter with 'stricter' calculation scheme. Can be in many cases more efficient.

swapinter :: (a -> c) -> (a -> b) -> (a -> b -> c -> d) -> a -> d Source #

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 Source #

A variant of the swapinter with 'stricter' calculation scheme. Can be in many cases more efficient.