packages feed

ap-normalize 0.1.0.0 → 0.1.0.1

raw patch · 4 files changed

+35/−6 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- ApNormalize: (&) :: () => a -> (a -> b) -> b
+ ApNormalize: (&) :: a -> (a -> b) -> b

Files

+ CHANGELOG.md view
@@ -0,0 +1,10 @@+Latest version: https://gitlab.com/lysxia/ap-normalize/-/blob/main/CHANGELOG.md++## 0.1.0.1++- No library changes.+- Fix test suite to build with clang's C preprocessor (default on MacOS).++## 0.1.0.0++- Create ap-normalize.
README.md view
@@ -64,6 +64,10 @@  ## Related links +The blog post [*Generic traversals with applicative difference+lists*](https://blog.poisson.chat/posts/2020-08-05-applicative-difference-lists.html)+gives an overview of the motivation and core data structure of this library.+ The same idea can be applied to monoids and monads. They are all applications of Cayley's representation theorem. 
ap-normalize.cabal view
@@ -1,7 +1,7 @@ cabal-version: >=1.10  name:    ap-normalize-version: 0.1.0.0+version: 0.1.0.1 synopsis: Self-normalizing applicative expressions description:   An applicative functor transformer to normalize expressions using @(\<$>)@,@@ -17,7 +17,7 @@ copyright:    Li-yao Xia 2020 category:     Control build-type:   Simple-extra-source-files:  README.md+extra-source-files:  CHANGELOG.md, README.md  library   hs-source-dirs: src@@ -49,3 +49,9 @@     inspection-testing,     transformers,     ap-normalize+  if flag(test-with-clang)+    ghc-options: -pgmP "clang -E -traditional -x c"++flag test-with-clang+  manual: True+  default: False
test/assoc.hs view
@@ -37,11 +37,20 @@ assoc1 x y z = liftA2 (,,) x y <*> z assoc2 x y z = liftA2 (\x (y, z) -> (x, y, z)) x (liftA2 (,) y z) +#ifdef __STDC__+#define CONCAT(x,y) x##y+#else+-- cpp -traditional+#define CONCAT(x,y) x'_'y+#endif+ #define TEST_ASSOC_(NAME,M,FFF,CSTR) \-assoc1'NAME, assoc2'NAME :: CSTR M a -> M b -> M c -> M (a, b, c) ; \-assoc1'NAME = assoc1 ; \-assoc2'NAME = assoc2 ; \-inspect $ 'assoc1'NAME FFF 'assoc2'NAME+CONCAT(assoc1,NAME), CONCAT(assoc2,NAME) :: CSTR M a -> M b -> M c -> M (a, b, c) ; \+CONCAT(assoc1,NAME) = assoc1 ; \+CONCAT(assoc2,NAME) = assoc2 ; \+inspect $ {-'-} 'CONCAT(assoc1,NAME) FFF {-'-} 'CONCAT(assoc2,NAME)+-- Those {-'-} {-'-} trick CPP into tokenizing single-quoted strings+-- (clang was quite confused in particular).  #define TEST_ASSOC(NAME,M,FFF) TEST_ASSOC_(NAME,M,FFF,)