unification-fd 0.8.1 → 0.9.0
raw patch · 4 files changed
+60/−26 lines, 4 filesdep ~base
Dependency ranges changed: base
Files
- VERSION +13/−3
- src/Control/Unification/Types.hs +8/−3
- src/Data/Functor/Fixedpoint.hs +35/−16
- unification-fd.cabal +4/−4
VERSION view
@@ -1,12 +1,22 @@+0.9.0 (2014-XX-XX):+ - Control.Unification.Types: changed the fundeps on BindingMonad+ and RankedBindingMonad so that things compile under GHC 7.8.2+ - Data.Functor.Fixedpoint: eta-expanded RULES to avoid GHC >=+ 7.8 warnings about them potentially not firing due to (.)+ being inlined first. 0.8.1 (2014-05-27):- - Control.Unification.Types: added Functor, Foldable, and Traversable instances for UnificationFailure. (h/t Graham Rogers)+ - Control.Unification.Types: added Functor, Foldable, and+ Traversable instances for UnificationFailure. (h/t Graham Rogers) 0.8.0 (2012-07-11): - Control.Unification.Types: Changed the type of Unifiable.zipMatch 0.7.0 (2012-03-19): - Renamed MutTerm to UTerm (and MutVar to UVar) - Replaced the Variable.eqVar method by plain old Eq.(==)- - Control.Unification: added getFreeVarsAll, applyBindingsAll, freshenAll- - Swapped type argument order for MutTerm, so that it can be a functor etc. Also changed BindingMonad, UnificationFailure, Rank, and RankedBindingMonad for consistency.+ - Control.Unification: added getFreeVarsAll, applyBindingsAll,+ freshenAll+ - Swapped type argument order for MutTerm, so that it can be a+ functor etc. Also changed BindingMonad, UnificationFailure,+ Rank, and RankedBindingMonad for consistency. 0.6.0 (2012-02-17): - Removed the phantom type argument for Variables. 0.5.0 (2011-07-12):
src/Control/Unification/Types.hs view
@@ -5,7 +5,7 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} ------------------------------------------------------------------- ~ 2014.05.27+-- ~ 2014.05.28 -- | -- Module : Control.Unification.Types -- Copyright : Copyright (c) 2007--2014 wren gayle romano@@ -196,6 +196,9 @@ . showString msg ) +-- TODO: transformers-0.4.1.0 deprecated this, use+-- Control.Monad.Trans.Except instead. (transformers-0.3.0.0 is+-- fine) instance Error (UnificationFailure t v) where noMsg = UnknownError "" strMsg = UnknownError@@ -263,7 +266,7 @@ -- we make the same assumptions everywhere we use @BindingMonad@. class (Unifiable t, Variable v, Applicative m, Monad m) =>- BindingMonad t v m | m -> t v+ BindingMonad t v m | m t -> v, v m -> t where -- | Given a variable pointing to @UTerm t v@, return the@@ -321,7 +324,9 @@ -- compression is asymptotically optimal, the constant factors may -- make it worthwhile to stick with the unweighted path compression -- supported by 'BindingMonad'.-class (BindingMonad t v m) => RankedBindingMonad t v m | m -> t v where+class (BindingMonad t v m) =>+ RankedBindingMonad t v m | m t -> v, v m -> t+ where -- | Given a variable pointing to @UTerm t v@, return its -- rank and the term it's bound to.
src/Data/Functor/Fixedpoint.hs view
@@ -16,9 +16,13 @@ -- http://www.mail-archive.com/glasgow-haskell-users@haskell.org/msg14313.html {-# OPTIONS_GHC -O2 -fenable-rewrite-rules #-} +-- NOTE #1: on GHC >= 7.8 we need to eta expand rules to avoid a+-- warning about the fact that the rule may never fire because (.)+-- might inline first...+ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} ------------------------------------------------------------------- 2013.05.11+-- 2014.05.28 -- | -- Module : Data.Functor.Fixedpoint -- Copyright : Copyright (c) 2007--2014 wren gayle romano@@ -114,9 +118,10 @@ "hmap id" hmap id = id +-- cf., NOTE #1 "hmap-compose"- forall (eps :: forall a. g a -> h a) (eta :: forall a. f a -> g a).- hmap eps . hmap eta = hmap (eps . eta)+ forall (eps :: forall a. g a -> h a) (eta :: forall a. f a -> g a) x.+ hmap eps (hmap eta x) = hmap (eps . eta) x #-} @@ -128,8 +133,12 @@ hmapM eps = anaM (eps . unFix) {-# RULES-"hmapM return" hmapM return = return--- "hmapM-compose" forall eps eta. hmap eps <=< hmap eta = hmapM (eps <=< eta)+"hmapM return"+ hmapM return = return++-- "hmapM-compose"+-- forall eps eta.+-- hmap eps <=< hmap eta = hmapM (eps <=< eta) #-} @@ -141,20 +150,29 @@ ymap f = Fix . fmap f . unFix {-# RULES-"ymap id" ymap id = id-"ymap-compose" forall f g. ymap f . ymap g = ymap (f . g)+"ymap id"+ ymap id = id++-- cf., NOTE #1+"ymap-compose"+ forall f g x.+ ymap f (ymap g x) = ymap (f . g) x #-} -- | A monadic variant of 'ymap'. ymapM :: (Traversable f, Monad m) => (Fix f -> m (Fix f)) -> Fix f -> m (Fix f)-{-# INLINE ymapM #-}+{-# INLINE [0] ymapM #-} ymapM f = liftM Fix . mapM f . unFix {-# RULES-"ymapM id" ymapM return = return--- "ymapM-compose" forall f g. ymapM f <=< ymapM g = ymapM (f <=< g)+"ymapM id"+ ymapM return = return++-- "ymapM-compose"+-- forall f g.+-- ymapM f <=< ymapM g = ymapM (f <=< g) #-} @@ -190,10 +208,10 @@ "cata-refl" cata Fix = id --- TODO: do we still need eta-expanded variants of rules?+-- cf., NOTE #1 "cata-compose"- forall (eps :: forall a. f a -> g a) phi.- cata phi . cata (Fix . eps) = cata (phi . eps)+ forall (eps :: forall a. f a -> g a) phi x.+ cata phi (cata (Fix . eps) x) = cata (phi . eps) x #-} -- We can't really use this one because of the implication constraint@@ -210,7 +228,7 @@ -- -- N.B., this orders the side effects from the bottom up. cataM :: (Traversable f, Monad m) => (f a -> m a) -> (Fix f -> m a)-{-# INLINE cataM #-}+{-# INLINE [0] cataM #-} cataM phiM = self where self = phiM <=< (mapM self . unFix)@@ -258,9 +276,10 @@ ana unFix = id -- BUG: I think I dualized this right...+-- cf., NOTE #1 "ana-compose"- forall (eps :: forall a. f a -> g a) psi.- ana (eps . unFix) . ana psi = ana (eps . psi)+ forall (eps :: forall a. f a -> g a) psi x.+ ana (eps . unFix) (ana psi x) = ana (eps . psi) x #-} -- We can't really use this because of the implication constraint
unification-fd.cabal view
@@ -1,5 +1,5 @@ ------------------------------------------------------------------- wren gayle romano <wren@community.haskell.org> ~ 2014.05.27+-- wren gayle romano <wren@community.haskell.org> ~ 2014.05.28 ---------------------------------------------------------------- -- By and large Cabal >=1.2 is fine; but >= 1.6 gives tested-with:@@ -8,7 +8,7 @@ Build-Type: Simple Name: unification-fd-Version: 0.8.1+Version: 0.9.0 Stability: experimental Homepage: http://code.haskell.org/~wren/ Author: wren gayle romano@@ -21,9 +21,9 @@ Synopsis: Simple generic unification algorithms. Description: Simple generic unification algorithms. --- BUG: does not work with GHC 7.8.0. Need to fix that+-- No longer compiles with GHC-6.12.1 since Data.Monoid does not export (<>) in Control.Unification.Types. The backwards compatibility is not considered worth adding CPP noise... Tested-With:- GHC == 6.12.1, GHC == 7.6.1+ GHC == 7.6.1, GHC == 7.6.3, GHC == 7.8.2 Extra-source-files: AUTHORS, README, VERSION Source-Repository head