kuribas / mfsolve Goto Github PK
View Code? Open in Web Editor NEWmfsolve
License: BSD 3-Clause "New" or "Revised" License
mfsolve
License: BSD 3-Clause "New" or "Revised" License
It'd be nice if mfsolve were documented more thoroughly. For instance, why are Exp
and Log
unary operators?
Citing from http://hydra.cryp.to/build/1140532/log/raw:
Preprocessing test suite 'test' for mfsolve-0.2.0...
[1 of 1] Compiling Main ( tests/test.hs, dist/build/test/test-tmp/Main.dyn_o )
tests/test.hs:107:8: Not in scope: ‘solveEqs’
Math/MFSolve.hs:103:8:
Could not find module ‘Control.Monad.Except’
The problem I think is that it picked mtl-2.1
which does not have Control.Monad.Except
.
In order to support both mtl-2.1
and 2.2
, you can depend on the mtl-compat
package instead of depending on mtl
directly: https://hackage.haskell.org/package/mtl-compat
I sent a pull request, which is a bad implementation, but something is needed to show the user when equations go wrong.
A good improvement on the code I wrote would be to show the most recent equation as submitted---which I think means showing results before substitution (as well as or instead of results after substitution).
Math/MFSolve.hs:269:41: error:
Not in scope: type constructor or class ‘ExceptT’
|
269 | MFSolverT (StateT (Dependencies v n) (ExceptT (DepError v n) m) a)
| ^^^^^^^
All versions on Hackage seem affected.
As a Hackage trustee I have created revisions for these versions that should prevent users from encountering these errors. See e.g. https://hackage.haskell.org/package/mfsolve-0.3.2.1/revisions/.
If addEquation
and getKnown
used the same error type, they could be used together in the Either
monad, which would be convenient. As it is stands, I resort to something like the following.
where c0 :: Either (DepError SimpleVar Double) Double
c0 = do d1 <- addEquality noDeps (eqn p1) "c0"
d2 <- addEquality d1 (eqn p2) "c0"
soln <- addEquality d2 (eqn p3) "c0"
first (const $ UndefinedVar "c0") $ getKnown "c0" soln
Seems like an instance
declaration was left over that has been moved into the library:
Building test suite 'test' for mfsolve-0.3.2.1..
[1 of 1] Compiling Main ( tests/test.hs, dist/build/test/test-tmp/Main.o )
tests/test.hs:52:10: error:
Duplicate instance declarations:
instance (Floating n, Eq n, Ord n, Ord v) => Eq (Expr v n)
-- Defined at tests/test.hs:52:10
instance (Eq n, Eq v) => Eq (Expr v n) -- Defined in ‘Math.MFSolve’
|
52 | instance (Floating n, Eq n, Ord n, Ord v) => Eq (Expr v n) where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.