amnh / PCG

𝙋𝙝𝙮𝙡𝙤𝙜𝙚𝙣𝙚𝙩𝙞𝙘 𝘾𝙤𝙢𝙥𝙤𝙣𝙚𝙣𝙩 𝙂𝙧𝙖𝙥𝙝 ⸺ Haskell program and libraries for general phylogenetic graph search
28 stars 1 forks source link

Refactor out Control.Evaluation into a sub library #111

Closed recursion-ninja closed 5 years ago

recursion-ninja commented 5 years ago

The Control.Evaluation module is self contained (including Control.Monad.Logger). We should move these two libraries into a sub library along with their test suites.

Add test suites for the MonadLogger type-class that "failure nullification" and "associativity" hold.

Add the MonadWriter type-class instance to Evaluation and MonadWriterT to EvaluationT.

recursion-ninja commented 5 years ago

Add the MonadReader type-class instance to Evaluation andMonadReaderT to EvaluationT to store "global variable".

Boarders commented 5 years ago

I'm not sure whether Evaluation has a legal Reader instance?

Boarders commented 5 years ago

I have now factored this out and added a test suite for Logger and Writer instances for Evaluation and EvaluationT here: https://github.com/amnh/PCG/commit/5771d5d66c79f37e65c54e703eaa88c717bd0d66

Boarders commented 5 years ago

For the Reader instance I changed SearchState as follows: type GlobalSettings = () type SearchState = EvaluationT (ReaderT GlobalSettings IO) GraphState

I then added a MonadReader instance for EvaluationT and made the necessary changes to main etc. There is now a function defined in PCG.Computation.Internal as follows: getGlobalSettings :: IO GlobalSettings For now though it doesn't do anything.