packages feed

uniform-algebras 0.1.3 → 0.1.5.1

raw patch · 5 files changed

+147/−78 lines, 5 filesdep +extraPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: extra

API changes (from Hackage documentation)

- Uniform.ListForm: type family LF l;
- Uniform.Pointless: ffh5 :: (a, b, c, d, e) -> e
- Uniform.Pointless: first :: (t -> a) -> (t, b) -> (a, b)
- Uniform.Pointless: first3 :: (a1 -> b) -> (a1, a2, a3) -> (b, a2, a3)
- Uniform.Pointless: first4 :: (a1 -> b) -> (a1, a2, a3, a4) -> (b, a2, a3, a4)
- Uniform.Pointless: fourth4 :: (a4 -> b) -> (a1, a2, a3, a4) -> (a1, a2, a3, b)
- Uniform.Pointless: fst3 :: (a, b, c) -> a
- Uniform.Pointless: fst4 :: (a, b, c, d) -> a
- Uniform.Pointless: fst5 :: (a, b, c, d, e) -> a
- Uniform.Pointless: fth4 :: (a, b, c, d) -> d
- Uniform.Pointless: fth5 :: (a, b, c, d, e) -> d
- Uniform.Pointless: second :: (t -> b) -> (a, t) -> (a, b)
- Uniform.Pointless: second3 :: (a2 -> b) -> (a1, a2, a3) -> (a1, b, a3)
- Uniform.Pointless: second4 :: (a2 -> b) -> (a1, a2, a3, a4) -> (a1, b, a3, a4)
- Uniform.Pointless: snd3 :: (a, b, c) -> b
- Uniform.Pointless: snd4 :: (a, b, c, d) -> b
- Uniform.Pointless: snd5 :: (a, b, c, d, e) -> b
- Uniform.Pointless: thd4 :: (a, b, c, d) -> c
- Uniform.Pointless: thd5 :: (a, b, c, d, e) -> c
- Uniform.Pointless: third3 :: (a3 -> b) -> (a1, a2, a3) -> (a1, a2, b)
- Uniform.Pointless: third4 :: (a3 -> b) -> (a1, a2, a3, a4) -> (a1, a2, b, a4)
- Uniform.Pointless: trd3 :: (a, b, c) -> c
- Uniform.Pointless: trd4 :: (a, b, c, d) -> c
- Uniform.Pointless: trd5 :: (a, b, c, d, e) -> c
+ Uniform.ListForm: type LF l;
+ Uniform.Pointless: assocl :: (a, (b, c)) -> ((a, b), c)
+ Uniform.Pointless: assocr :: ((a, b), c) -> (a, (b, c))
+ Uniform.Pointless: cond :: (a -> Bool) -> (a -> b, a -> b) -> a -> b
+ Uniform.Pointless: curry :: ((a, b) -> c) -> a -> b -> c
+ Uniform.Pointless: dup :: b -> (b, b)
+ Uniform.Pointless: dupl :: (a, (b, c)) -> ((a, b), (a, c))
+ Uniform.Pointless: dupr :: ((a, b), c) -> ((a, c), (b, c))
+ Uniform.Pointless: outl :: (a, b) -> a
+ Uniform.Pointless: outr :: (a, b) -> b
+ Uniform.Pointless: pair' :: (a -> b) -> (a, a) -> (b, b)
+ Uniform.Pointless: swap :: (a, b) -> (b, a)
+ Uniform.Pointless: uncurry :: (a -> b -> c) -> (a, b) -> c
+ Uniform.Tuples: both :: (a -> b) -> (a, a) -> (b, b)
+ Uniform.Tuples: ffh5 :: (a, b, c, d, e) -> e
+ Uniform.Tuples: first :: (a -> a') -> (a, b) -> (a', b)
+ Uniform.Tuples: first3 :: (a1 -> b) -> (a1, a2, a3) -> (b, a2, a3)
+ Uniform.Tuples: first4 :: (a1 -> b) -> (a1, a2, a3, a4) -> (b, a2, a3, a4)
+ Uniform.Tuples: fourth4 :: (a4 -> b) -> (a1, a2, a3, a4) -> (a1, a2, a3, b)
+ Uniform.Tuples: fst3 :: (a, b, c) -> a
+ Uniform.Tuples: fst4 :: (a, b, c, d) -> a
+ Uniform.Tuples: fst5 :: (a, b, c, d, e) -> a
+ Uniform.Tuples: fth4 :: (a, b, c, d) -> d
+ Uniform.Tuples: fth5 :: (a, b, c, d, e) -> d
+ Uniform.Tuples: second :: (b -> b') -> (a, b) -> (a, b')
+ Uniform.Tuples: second3 :: (a2 -> b) -> (a1, a2, a3) -> (a1, b, a3)
+ Uniform.Tuples: second4 :: (a2 -> b) -> (a1, a2, a3, a4) -> (a1, b, a3, a4)
+ Uniform.Tuples: snd3 :: (a, b, c) -> b
+ Uniform.Tuples: snd4 :: (a, b, c, d) -> b
+ Uniform.Tuples: snd5 :: (a, b, c, d, e) -> b
+ Uniform.Tuples: thd3 :: (a, b, c) -> c
+ Uniform.Tuples: thd4 :: (a, b, c, d) -> c
+ Uniform.Tuples: thd5 :: (a, b, c, d, e) -> c
+ Uniform.Tuples: third3 :: (a3 -> b) -> (a1, a2, a3) -> (a1, a2, b)
+ Uniform.Tuples: third4 :: (a3 -> b) -> (a1, a2, a3, a4) -> (a1, a2, b, a4)
+ Uniform.Tuples: trd3 :: (a, b, c) -> c
+ Uniform.Tuples: trd4 :: (a, b, c, d) -> c
+ Uniform.Tuples: trd5 :: (a, b, c, d, e) -> c
- Uniform.Pointless: cross :: (t1 -> a, t2 -> b) -> (t1, t2) -> (a, b)
+ Uniform.Pointless: cross :: (a -> c, b -> d) -> (a, b) -> (c, d)
- Uniform.Pointless: pair :: (t -> b) -> (t, t) -> (b, b)
+ Uniform.Pointless: pair :: (a -> b, a -> c) -> a -> (b, c)

