I’ve just noticed that you can do many of the things you advertise also with the lattices
package, e.g.:
import Algebra.Lattice
import qualified Data.Set as S
import qualified Data.Map as M
transitive g =
lfpFrom g $ \sets ->
M.mapWithKey
(\v vs -> S.insert v (S.unions [ sets M.! v' | v' <- S.toList vs ]))
sets
main = print $ transitive
$ M.map S.fromList $ M.fromList [(1,[2,3]),(2,[1,3]),(3,[])]
I guess your package has the advantage of allowing more natural code. But it requires using custom functions like rInsert
and the R
type wrapper, so I’m not sure which is easier to use.
I guess performance is another advantage of your approach.