1
1
mirror of https://github.com/coot/free-category.git synced 2024-12-02 03:12:35 +03:00
Commit Graph

60 Commits

Author SHA1 Message Date
Marcin Szamotulski
0e96a23ae2 Improved haddoc documentation
Let 'Queue' be exported as top implementation.  Add a note on 'Cat'
performance.
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
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
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
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
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
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
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
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
Marcin Szamotulski
08ee2a979b Free Arrows - various changes
Added:
* arrArr
* mapArr
* foldArr

Renamed:
* (:.:) as Cons (not exported)

Exported:
* Added Arr, Prod
2019-08-31 10:35:21 +00:00
Marcin Szamotulski
3746ef5d29 Efficient free arrow data type 2019-08-31 10:35:21 +00:00
Marcin Szamotulski
d88b444cfe Free.Internal - remove (:.:) constructor 2019-08-31 10:35:21 +00:00
Marcin Szamotulski
fd9dba5509 arrCat and mapCat
Renamed arrow to arrCat, since 'arrCat' is very like 'arr' for 'Arrows'.
'mapCat' is a smart constructor.
2019-08-31 10:35:21 +00:00
Marcin Szamotulski
ed310d4af7 Export Cat Id constructor
At times it is useful to be more explicit than
`id :: Category c => c a a`
2019-08-31 10:35:21 +00:00
Marcin Szamotulski
81df8c4abc Remove default-extensions from the cabal file
Add show-extensions haddock option.
2019-08-31 10:35:21 +00:00
Marcin Szamotulski
b1f3bda123 Move type aligned real time queues to an internal module 2019-08-31 10:35:21 +00:00
Marcin Szamotulski
20d61b2355
Efficient representation of a free category (#5)
* Efficient representation of free category

Using type aligned real time queues (Okasaki, 'Purely Functional Data
Structures') to represent catanable type allign lists (free categories).

Composition is O(1) and right fold is O(n), where n is number of
transitions.

* Bump version to 0.0.3

Make it compile on ghc802.

* Updated CI configuration
2019-08-31 08:12:21 +00:00
Marcin Szamotulski
bb0e91b631
Rename: EffCategory, FreeEffCat 2019-01-26 10:53:06 +01:00
Marcin Szamotulski
62d0bbe4fe
Lifting (#2)
* Initial LoginStateMachine implementation

* Nicer interface

* Lifting instance for (->) and Identity, liftKleisli function

* Added Control.Category.Lifting to free-algebras

* Reoder Lifting module

* Fixed haddoc documentation

* examples.cabal - base version

* reconfigure circle-ci

* Fixed error in GHC-8.6.1
2018-12-10 19:59:39 +01:00
Marcin Szamotulski
3fdd610608 Free Arrow 2018-10-27 12:26:44 +00:00