cmu 1.9 → 1.10
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
- cmu.cabal +1/−1
- src/Algebra/CommutativeMonoid/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 with GHC 7.10.+ Thanks go to Douglas McClean.++ * cmu.cabal (Version): Released as version 1.10+ 2013-02-21 John D. Ramsdell <ramsdell@mitre.org> * cmu.cabal (Location): Added repository location.
cmu.cabal view
@@ -1,5 +1,5 @@ Name: cmu-Version: 1.9+Version: 1.10 Maintainer: ramsdell@mitre.org Cabal-Version: >= 1.6 License: GPL
src/Algebra/CommutativeMonoid/Main.hs view
@@ -17,6 +17,7 @@ module Main (main, test) where +import Control.Applicative import System.IO (isEOF, hFlush, stdout) import Algebra.CommutativeMonoid.Unification @@ -43,15 +44,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