1
1
mirror of https://github.com/coot/free-category.git synced 2024-11-26 10:13:56 +03:00
Commit Graph

145 Commits

Author SHA1 Message Date
Marcin Szamotulski
259b8eecb6 Updated benchmark reports 2019-09-07 09:58:45 +02:00
Marcin Szamotulski
450b78f918 Swapped ListTr for Queue
Queue performes ~66% better thaan ListTr, and is more prone for foldl
/ foldr than 'Cat'.
2019-09-07 09:58:45 +02:00
Marcin Szamotulski
2e29c220a0 Added Queue category instance benchmarks 2019-09-07 09:58:45 +02:00
Marcin Szamotulski
059d54ecdd Reorder ListTr instances 2019-09-07 09:58:45 +02:00
Marcin Szamotulski
1dc4cad07f Added Category instance for Queue
Including tests.
2019-09-07 09:58:45 +02:00
Marcin Szamotulski
d3b19e4d59 Renamed Queue interface
* `snoc`   -> `snocQ`
* `cons`   -> `consQ`
* `uncons` -> `unconsQ`
2019-09-07 09:58:45 +02:00
Marcin Szamotulski
99121aff4f Added hoistFreeH2 to Control.Category.Free export list 2019-09-07 09:00:20 +02:00
Marcin Szamotulski
1dc741964b Added Show instances for Cat and C 2019-09-07 09:00:20 +02:00
Marcin Szamotulski
074b57df8f Code style 2019-09-07 09:00:20 +02:00
Marcin Szamotulski
229793d7fd Improved haddocks 2019-09-07 09:00:20 +02:00
Marcin Szamotulski
8152515847 Added more tests
Test:
* category laws
* compatibility for 'foldNatFree2' for categories and 'foldMap' for
  monoids.