Files

ChangeLog.md view
@@ -2,3 +2,13 @@     updating 0.0.9 versions in Workspace8 2019 for submission     cleaned up (mostly) 0.1.2 preparing for 9.2.1+  +0.1.3: added stack build lts 19.16 for ghc 9.0.2++0.1.3.3 split pointless and tuples to produce a tuples with nothing else module +    aligning with the function names from algebra of programming (import)+    import tuples from extra (to reduce duplications)+    removed aopPrelude (because not in 9.2.5)++0.1.5 branch for ghc 9.2.5+0.1.5.1
README.md view
@@ -12,7 +12,7 @@ - [uniform-pair](https://hackage.haskell.org/package/uniform-pair-0.1.15) - [basement](https://hackage.haskell.org/package/basement)  -# Intension of *uniform* packages+# Intention of *uniform* packages The *uniform* packages are yet another attempt to select a useful subset from the overwhelming variety of the Haskell biotop. It was started in the 2010, grew over the years but was never packaged and put into Hackage; it is comparable to other similar attempts from which it has learned and occasionally copied code.   The *uniform* approach is different from some others by:@@ -21,5 +21,5 @@ - avoid name clashes as far as possible, - combine logically connected operations in one place and in a form allowing coordinated use. -Issues with this approach: it is limited by the deeps of understanding of Haskell of the author and his experience. It shows a focus on understanding semantics (and formal ontology) linked to algebra applied to practical problems (Geographic Information Systems). +Issues with this approach: it is limited by the understanding of Haskell of the author and formed by his experience. It shows a focus on understanding semantics (and formal ontology) linked to algebra applied to practical problems (Geographic Information Systems).  It seems that efforts to construct coherent subsets of Haskell are limited by the complexity of the task -- the more comprehensive an environment should be the more complex is it to learn and use. The approach here is what emerged after some 25 years of using Haskell to write application oriented code, mostly to demonstrate theories in spatial information theory. 
Uniform/Pointless.hs view
@@ -1,87 +1,69 @@ --------------------------------------------------------------------- -- -- Module      :  Uniform.Pointless---              collecting some of the operations used in---              the book by+--              collecting some of the operations for a +--              pointless (pairs based) programming style  +--              demonstrated in the book by --              Bird \& deMoore \"The Algebra of Programming\"+--          which is available from hackage +--         https://hackage.haskell.org/package/aop-prelude-0.4.1.1  ---------------------------------------------------------------------- -module Uniform.Pointless (module Uniform.Pointless) where+module Uniform.Pointless (module Uniform.Pointless+                    -- , module AOPPrelude+                    ) where -pair :: (t -> b) -> (t, t) -> (b, b)-pair f (a, b) = (f a, f b) -cross :: (t1 -> a, t2 -> b) -> (t1, t2) -> (a, b)-cross (f, g) (a, b) = (f a, g b)--swapPair :: (b, a) -> (a, b)-swapPair (a, b) = (b, a)--first :: (t -> a) -> (t, b) -> (a, b)-first f (a, b) = (f a, b)--second :: (t -> b) -> (a, t) -> (a, b)-second f (a, b) = (a, f b)--fst3 :: (a, b, c) -> a-fst3 (x, y, z) = x--snd3 :: (a, b, c) -> b-snd3 (x, y, z) = y--trd3 :: (a, b, c) -> c-trd3 (x, y, z) = z--fst4 :: (a, b, c, d) -> a-fst4 (x, y, z, w) = x--snd4 :: (a, b, c, d) -> b-snd4 (x, y, z, w) = y--trd4 :: (a, b, c, d) -> c-trd4 (x, y, z, w) = z--thd4 :: (a, b, c, d) -> c-thd4 = trd4--fth4 :: (a, b, c, d) -> d-fth4 (x, y, z, w) = w--fst5 :: (a, b, c, d, e) -> a-fst5 (x, y, z, w, u) = x--snd5 :: (a, b, c, d, e) -> b-snd5 (x, y, z, w, u) = y--thd5 :: (a, b, c, d, e) -> c-thd5 (x, y, z, w, u) = z--trd5 :: (a, b, c, d, e) -> c-trd5 = thd5+-- import AOPPrelude (outl, outr, swap, assocl, assocr, dupl+--     , pair, cross, cond )+-- code copied from aop-prelude (partial)+    +-- const :: a -> b -> a+-- const k a = k+-- id :: a -> a+-- id a      = a+-- id and const are imported from regular prelude -fth5 :: (a, b, c, d, e) -> d-fth5 (x, y, z, w, u) = w+outl :: (a, b) -> a+outl (a, _) = a+outr :: (a, b) -> b+outr (_, b) = b+swap :: (a, b) -> (b, a)+swap (a, b) = (b, a) -ffh5 :: (a, b, c, d, e) -> e-ffh5 (x, y, z, w, u) = u+assocl :: (a, (b, c)) -> ((a, b), c)+assocl (a, (b, c)) = ((a, b), c)+assocr :: ((a, b), c) -> (a, (b, c))+assocr ((a, b), c) = (a, (b, c)) -first3 :: (a1 -> b) -> (a1, a2, a3) -> (b, a2, a3)-first3 f (a1, a2, a3) = (f a1, a2, a3)+dupl :: (a, (b, c)) -> ((a, b), (a, c))+dupl (a, (b, c)) = ((a, b), (a, c))+dupr :: ((a, b), c) -> ((a, c), (b, c))+dupr ((a, b), c) = ((a, c), (b, c)) -second3 :: (a2 -> b) -> (a1, a2, a3) -> (a1, b, a3)-second3 f (a1, a2, a3) = (a1, f a2, a3)+pair :: (a -> b, a -> c) -> a -> (b, c)+pair (f, g) a       = (f a, g a)+cross :: (a -> c, b -> d) -> (a, b) -> (c, d)+cross (f, g) (a, b) = (f a, g b)+cond :: (a -> Bool) -> (a -> b, a -> b) -> a -> b+cond p (f, g) a     = if p a then f a else g a -third3 :: (a3 -> b) -> (a1, a2, a3) -> (a1, a2, b)-third3 f (a1, a2, a3) = (a1, a2, f a3)+curry :: ((a, b) -> c) -> a -> b -> c+curry f a b      = f (a, b)+uncurry :: (a -> b -> c) -> (a, b) -> c+uncurry f (a, b) = f a b+-- pair :: (t -> b) -> (t, t) -> (b, b) -first4 :: (a1 -> b) -> (a1, a2, a3, a4) -> (b, a2, a3, a4)-first4 f (a1, a2, a3, a4) = (f a1, a2, a3, a4)+-- my old different definitions (with prime): -second4 :: (a2 -> b) -> (a1, a2, a3, a4) -> (a1, b, a3, a4)-second4 f (a1, a2, a3, a4) = (a1, f a2, a3, a4)+pair' :: (a->b) -> (a,a) -> (b,b)+pair' f (a, b) = (f a, f b) +-- ^ replace wth both -third4 :: (a3 -> b) -> (a1, a2, a3, a4) -> (a1, a2, b, a4)-third4 f (a1, a2, a3, a4) = (a1, a2, f a3, a4)+swapPair :: (b, a) -> (a, b)+-- | replace with swap+swapPair (a, b) = (b, a) -fourth4 :: (a4 -> b) -> (a1, a2, a3, a4) -> (a1, a2, a3, b)-fourth4 f (a1, a2, a3, a4) = (a1, a2, a3, f a4)+dup :: b -> (b, b)+-- make a pair from a value+dup a = (a,a)
+ Uniform/Tuples.hs view
@@ -0,0 +1,72 @@+---------------------------------------------------------------------+--+-- Module      :  Uniform.Tuples (beyond pairs)+                -- a restricted collection of operations on tuples +                -- and nothing else +                    -- with imports as far as I found similar code+----------------------------------------------------------------------++module  Uniform.Tuples (module Uniform.Tuples+                    , module Data.Tuple.Extra+                    ) where++import Data.Tuple.Extra (first, second, fst3, snd3, thd3, both)++trd3 :: (a, b, c) -> c+trd3 (x, y, z) = z++-- could copy from hledger-utils ++fst4 :: (a, b, c, d) -> a+fst4 (x, y, z, w) = x++snd4 :: (a, b, c, d) -> b+snd4 (x, y, z, w) = y++trd4 :: (a, b, c, d) -> c+trd4 (x, y, z, w) = z++thd4 :: (a, b, c, d) -> c+thd4 = trd4++fth4 :: (a, b, c, d) -> d+fth4 (x, y, z, w) = w++fst5 :: (a, b, c, d, e) -> a+fst5 (x, y, z, w, u) = x++snd5 :: (a, b, c, d, e) -> b+snd5 (x, y, z, w, u) = y++thd5 :: (a, b, c, d, e) -> c+thd5 (x, y, z, w, u) = z++trd5 :: (a, b, c, d, e) -> c+trd5 = thd5++fth5 :: (a, b, c, d, e) -> d+fth5 (x, y, z, w, u) = w++ffh5 :: (a, b, c, d, e) -> e+ffh5 (x, y, z, w, u) = u++first3 :: (a1 -> b) -> (a1, a2, a3) -> (b, a2, a3)+first3 f (a1, a2, a3) = (f a1, a2, a3)++second3 :: (a2 -> b) -> (a1, a2, a3) -> (a1, b, a3)+second3 f (a1, a2, a3) = (a1, f a2, a3)++third3 :: (a3 -> b) -> (a1, a2, a3) -> (a1, a2, b)+third3 f (a1, a2, a3) = (a1, a2, f a3)++first4 :: (a1 -> b) -> (a1, a2, a3, a4) -> (b, a2, a3, a4)+first4 f (a1, a2, a3, a4) = (f a1, a2, a3, a4)++second4 :: (a2 -> b) -> (a1, a2, a3, a4) -> (a1, b, a3, a4)+second4 f (a1, a2, a3, a4) = (a1, f a2, a3, a4)++third4 :: (a3 -> b) -> (a1, a2, a3, a4) -> (a1, a2, b, a4)+third4 f (a1, a2, a3, a4) = (a1, a2, f a3, a4)++fourth4 :: (a4 -> b) -> (a1, a2, a3, a4) -> (a1, a2, a3, b)+fourth4 f (a1, a2, a3, a4) = (a1, a2, a3, f a4)
uniform-algebras.cabal view
@@ -1,27 +1,26 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.35.0.+-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack ----- hash: f0777aca04edb42c7a8ef82729989bbfc57a7be3f3f5814f580d7abec55a396e+-- hash: d349eb33e63b6667b98afa5566a63b91ffe6816c16fb21b896551793ba014901  name:           uniform-algebras-version:        0.1.3+version:        0.1.5.1 synopsis:       Pointless functions and a simplistic zero and monoid description:    Simple algebras avoiding too much mathematical underpinning                 .                 - zero with test isZero, notZero (not a semigroupoid)                       exports also Maybe and Either                 .-                - pointless operations, e.g. tuples up to 4 or 5  +                - pointless operations, e.g. tuples up to 4 or 5, imported from Algebra of Programming (AOP) prelude                   .                 - ListForms (a monoid)                 .-                v 0.1.3: added stack build lts 19.16 for ghc 9.0.2-                .                 Please see the README on GitHub at <https://github.com/andrewufrank/uniform-algebras/readme> category:       Algebra Uniform+homepage:       https://github.com/git@github.com:andrewufrank/uniform-algebras.git#readme bug-reports:    https://github.com/andrewufrank/uniform-algebras/issues author:         Andrew Frank maintainer:     Andrew U. Frank <uniform@gerastree.at>@@ -32,11 +31,16 @@     README.md     ChangeLog.md +source-repository head+  type: git+  location: https://github.com/git@github.com:andrewufrank/uniform-algebras.git+ library   exposed-modules:       Uniform.ListForm       Uniform.Pointless       Uniform.Properties+      Uniform.Tuples       Uniform.Zero   autogen-modules: Paths_uniform_algebras   other-modules:@@ -45,6 +49,7 @@       ./   build-depends:       base >4.7 && <5+    , extra     , numeric-prelude     , test-invariant   default-language: Haskell2010