agum 2.5 → 2.6
raw patch · 3 files changed
+21/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog +8/−0
- agum.cabal +1/−1
- src/Algebra/AbelianGroup/Main.hs +12/−1
ChangeLog view
@@ -1,3 +1,11 @@+2015-04-27 John D. Ramsdell <ramsdell@mitre.org>++ * src/Algebra/AbelianGroup/Main.hs (AnsErr): Added Functor and+ Applicative instance so that the code compiles in GHC 7.10.+ Thanks go to Douglas McClean.++ * agum.cabal (Version): Released as version 2.6+ 2013-02-21 John D. Ramsdell <ramsdell@mitre.org> * agum.cabal (Location): Added repository location.
agum.cabal view
@@ -1,5 +1,5 @@ Name: agum-Version: 2.5+Version: 2.6 Maintainer: ramsdell@mitre.org Cabal-Version: >= 1.6 License: GPL
src/Algebra/AbelianGroup/Main.hs view
@@ -17,6 +17,7 @@ module Main (main, test) where +import Control.Applicative import System.IO (isEOF, hFlush, stdout) import Algebra.AbelianGroup.UnificationMatching @@ -47,15 +48,25 @@ [] -> fail "no parse" _ -> fail "ambiguous parse" +-- Like Either String but with fail method defined data AnsErr a = Ans a | Err String +instance Functor (AnsErr) where+ fmap _ (Err x) = Err x+ fmap f (Ans y) = Ans (f y)++instance Applicative (AnsErr) where+ pure = Ans+ Err e <*> _ = Err e+ Ans f <*> r = fmap f r+ instance Monad AnsErr where (Ans x) >>= k = k x (Err s) >>= _ = Err s return = Ans- fail = Err+ fail = Err -- fail is Err -- Main loop