2019-09-05 20:56:37 +00:00
Marcin Szamotulski
57924b4a72 Improved haddocs 2019-09-05 07:42:30 +00:00
Marcin Szamotulski
6906ee238a Added proof that op = unsafeCoerce is safe 2019-09-05 07:42:30 +00:00
Marcin Szamotulski
a8c7f5df27 Moved Cat Category instance close to definition 2019-09-05 07:42:30 +00:00
Marcin Szamotulski
3405380fbf Updated ListTr haddock 2019-09-05 07:42:30 +00:00
Marcin Szamotulski
510c758b59 Removed some INLINE pragmas
Some are just unnecessary.
2019-09-05 07:42:30 +00:00
Marcin Szamotulski
ecfff505c4 Remove unnecessary indirection in definition of Cat
This is internal change, since `Cat' constructor is not exposed.
2019-09-05 07:42:30 +00:00
Marcin Szamotulski
78a65122e0
Fixed a typo in README.md file 2019-09-03 21:46:21 +02:00
Marcin Szamotulski
ea038180e6 Remove duplicated field in free-category.cabal 2019-09-03 18:18:44 +00:00
Marcin Szamotulski
863bf9582e Renamed API in Control.Category.FreeEff
Renamed `Control.Category.FreeEff` module as
`Control.Category.FreeEffect`
  and renamed top level terms:
  - `EffCategory` type class to `EffectCategory`
  - `FreeEffCat` to `EffCat`
  - `FreeEffCat` constructor as `Effect` and `lift` as `effect`
  - `liftCat` to `liftEffect`
  - `foldNatLift` to `foldNatEffCat`
2019-09-03 07:31:33 +00:00
Marcin Szamotulski
6786025a6f Removed CatL
Other presentations have better performance, not need to explode the
API.
2019-09-03 06:45:16 +00:00
Marcin Szamotulski
d58d6b30f1 Basic tests of Cat and friends 2019-09-02 20:29:14 +00:00
Marcin Szamotulski
066ce9682f Added ListTr Show instance for GHC<806 2019-09-02 20:29:14 +00:00
Marcin Szamotulski
fa7963e053 Style changes 2019-09-02 20:29:14 +00:00
Marcin Szamotulski
8887ee6788 Added Queue and ListTr Show instance for GHC<806 2019-09-02 20:29:14 +00:00
Marcin Szamotulski
5a2c359aee Queue tests
Model Queue with a list and check basic properties of
* cons
* snoc
* foldrQ
* foldlQ
2019-09-02 20:29:14 +00:00
Marcin Szamotulski
46b5016d2e Rename foldQ as foldNatQ
To resamble `foldMap` from the `Foldable` type class.
2019-09-02 20:29:14 +00:00
Marcin Szamotulski
c5d2d09539 foldrQ and folrQ for 'Queue' 2019-09-02 20:29:14 +00:00
Marcin Szamotulski
93d0f96b5d Added INLINE pragma for various Arrow instances 2019-09-01 14:44:32 +00:00
Marcin Szamotulski
b8e9a949eb Added Arrow instance for Cat 2019-09-01 14:44:32 +00:00
Marcin Szamotulski
9785528931 Relaxed signature of zipWithQ
It is enough to require that `f` is a category.
2019-09-01 14:44:32 +00:00
Marcin Szamotulski
c024158c58
Bump version: v0.0.4.0 2019-09-01 14:41:15 +02:00
Marcin Szamotulski
ad561f3bd1
Just commit texts raports 2019-09-01 14:20:33 +02:00
Marcin Szamotulski
c28e07f47f
Added links to benchmarks to the readme file 2019-09-01 14:20:33 +02:00
Marcin Szamotulski
238f95cb4d
Renamed Cat -> CatL, CatR -> Cat
This way it is more obvious which of the categories is the fastest.
I might remove `CatR` later.
2019-09-01 14:20:29 +02:00
Marcin Szamotulski
716a6ab428
Export lengthListTr 2019-09-01 14:20:08 +02:00
Marcin Szamotulski
61a5e8e79c
Export ListTr from Control.Category.Free
Also improve documentation.
2019-09-01 14:20:08 +02:00
Marcin Szamotulski
5eb3fbd101
criterion benchmarks 2019-09-01 14:19:59 +02:00
Marcin Szamotulski
6657824470 CatR - optimised version of Cat
This data structure is optimised for morphisms build with a right fold,
e.g. `(.)` and `foldr`.  The optimisations were visible with `-O1` and
`-O2`; with no optimisations (`-O0`), this data structure performs wors
than `Cat` or `ListTr`.
2019-09-01 12:09:39 +00:00
Marcin Szamotulski
5864b3ad7f Optimisations of 'Cat'
Adding INLINE pragmas, optimising order of pattern matches.
2019-09-01 12:09:39 +00:00
Marcin Szamotulski
3b9c127ff8 Adding ViewL to Free.Internal export list 2019-09-01 12:09:39 +00:00
Marcin Szamotulski
be5cfdc552 Optimise internal Queue
Queue contains three 'ListTr', only the middle one, which holds reverse
values, should be forced to weak normal form.  Otherwise the queue will
not be as performant as designed.  A performance gain was measured.

Adding INLINE pragmas had a significant improvemnt in performance of the
queue.
2019-09-01 12:09:39 +00:00
Marcin Szamotulski
166dfc8947 Added hoistQ: Queue is an endo-functor on the category of categories 2019-09-01 12:09:39 +00:00
Marcin Szamotulski
c77fa194f5 Show instances for ListTr and Queue (with QuantifiedConstraints) 2019-09-01 12:09:39 +00:00
Marcin Szamotulski
d4966a6108 Fixed a bug in 'uncons'
Make `Queue.uncons` perserve `Queue` invariant.
2019-09-01 12:09:39 +00:00
Marcin Szamotulski
cd58b91419 Stylish edits 2019-09-01 12:09:39 +00:00
Marcin Szamotulski
df0d3e4528 hoistOp - Op is an endo-functor of category of categories 2019-09-01 12:09:39 +00:00
Marcin Szamotulski
559f9fb404
README.md - some edits 2019-08-31 12:40:00 +02:00
Marcin Szamotulski
97cfd5c551 Updated README and CHANGELOG files 2019-08-31 10:35:21 +00:00
Marcin Szamotulski
1f20714c0a Added semigroup and monoid instances
Arr anc A are categories, and thus every endo-morphism object is
a monoid.
2019-08-31 10:35:21 +00:00